1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8515],{458:(e,t,r)=>{"use strict";r.d(t,{Vw:()=>I,DO:()=>o,CC:()=>c,sd:()=>a,Fe:()=>s,Ht:()=>l,My:()=>y,uH:()=>u,Id:()=>_,qj:()=>A,O8:()=>d,aT:()=>v,aY:()=>n,po:()=>S,Ow:()=>f,fd:()=>p,ZJ:()=>E,DH:()=>h,AI:()=>x});let i="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function n(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function s(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function o(e,...t){if(!n(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function a(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.createHasher");s(e.outputLen),s(e.blockLen)}function c(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function l(e,t){o(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}function h(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function u(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function d(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function f(e,t){return e<<32-t|e>>>t}let p=68===new Uint8Array(new Uint32Array([0x11223344]).buffer)[0]?e=>e:function(e){for(let r=0;r<e.length;r++){var t;e[r]=(t=e[r])<<24&0xff000000|t<<8&0xff0000|t>>>8&65280|t>>>24&255}return e},g="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,m=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function y(e){if(o(e),g)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=m[e[r]];return t}let b={_0:48,_9:57,A:65,F:70,a:97,f:102};function w(e){return e>=b._0&&e<=b._9?e-b._0:e>=b.A&&e<=b.F?e-(b.A-10):e>=b.a&&e<=b.f?e-(b.a-10):void 0}function v(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);if(g)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let i=new Uint8Array(r);for(let t=0,n=0;t<r;t++,n+=2){let r=w(e.charCodeAt(n)),s=w(e.charCodeAt(n+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[n]+e[n+1])+'" at index '+n);i[t]=16*r+s}return i}function x(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function E(e){return"string"==typeof e&&(e=x(e)),o(e),e}function _(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];o(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){let n=e[t];r.set(n,i),i+=n.length}return r}class I{}function A(e){let t=t=>e().update(E(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function S(e=32){if(i&&"function"==typeof i.getRandomValues)return i.getRandomValues(new Uint8Array(e));if(i&&"function"==typeof i.randomBytes)return Uint8Array.from(i.randomBytes(e));throw Error("crypto.getRandomValues must be defined")}},669:(e,t,r)=>{let i=r(46342).getSymbolSize;t.getRowColCoords=function(e){if(1===e)return[];let t=Math.floor(e/7)+2,r=i(e),n=145===r?26:2*Math.ceil((r-13)/(2*t-2)),s=[r-7];for(let e=1;e<t-1;e++)s[e]=s[e-1]-n;return s.push(6),s.reverse()},t.getPositions=function(e){let r=[],i=t.getRowColCoords(e),n=i.length;for(let e=0;e<n;e++)for(let t=0;t<n;t++)(0!==e||0!==t)&&(0!==e||t!==n-1)&&(e!==n-1||0!==t)&&r.push([i[e],i[t]]);return r}},2339:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.s16=t.s8=t.nu64be=t.u48be=t.u40be=t.u32be=t.u24be=t.u16be=t.nu64=t.u48=t.u40=t.u32=t.u24=t.u16=t.u8=t.offset=t.greedy=t.Constant=t.UTF8=t.CString=t.Blob=t.Boolean=t.BitField=t.BitStructure=t.VariantLayout=t.Union=t.UnionLayoutDiscriminator=t.UnionDiscriminator=t.Structure=t.Sequence=t.DoubleBE=t.Double=t.FloatBE=t.Float=t.NearInt64BE=t.NearInt64=t.NearUInt64BE=t.NearUInt64=t.IntBE=t.Int=t.UIntBE=t.UInt=t.OffsetLayout=t.GreedyCount=t.ExternalLayout=t.bindConstructorLayout=t.nameWithProperty=t.Layout=t.uint8ArrayToBuffer=t.checkUint8Array=void 0,t.constant=t.utf8=t.cstr=t.blob=t.unionLayoutDiscriminator=t.union=t.seq=t.bits=t.struct=t.f64be=t.f64=t.f32be=t.f32=t.ns64be=t.s48be=t.s40be=t.s32be=t.s24be=t.s16be=t.ns64=t.s48=t.s40=t.s32=t.s24=void 0;let i=r(81029);function n(e){if(!(e instanceof Uint8Array))throw TypeError("b must be a Uint8Array")}function s(e){return n(e),i.Buffer.from(e.buffer,e.byteOffset,e.length)}t.checkUint8Array=n,t.uint8ArrayToBuffer=s;class o{constructor(e,t){if(!Number.isInteger(e))throw TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw RangeError("indeterminate span");return this.span}replicate(e){let t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function a(e,t){return t.property?e+"["+t.property+"]":e}t.Layout=o,t.nameWithProperty=a,t.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(e,"layout_"))throw Error("Class is already bound to a layout");if(!(t&&t instanceof o))throw TypeError("layout must be a Layout");
1if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=()=>new e,Object.defineProperty(e.prototype,"encode",{value(e,r){return t.encode(this,e,r)},writable:!0}),Object.defineProperty(e,"decode",{value:(e,r)=>t.decode(e,r),writable:!0})};class c extends o{isCount(){throw Error("ExternalLayout is abstract")}}t.ExternalLayout=c;class l extends c{constructor(e=1,t){if(!Number.isInteger(e)||0>=e)throw TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t=0){return n(e),Math.floor((e.length-t)/this.elementSpan)}encode(e,t,r){return 0}}t.GreedyCount=l;class h extends c{constructor(e,t=0,r){if(!(e instanceof o))throw TypeError("layout must be a Layout");if(!Number.isInteger(t))throw TypeError("offset must be integer or undefined");super(e.span,r||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof u||this.layout instanceof d}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,r=0){return this.layout.encode(e,t,r+this.offset)}}t.OffsetLayout=h;class u extends o{constructor(e,t){if(super(e,t),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(e,t=0){return s(e).readUIntLE(t,this.span)}encode(e,t,r=0){return s(t).writeUIntLE(e,r,this.span),this.span}}t.UInt=u;class d extends o{constructor(e,t){if(super(e,t),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(e,t=0){return s(e).readUIntBE(t,this.span)}encode(e,t,r=0){return s(t).writeUIntBE(e,r,this.span),this.span}}t.UIntBE=d;class f extends o{constructor(e,t){if(super(e,t),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(e,t=0){return s(e).readIntLE(t,this.span)}encode(e,t,r=0){return s(t).writeIntLE(e,r,this.span),this.span}}t.Int=f;class p extends o{constructor(e,t){if(super(e,t),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(e,t=0){return s(e).readIntBE(t,this.span)}encode(e,t,r=0){return s(t).writeIntBE(e,r,this.span),this.span}}function g(e){let t=Math.floor(e/0x100000000);return{hi32:t,lo32:e-0x100000000*t}}function m(e,t){return 0x100000000*e+t}t.IntBE=p;class y extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e),i=r.readUInt32LE(t);return m(r.readUInt32LE(t+4),i)}encode(e,t,r=0){let i=g(e),n=s(t);return n.writeUInt32LE(i.lo32,r),n.writeUInt32LE(i.hi32,r+4),8}}t.NearUInt64=y;class b extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e);return m(r.readUInt32BE(t),r.readUInt32BE(t+4))}encode(e,t,r=0){let i=g(e),n=s(t);return n.writeUInt32BE(i.hi32,r),n.writeUInt32BE(i.lo32,r+4),8}}t.NearUInt64BE=b;class w extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e),i=r.readUInt32LE(t);return m(r.readInt32LE(t+4),i)}encode(e,t,r=0){let i=g(e),n=s(t);return n.writeUInt32LE(i.lo32,r),n.writeInt32LE(i.hi32,r+4),8}}t.NearInt64=w;class v extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e);return m(r.readInt32BE(t),r.readUInt32BE(t+4))}encode(e,t,r=0){let i=g(e),n=s(t);return n.writeInt32BE(i.hi32,r),n.writeUInt32BE(i.lo32,r+4),8}}t.NearInt64BE=v;class x extends o{constructor(e){super(4,e)}decode(e,t=0){return s(e).readFloatLE(t)}encode(e,t,r=0){return s(t).writeFloatLE(e,r),4}}t.Float=x;class E extends o{constructor(e){super(4,e)}decode(e,t=0){return s(e).readFloatBE(t)}encode(e,t,r=0){return s(t).writeFloatBE(e,r),4}}t.FloatBE=E;class _ extends o{constructor(e){super(8,e)}decode(e,t=0){return s(e).readDoubleLE(t)}encode(e,t,r=0){return s(t).writeDoubleLE(e,r),8}}t.Double=_;class I extends o{constructor(e){super(8,e)}decode(e,t=0){return s(e).readDoubleBE(t)}encode(e,t,r=0){return s(t).writeDoubleBE(e,r),8}}t.DoubleBE=I;class A extends o{constructor(e,t,r){if(!(e instanceof o))throw TypeError("elementLayout must be a Layout");if(!(t instanceof c&&t.isCount()||Number.isInteger(t)&&0<=t))throw TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let i=-1;t instanceof c||!(0<e.span)||(i=t*e.span),super(i,r),this.elementLayout=e,this.count=t}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0,i=this.count;if(i instanceof c&&(i=i.decode(e,t)),0<this.elementLayout.span)r=i*this.elementLayout.span;else{let n=0;for(;n<i;)r+=this.elementLayout.getSpan(e,t+r),++n}return r}decode(e,t=0){let r=[],i=0,n=this.count;for(n instanceof c&&(n=n.decode(e,t));i<n;)r.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),i+=1;return r}encode(e,t,r=0){let i=this.elementLayout,n=e.reduce((e,n)=>e+i.encode(n,t,r+e),0);return this.count instanceof c&&this.count.encode(e.length,t,r),n}}t.Sequence=A;class S extends o{constructor(e,t,r){if(!(Array.isArray(e)&&e.reduce((e,t)=>
1e&&t instanceof o,!0)))throw TypeError("fields must be array of Layout instances");for(let i of("boolean"==typeof t&&void 0===r&&(r=t,t=void 0),e))if(0>i.span&&void 0===i.property)throw Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=e.reduce((e,t)=>e+t.getSpan(),0)}catch(e){}super(i,t),this.fields=e,this.decodePrefixes=!!r}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((r,i)=>{let n=i.getSpan(e,t);return t+=n,r+n},0)}catch(e){throw RangeError("indeterminate span")}return r}decode(e,t=0){n(e);let r=this.makeDestinationObject();for(let i of this.fields)if(void 0!==i.property&&(r[i.property]=i.decode(e,t)),t+=i.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return r}encode(e,t,r=0){let i=r,n=0,s=0;for(let i of this.fields){let o=i.span;if(s=0<o?o:0,void 0!==i.property){let n=e[i.property];void 0!==n&&(s=i.encode(n,t,r),0>o&&(o=i.getSpan(t,r)))}n=r,r+=o}return n+s-i}fromArray(e){let t=this.makeDestinationObject();for(let r of this.fields)void 0!==r.property&&0<e.length&&(t[r.property]=e.shift());return t}layoutFor(e){if("string"!=typeof e)throw TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}offsetOf(e){if("string"!=typeof e)throw TypeError("property must be string");let t=0;for(let r of this.fields){if(r.property===e)return t;0>r.span?t=-1:0<=t&&(t+=r.span)}}}t.Structure=S;class C{constructor(e){this.property=e}decode(e,t){throw Error("UnionDiscriminator is abstract")}encode(e,t,r){throw Error("UnionDiscriminator is abstract")}}t.UnionDiscriminator=C;class N extends C{constructor(e,t){if(!(e instanceof c&&e.isCount()))throw TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,r){return this.layout.encode(e,t,r)}}t.UnionLayoutDiscriminator=N;class O extends o{constructor(e,t,r){let i;if(e instanceof u||e instanceof d)i=new N(new h(e));else if(e instanceof c&&e.isCount())i=new N(e);else if(e instanceof C)i=e;else throw TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===t&&(t=null),!(null===t||t instanceof o))throw TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let n=-1;t&&0<=(n=t.span)&&(e instanceof u||e instanceof d)&&(n+=i.layout.span),super(n,r),this.discriminator=i,this.usesPrefixDiscriminator=e instanceof u||e instanceof d,this.defaultLayout=t,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return s(e)},this.configGetSourceVariant=function(e){s=e.bind(this)}}getSpan(e,t=0){if(0<=this.span)return this.span;let r=this.getVariant(e,t);if(!r)throw Error("unable to determine span for unrecognized variant");return r.getSpan(e,t)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;let t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(let t in this.registry){let r=this.registry[t];if(r.property&&Object.prototype.hasOwnProperty.call(e,r.property))return r}throw Error("unable to infer src variant")}decode(e,t=0){let r,i=this.discriminator,n=i.decode(e,t),s=this.registry[n];if(void 0===s){let s=this.defaultLayout,o=0;this.usesPrefixDiscriminator&&(o=i.layout.span),(r=this.makeDestinationObject())[i.property]=n,r[s.property]=s.decode(e,t+o)}else r=s.decode(e,t);return r}encode(e,t,r=0){let i=this.getSourceVariant(e);if(void 0===i){let i=this.discriminator,n=this.defaultLayout,s=0;return this.usesPrefixDiscriminator&&(s=i.layout.span),i.encode(e[i.property],t,r),s+n.encode(e[n.property],t,r+s)}return i.encode(e,t,r)}addVariant(e,t,r){let i=new P(this,e,t,r);return this.registry[e]=i,i}getVariant(e,t=0){let r;return r=e instanceof Uint8Array?this.discriminator.decode(e,t):e,this.registry[r]}}t.Union=O;
1class P extends o{constructor(e,t,r,i){if(!(e instanceof O))throw TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw TypeError("variant must be a (non-negative) integer");if("string"==typeof r&&void 0===i&&(i=r,r=null),r){if(!(r instanceof o))throw TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=r.span&&r.span>e.defaultLayout.span)throw Error("variant span exceeds span of containing union");if("string"!=typeof i)throw TypeError("variant must have a String property")}let n=e.span;0>e.span&&0<=(n=r?r.span:0)&&e.usesPrefixDiscriminator&&(n+=e.discriminator.layout.span),super(n,i),this.union=e,this.variant=t,this.layout=r||null}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span);let i=0;return this.layout&&(i=this.layout.getSpan(e,t+r)),r+i}decode(e,t=0){let r=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))throw Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(e,t+i):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(e,t,r=0){let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,r);let n=i;if(this.layout&&(this.layout.encode(e[this.property],t,r+i),n+=this.layout.getSpan(t,r+i),0<=this.union.span&&n>this.union.span))throw Error("encoded variant overruns containing union");return n}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function T(e){return 0>e&&(e+=0x100000000),e}t.VariantLayout=P;class M extends o{constructor(e,t,r){if(!(e instanceof u||e instanceof d))throw TypeError("word must be a UInt or UIntBE layout");if("string"==typeof t&&void 0===r&&(r=t,t=!1),4<e.span)throw RangeError("word cannot exceed 32 bits");super(e.span,r),this.word=e,this.msb=!!t,this.fields=[];let i=0;this._packedSetValue=function(e){return i=T(e),this},this._packedGetValue=function(){return i}}decode(e,t=0){let r=this.makeDestinationObject(),i=this.word.decode(e,t);for(let t of(this._packedSetValue(i),this.fields))void 0!==t.property&&(r[t.property]=t.decode(e));return r}encode(e,t,r=0){let i=this.word.decode(t,r);for(let t of(this._packedSetValue(i),this.fields))if(void 0!==t.property){let r=e[t.property];void 0!==r&&t.encode(r)}return this.word.encode(this._packedGetValue(),t,r)}addField(e,t){let r=new R(this,e,t);return this.fields.push(r),r}addBoolean(e){let t=new k(this,e);return this.fields.push(t),t}fieldFor(e){if("string"!=typeof e)throw TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}}t.BitStructure=M;class R{constructor(e,t,r){if(!(e instanceof M))throw TypeError("container must be a BitStructure");if(!Number.isInteger(t)||0>=t)throw TypeError("bits must be positive integer");let i=8*e.span,n=e.fields.reduce((e,t)=>e+t.bits,0);if(t+n>i)throw Error("bits too long for span remainder ("+(i-n)+" of "+i+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,32===t&&(this.valueMask=0xffffffff),this.start=n,this.container.msb&&(this.start=i-n-t),this.wordMask=T(this.valueMask<<this.start),this.property=r}decode(e,t){return T(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(e){if("number"!=typeof e||!Number.isInteger(e)||e!==T(e&this.valueMask))throw TypeError(a("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let t=this.container._packedGetValue(),r=T(e<<this.start);this.container._packedSetValue(T(t&~this.wordMask)|r)}}t.BitField=R;class k extends R{constructor(e,t){super(e,1,t)}decode(e,t){return!!super.decode(e,t)}encode(e){"boolean"==typeof e&&(e*=1),super.encode(e)}}t.Boolean=k;class D extends o{constructor(e,t){if(!(e instanceof c&&e.isCount()||Number.isInteger(e)&&0<=e))throw TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;e instanceof c||(r=e),super(r,t),this.length=e}getSpan(e,t){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),r}decode(e,t=0){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),s(e).slice(t,t+r)}encode(e,t,r){let i=this.length;if(this.length instanceof c&&(i=e.length),!(e instanceof Uint8Array&&i===e.length))throw TypeError(a("Blob.encode",this)+" requires (length "+i+") Uint8Array as src");if(r+i>t.length)throw RangeError("encoding overruns Uint8Array");let n=s(e);return s(t).write(n.toString("hex"),r,i,"hex"),this.length instanceof c&&this.length.encode(i,t,r),i}}t.Blob=D;class L extends o{constructor(e){super(-1,e)}getSpan(e,t=0){n(e);let r=t;for(;r<e.length&&0!==e[r];)r+=1;return 1+r-t}decode(e,t=0){let r=this.getSpan(e,t);return s(e).slice(t,t+r-1).toString("utf-8")}encode(e,t,r=0){"string"!=typeof e&&(e=String(e));let n=i.Buffer.from(e,"utf8"),o=n.length;if(r+o>t.length)throw RangeError("encoding overruns Buffer");let a=s(t);return n.copy(a,r),a[r+o]=0,o+1}}t.CString=L;class U extends o{constructor(e,t){if("string"==typeof e&&void 0===t&&(t=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t=0){return n(e),e.length-t}decode(e,t=0){let r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw RangeError("text length exceeds maxSpan");return s(e).slice(t,t+r).toString("utf-8")}encode(e,t,r=0){"string"!=typeof e&&(e=String(e));let n=i.Buffer.from(e,"utf8"),o=n.length;if(0<=this.maxSpan&&this.maxSpan<o)throw RangeError("text length exceeds maxSpan");if(r+o>t.length)throw RangeError("encoding overruns Buffer");return n.copy(s(t),r),o}}t.UTF8=U;class B extends o{constructor(e,t){super(0,t),this.value=e}decode(e,t){return this.value}encode(e,t,r){return 0}}t.Constant=B,t.greedy=(e,t)=>new l(e,t),t.offset=(e,t,r)=>new h(e,t,r),t.u8=e=>new u(1,e),t.u16=e=>new u(2,e),t.u24=e=>new u(3,e),t.u32=e=>new u(4,e),t.u40=e=>new u(5,e),t.u48=e=>new u(6,e),t.nu64=e=>new y(e),t.u16be=e=>new d(2,e),t.u24be=e=>new d(3,e),t.u32be=e=>new d(4,e),t.u40be=e=>new d(5,e),t.u48be=e=>new d(6,e),t.nu64be=e=>new b(e),t.s8=e=>new f(1,e),t.s16=e=>
1new f(2,e),t.s24=e=>new f(3,e),t.s32=e=>new f(4,e),t.s40=e=>new f(5,e),t.s48=e=>new f(6,e),t.ns64=e=>new w(e),t.s16be=e=>new p(2,e),t.s24be=e=>new p(3,e),t.s32be=e=>new p(4,e),t.s40be=e=>new p(5,e),t.s48be=e=>new p(6,e),t.ns64be=e=>new v(e),t.f32=e=>new x(e),t.f32be=e=>new E(e),t.f64=e=>new _(e),t.f64be=e=>new I(e),t.struct=(e,t,r)=>new S(e,t,r),t.bits=(e,t,r)=>new M(e,t,r),t.seq=(e,t,r)=>new A(e,t,r),t.union=(e,t,r)=>new O(e,t,r),t.unionLayoutDiscriminator=(e,t)=>new N(e,t),t.blob=(e,t)=>new D(e,t),t.cstr=e=>new L(e),t.utf8=(e,t)=>new U(e,t),t.constant=(e,t)=>new B(e,t)},2497:(e,t,r)=>{"use strict";e.exports=function(e){return!function(){var t=e.lib.StreamCipher,r=e.algo,i=r.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;for(var n=0,s=0;n<256;n++){var o=n%r,a=t[o>>>2]>>>24-o%4*8&255;s=(s+i[n]+a)%256;var c=i[n];i[n]=i[s],i[s]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=n.call(this)},keySize:8,ivSize:0});function n(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}e.RC4=t._createHelper(i);var s=r.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)n.call(this)}});e.RC4Drop=t._createHelper(s)}(),e.RC4}(r(16611),r(9956),r(11816),r(93524),r(99229))},2648:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=r(12590);i.__exportStar(r(48543),t),i.__exportStar(r(25939),t)},3285:e=>{function t(e,t){if(!e)throw Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw Error(r||"Assertion failed: "+e+" != "+t)}},4117:(e,t,r)=>{"use strict";var i=r(20920).rotr32;function n(e,t,r){return e&t^e&r^t&r}t.ft_1=function(e,t,r,i){var s;return 0===e?(s=t)&r^~s&i:1===e||3===e?t^r^i:2===e?n(t,r,i):void 0},t.ch32=function(e,t,r){return e&t^~e&r},t.maj32=n,t.p32=function(e,t,r){return e^t^r},t.s0_256=function(e){return i(e,2)^i(e,13)^i(e,22)},t.s1_256=function(e){return i(e,6)^i(e,11)^i(e,25)},t.g0_256=function(e){return i(e,7)^i(e,18)^e>>>3},t.g1_256=function(e){return i(e,17)^i(e,19)^e>>>10}},4707:(e,t,r)=>{"use strict";e.exports=function(e){var t,r;return e.mode.OFB=(r=(t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,s=this._keystream;n&&(s=this._keystream=n.slice(0),this._iv=void 0),r.encryptBlock(s,0);for(var o=0;o<i;o++)e[t+o]^=s[o]}}),t.Decryptor=r,t),e.mode.OFB}(r(16611),r(99229))},4871:(e,t,r)=>{"use strict";r.d(t,{F:()=>s});var i=r(16459),n=r(50155);class s extends n.IJsonRpcProvider{constructor(e){super(e),this.events=new i.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict((0,n.formatJsonRpcRequest)(e.method,e.params||[],e.id||(0,n.getBigIntRpcId)().toString()),t)}async requestStrict(e,t){return new Promise(async(r,i)=>{if(!this.connection.connected)try{await this.open()}catch(e){i(e)}this.events.on(`${e.id}`,e=>{(0,n.isJsonRpcError)(e)?i(e.error):r(e.result)});try{await this.connection.send(e,t)}catch(e){i(e)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),(0,n.isJsonRpcResponse)(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&this.events.emit("error",Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof e&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}},5127:function(e,t,r){"use strict";var i=r(81029).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__decorate||function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i
vendor: 4,838 bytes, line 1
1);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return s(t,e),t},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeUnchecked=t.deserialize=t.serialize=t.BinaryReader=t.BinaryWriter=t.BorshError=t.baseDecode=t.baseEncode=void 0;let l=c(r(50786)),h=c(r(88857)),u=a(r(81803)),d=new("function"!=typeof TextDecoder?u.TextDecoder:TextDecoder)("utf-8",{fatal:!0});t.baseEncode=function(e){return"string"==typeof e&&(e=i.from(e,"utf8")),h.default.encode(i.from(e))},t.baseDecode=function(e){return i.from(h.default.decode(e))};class f extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}t.BorshError=f;class p{constructor(){this.buf=i.alloc(1024),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=i.concat([this.buf,i.alloc(1024)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(i.from(new l.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(i.from(new l.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(i.from(new l.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(i.from(new l.default(e).toArray("le",64)))}writeBuffer(e){this.buf=i.concat([i.from(this.buf.subarray(0,this.length)),e,i.alloc(1024)]),this.length+=e.length}writeString(e){this.maybeResize();let t=i.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(i.from(e))}writeArray(e,t){for(let r of(this.maybeResize(),this.writeU32(e.length),e))this.maybeResize(),t(r)}toArray(){return this.buf.subarray(0,this.length)}}function g(e,t,r){let i=r.value;r.value=function(...e){try{return i.apply(this,e)}catch(e){if(e instanceof RangeError&&["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(e.code)>=0)throw new f("Reached the end of buffer when deserializing");throw e}}}t.BinaryWriter=p;class m{constructor(e){this.buf=e,this.offset=0}readU8(){let e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){let e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){let e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){let e=this.readBuffer(8);return new l.default(e,"le")}readU128(){let e=this.readBuffer(16);return new l.default(e,"le")}readU256(){let e=this.readBuffer(32);return new l.default(e,"le")}readU512(){let e=this.readBuffer(64);return new l.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new f(`Expected buffer length ${e} isn't within bounds`);let t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){let e=this.readU32(),t=this.readBuffer(e);try{return d.decode(t)}catch(e){throw new f(`Error decoding UTF-8 string: ${e}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){let t=this.readU32(),r=[];for(let i=0;i<t;++i)r.push(e());return r}}function y(e){return e.charAt(0).toUpperCase()+e.slice(1)}function b(e,t,r,i,n){try{if("string"==typeof i)n[`write${y(i)}`](r);else if(i instanceof Array)if("number"==typeof i[0]){if(r.length!==i[0])throw new f(`Expecting byte array of length ${i[0]}, but got ${r.length} bytes`);n.writeFixedArray(r)}else if(2===i.length&&"number"==typeof i[1]){if(r.length!==i[1])throw new f(`Expecting byte array of length ${i[1]}, but got ${r.length} bytes`);for(let t=0;t<i[1];t++)b(e,null,r[t],i[0],n)}else n.writeArray(r,r=>{b(e,t,r,i[0],n)});else if(void 0!==i.kind)switch(i.kind){case"option":null==r?n.writeU8(0):(n.writeU8(1),b(e,t,r,i.type,n));break;case"map":n.writeU32(r.size),r.forEach((r,s)=>{b(e,t,s,i.key,n),b(e,t,r,i.value,n)});break;default:throw new f(`FieldType ${i} unrecognized`)}else w(e,r,n)}catch(e){throw e instanceof f&&e.addToFieldPath(t),e}}function w(e,t,r){if("function"==typeof t.borshSerialize)return void t.borshSerialize(r);let i=e.get(t.constructor);if(!i)throw new f(`Class ${t.constructor.name} is missing in schema`);if("struct"===i.kind)i.fields.map(([i,n])=>{b(e,i,t[i],n,r)});else if("enum"===i.kind){let n=t[i.field];for(let s=0;s<i.values.length;++s){let[o,a]=i.values[s];if(o===n){r.writeU8(s),b(e,o,t[o],a,r);break}}}else throw new f(`Unexpected schema kind: ${i.kind} for ${t.constructor.name}`)}
1function v(e,t,r,i){try{if("string"==typeof r)return i[`read${y(r)}`]();if(r instanceof Array)if("number"==typeof r[0])return i.readFixedArray(r[0]);else{if("number"!=typeof r[1])return i.readArray(()=>v(e,t,r[0],i));let n=[];for(let t=0;t<r[1];t++)n.push(v(e,null,r[0],i));return n}if("option"===r.kind){if(i.readU8())return v(e,t,r.type,i);return}if("map"===r.kind){let n=new Map,s=i.readU32();for(let o=0;o<s;o++){let s=v(e,t,r.key,i),o=v(e,t,r.value,i);n.set(s,o)}return n}return x(e,r,i)}catch(e){throw e instanceof f&&e.addToFieldPath(t),e}}function x(e,t,r){if("function"==typeof t.borshDeserialize)return t.borshDeserialize(r);let i=e.get(t);if(!i)throw new f(`Class ${t.name} is missing in schema`);if("struct"===i.kind){let i={};for(let[n,s]of e.get(t).fields)i[n]=v(e,n,s,r);return new t(i)}if("enum"===i.kind){let n=r.readU8();if(n>=i.values.length)throw new f(`Enum index: ${n} is out of range`);let[s,o]=i.values[n],a=v(e,s,o,r);return new t({[s]:a})}throw new f(`Unexpected schema kind: ${i.kind} for ${t.constructor.name}`)}o([g],m.prototype,"readU8",null),o([g],m.prototype,"readU16",null),o([g],m.prototype,"readU32",null),o([g],m.prototype,"readU64",null),o([g],m.prototype,"readU128",null),o([g],m.prototype,"readU256",null),o([g],m.prototype,"readU512",null),o([g],m.prototype,"readString",null),o([g],m.prototype,"readFixedArray",null),o([g],m.prototype,"readArray",null),t.BinaryReader=m,t.serialize=function(e,t,r=p){let i=new r;return w(e,t,i),i.toArray()},t.deserialize=function(e,t,r,i=m){let n=new i(r),s=x(e,t,n);if(n.offset<r.length)throw new f(`Unexpected ${r.length-n.offset} bytes after deserialized data`);return s},t.deserializeUnchecked=function(e,t,r,i=m){return x(e,t,new i(r))}},5257:(e,t,r)=>{"use strict";r.d(t,{DS:()=>E,OG:()=>v,Ph:()=>h,SJ:()=>_,aK:()=>b,d6:()=>o,dJ:()=>w,eV:()=>a,ex:()=>g,fg:()=>x,lX:()=>u,lq:()=>d,nC:()=>m,qj:()=>p,x:()=>I,z:()=>f,zW:()=>c});var i=r(458);let n=BigInt(0),s=BigInt(1);function o(e,t=""){if("boolean"!=typeof e)throw Error((t&&`"${t}"`)+"expected boolean, got type="+typeof e);return e}function a(e,t,r=""){let n=(0,i.aY)(e),s=e?.length,o=void 0!==t;if(!n||o&&s!==t)throw Error((r&&`"${r}" `)+"expected Uint8Array"+(o?` of length ${t}`:"")+", got "+(n?`length=${s}`:`type=${typeof e}`));return e}function c(e){let t=e.toString(16);return 1&t.length?"0"+t:t}function l(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?n:BigInt("0x"+e)}function h(e){return l((0,i.My)(e))}function u(e){return(0,i.DO)(e),l((0,i.My)(Uint8Array.from(e).reverse()))}function d(e,t){return(0,i.aT)(e.toString(16).padStart(2*t,"0"))}function f(e,t){return d(e,t).reverse()}function p(e,t,r){let n;if("string"==typeof t)try{n=(0,i.aT)(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if((0,i.aY)(t))n=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let s=n.length;if("number"==typeof r&&s!==r)throw Error(e+" of length "+r+" expected, got "+s);return n}function g(e,t){if(e.length!==t.length)return!1;let r=0;for(let i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r}function m(e){return Uint8Array.from(e)}let y=e=>"bigint"==typeof e&&n<=e;function b(e,t,r,i){if(!(y(t)&&y(r)&&y(i))||!(r<=t)||!(t<i))throw Error("expected valid "+e+": "+r+" <= n < "+i+", got "+t)}function w(e){let t;for(t=0;e>n;e>>=s,t+=1);return t}let v=e=>(s<<BigInt(e))-s;function x(e,t,r){if("number"!=typeof e||e<2)throw Error("hashLen must be a number");if("number"!=typeof t||t<2)throw Error("qByteLen must be a number");if("function"!=typeof r)throw Error("hmacFn must be a function");let n=e=>new Uint8Array(e),s=e=>Uint8Array.of(e),o=n(e),a=n(e),c=0,l=()=>{o.fill(1),a.fill(0),c=0},h=(...e)=>r(a,o,...e),u=(e=n(0))=>{a=h(s(0),e),o=h(),0!==e.length&&(a=h(s(1),e),o=h())},d=()=>{if(c++>=1e3)throw Error("drbg: tried 1000 values");let e=0,r=[];for(;e<t;){let t=(o=h()).slice();r.push(t),e+=o.length}return(0,i.Id)(...r)};return(e,t)=>{let r;for(l(),u(e);!(r=t(d()));)u();return l(),r}}function E(e,t,r={}){if(!e||"object"!=typeof e)throw Error("expected valid options object");function i(t,r,i){let n=e[t];if(i&&void 0===n)return;let s=typeof n;if(s!==r||null===n)throw Error(`param "${t}
1" is invalid: expected ${r}, got ${s}`)}Object.entries(t).forEach(([e,t])=>i(e,t,!1)),Object.entries(r).forEach(([e,t])=>i(e,t,!0))}let _=()=>{throw Error("not implemented")};function I(e){let t=new WeakMap;return(r,...i)=>{let n=t.get(r);if(void 0!==n)return n;let s=e(r,...i);return t.set(r,s),s}}},5566:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=r(12590);i.__exportStar(r(2648),t),i.__exportStar(r(38053),t),i.__exportStar(r(90332),t),i.__exportStar(r(25648),t)},5596:(e,t,r)=>{"use strict";let i;r.d(t,{A:()=>O});let n=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,s=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,o=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function a(e,t){var r;return"__proto__"===e||"constructor"===e&&t&&"object"==typeof t&&"prototype"in t?void(r=e,console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)):t}function c(e,t={}){if("string"!=typeof e)return e;if('"'===e[0]&&'"'===e[e.length-1]&&-1===e.indexOf("\\"))return e.slice(1,-1);let r=e.trim();if(r.length<=9)switch(r.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return NaN;case"infinity":return 1/0;case"-infinity":return-1/0}if(!o.test(e)){if(t.strict)throw SyntaxError("[destr] Invalid JSON");return e}try{if(n.test(e)||s.test(e)){if(t.strict)throw Error("[destr] Possible prototype pollution");return JSON.parse(e,a)}return JSON.parse(e)}catch(r){if(t.strict)throw r;return e}}var l=r(81029).Buffer;function h(e,...t){try{var r;return(r=e(...t))&&"function"==typeof r.then?r:Promise.resolve(r)}catch(e){return Promise.reject(e)}}function u(e){if(function(e){let t=typeof e;return null===e||"object"!==t&&"function"!==t}(e))return String(e);if(function(e){let t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}(e)||Array.isArray(e))return JSON.stringify(e);if("function"==typeof e.toJSON)return u(e.toJSON());throw Error("[unstorage] Cannot stringify value!")}let d="base64:";function f(e){return e&&e.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function p(e){return(e=f(e))?e+":":""}function g(e,t,r){return e.watch?e.watch((e,i)=>t(e,r+i)):()=>{}}async function m(e){"function"==typeof e.dispose&&await h(e.dispose)}function y(e){return new Promise((t,r)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>r(e.error)})}function b(e,t){let r;return(i,n)=>(()=>{if(r)return r;let i=indexedDB.open(e);return i.onupgradeneeded=()=>i.result.createObjectStore(t),(r=y(i)).then(e=>{e.onclose=()=>r=void 0},()=>{}),r})().then(e=>n(e.transaction(t,i).objectStore(t)))}function w(){return i||(i=b("keyval-store","keyval")),i}function v(e,t=w()){return t("readonly",t=>y(t.get(e)))}var x=r(25042);class E{constructor(){this.indexedDb=function(e={}){let t={mounts:{"":e.driver||(()=>{let e=new Map;return{name:"memory",getInstance:()=>e,hasItem:t=>e.has(t),getItem:t=>e.get(t)??null,getItemRaw:t=>e.get(t)??null,setItem(t,r){e.set(t,r)},setItemRaw(t,r){e.set(t,r)},removeItem(t){e.delete(t)},getKeys:()=>[...e.keys()],clear(){e.clear()},dispose(){e.clear()}}})()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=e=>{for(let r of t.mountpoints)if(e.startsWith(r))return{base:r,relativeKey:e.slice(r.length),driver:t.mounts[r]};return{base:"",relativeKey:e,driver:t.mounts[""]}},i=(e,r)=>t.mountpoints.filter(t=>t.startsWith(e)||r&&e.startsWith(t)).map(r=>({relativeBase:e.length>r.length?e.slice(r.length):void 0,mountpoint:r,driver:t.mounts[r]})),n=(e,r)=>{if(t.watching)for(let i of(r=f(r),t.watchListeners))i(e,r)},s=async()=>{if(!t.watching)for(let e in t.watching=!0,t.mounts)t.unwatch[e]=await g(t.mounts[e],n,e)},o=async()=>{if(t.watching){for(let e in t.unwatch)await t.unwatch[e]();t.unwatch={},t.watching=!1}},a=(e,t,i)=>{let n=new Map,s=e=>{let t=n.get(e.base);return t||(t={driver:e.driver,base:e.base,items:[]},n.set(e.base,t)),t};for(let i of e){let e="string"==typeof i,n=f(e?i:i.key),o=e?void 0:i.value,a=e||!i.options?t:{...t,...i.options},c=r(n);s(c).items.push({key:n,value:o,relativeKey:c.relativeKey,options:a})}return Promise.all([...n.values()].map(e=>i(e))).then(e=>e.flat())},y={hasItem(e,t={}){let{relativeKey:i,driver:n}=r(e=f(e));return h(n.hasItem,i,t)},getItem(e,t={}){let{relativeKey:i,driver:n}=r(e=f(e));return h(n.getItem,i,t).then(e=>c(e))},getItems:(e,t={})=>a(e,t,e=>e.driver.getItems?h(e.driver.getItems,e.items.map(e=>({key:e.relativeKey,options:e.options})),t).then(t=>t.map(t=>({key:function(...e){return f(e.join(":"))}(e.base,t.key),value:c(t.value)}))):Promise.all(e.items.map(t=>h(e.driver.getItem,t.relativeKey,t.options).then(e=>({key:t.key,value:c(e)}))))),getItemRaw(e,t={}){let{relativeKey:i,driver:n}=r(e=f(e));return n.getItemRaw?h(n.getItemRaw,i,t):h(n.getItem,i,t).then(e=>{var t;return"string"==typeof e&&e.startsWith(d)?(t=e.slice(d.length),globalThis.Buffer?l.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))):e})},async setItem(e,t,i={}){if(void 0===t)return y.removeItem(e);let{relativeKey:s,driver:o}=r(e=f(e));
1o.setItem&&(await h(o.setItem,s,u(t),i),o.watch||n("update",e))},async setItems(e,t){await a(e,t,async e=>{if(e.driver.setItems)return h(e.driver.setItems,e.items.map(e=>({key:e.relativeKey,value:u(e.value),options:e.options})),t);e.driver.setItem&&await Promise.all(e.items.map(t=>h(e.driver.setItem,t.relativeKey,u(t.value),t.options)))})},async setItemRaw(e,t,i={}){if(void 0===t)return y.removeItem(e,i);let{relativeKey:s,driver:o}=r(e=f(e));if(o.setItemRaw)await h(o.setItemRaw,s,t,i);else{var a;if(!o.setItem)return;await h(o.setItem,s,"string"==typeof t?t:d+(a=t,globalThis.Buffer?l.from(a).toString("base64"):globalThis.btoa(String.fromCodePoint(...a))),i)}o.watch||n("update",e)},async removeItem(e,t={}){"boolean"==typeof t&&(t={removeMeta:t});let{relativeKey:i,driver:s}=r(e=f(e));s.removeItem&&(await h(s.removeItem,i,t),(t.removeMeta||t.removeMata)&&await h(s.removeItem,i+"$",t),s.watch||n("remove",e))},async getMeta(e,t={}){"boolean"==typeof t&&(t={nativeOnly:t});let{relativeKey:i,driver:n}=r(e=f(e)),s=Object.create(null);if(n.getMeta&&Object.assign(s,await h(n.getMeta,i,t)),!t.nativeOnly){let e=await h(n.getItem,i+"$",t).then(e=>c(e));e&&"object"==typeof e&&("string"==typeof e.atime&&(e.atime=new Date(e.atime)),"string"==typeof e.mtime&&(e.mtime=new Date(e.mtime)),Object.assign(s,e))}return s},setMeta(e,t,r={}){return this.setItem(e+"$",t,r)},removeMeta(e,t={}){return this.removeItem(e+"$",t)},async getKeys(e,t={}){let r=i(e=p(e),!0),n=[],s=[],o=!0;for(let e of r){for(let r of(e.driver.flags?.maxDepth||(o=!1),await h(e.driver.getKeys,e.relativeBase,t))){let t=e.mountpoint+f(r);n.some(e=>t.startsWith(e))||s.push(t)}n=[e.mountpoint,...n.filter(t=>!t.startsWith(e.mountpoint))]}let a=void 0!==t.maxDepth&&!o;return s.filter(r=>{var i;return(!a||function(e,t){if(void 0===t)return!0;let r=0,i=e.indexOf(":");for(;i>-1;)r++,i=e.indexOf(":",i+1);return r<=t}(r,t.maxDepth))&&((i=e)?r.startsWith(i)&&"$"!==r[r.length-1]:"$"!==r[r.length-1])})},async clear(e,t={}){e=p(e),await Promise.all(i(e,!1).map(async e=>e.driver.clear?h(e.driver.clear,e.relativeBase,t):e.driver.removeItem?Promise.all((await e.driver.getKeys(e.relativeBase||"",t)).map(r=>e.driver.removeItem(r,t))):void 0))},async dispose(){await Promise.all(Object.values(t.mounts).map(e=>m(e)))},watch:async e=>(await s(),t.watchListeners.push(e),async()=>{t.watchListeners=t.watchListeners.filter(t=>t!==e),0===t.watchListeners.length&&await o()}),async unwatch(){t.watchListeners=[],await o()},mount(e,r){if((e=p(e))&&t.mounts[e])throw Error(`already mounted at ${e}`);return e&&(t.mountpoints.push(e),t.mountpoints.sort((e,t)=>t.length-e.length)),t.mounts[e]=r,t.watching&&Promise.resolve(g(r,n,e)).then(r=>{t.unwatch[e]=r}).catch(console.error),y},async unmount(e,r=!0){(e=p(e))&&t.mounts[e]&&(t.watching&&e in t.unwatch&&(t.unwatch[e]?.(),delete t.unwatch[e]),r&&await m(t.mounts[e]),t.mountpoints=t.mountpoints.filter(t=>t!==e),delete t.mounts[e])},getMount(e=""){let t=r(e=f(e)+":");return{driver:t.driver,base:t.base}},getMounts:(e="",t={})=>i(e=f(e),t.parents).map(e=>({driver:e.driver,base:e.mountpoint})),keys:(e,t={})=>y.getKeys(e,t),get:(e,t={})=>y.getItem(e,t),set:(e,t,r={})=>y.setItem(e,t,r),has:(e,t={})=>y.hasItem(e,t),del:(e,t={})=>y.removeItem(e,t),remove:(e,t={})=>y.removeItem(e,t)};return y}({driver:((e={})=>{let t,r=e.base&&e.base.length>0?`${e.base}:`:"";return e.dbName&&e.storeName&&(t=b(e.dbName,e.storeName)),{name:"idb-keyval",options:e,hasItem:async e=>!(typeof await v(r+e,t)>"u"),getItem:async e=>await v(r+e,t)??null,setItem:(e,i)=>(function(e,t,r=w()){return r("readwrite",r=>(r.put(t,e),y(r.transaction)))})(r+e,i,t),removeItem:e=>(function(e,t=w()){return t("readwrite",t=>(t.delete(e),y(t.transaction)))})(r+e,t),getKeys:()=>(function(e=w()){return e("readonly",e=>{var t;if(e.getAllKeys)return y(e.getAllKeys());let r=[];return(t=e=>r.push(e.key),e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},y(e.transaction)).then(()=>r)})})(t),clear:()=>(function(e=w()){return e("readwrite",e=>(e.clear(),y(e.transaction)))})(t)}})({dbName:"WALLET_CONNECT_V2_INDEXED_DB",storeName:"keyvaluestorage"})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let t=await this.indexedDb.getItem(e);if(null!==t)return t}async setItem(e,t){await this.indexedDb.setItem(e,(0,x.h)(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var _="u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof r.g?r.g:"u">typeof self?self:{},I={exports:{}};function A(e){var t;return[e[0],(0,x.j)(null!=(t=e[1])?t:"")]}!function(){function e(){}e.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},e.prototype.setItem=function(e,t){this[e]=String(t)},e.prototype.removeItem=function(e){delete this[e]},e.prototype.clear=function(){let e=this;Object.keys(e).forEach(function(t){e[t]=void 0,delete e[t]})},e.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},e.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),"u">typeof _&&_.localStorage?I.exports=_.localStorage:"u">typeof window&&window.localStorage?I.exports=window.localStorage:I.exports=new e}();class S{constructor(){this.localStorage=I.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(A)}async getItem(e){let t=this.localStorage.getItem(e);if(null!==t)return(0,x.j)(t)}async setItem(e,t){this.localStorage.setItem(e,(0,x.h)(t))}async removeItem(e){this.localStorage.removeItem(e)}}let C=async(e,t,r)=>{let i="wc_storage_version",n=await t.getItem(i);if(n&&n>=1)return void r(t);let s=await e.getKeys();if(!s.length)return void r(t);let o=[];for(;s.length;){let r=s.shift();if(!r)continue;let i=r.toLowerCase();if(i.includes("wc@")||i.includes("walletconnect")||i.includes("wc_")||i.includes("wallet_connect")){let i=await e.getItem(r);await t.setItem(r,i),o.push(r)}}await t.setItem(i,1),r(t),N(e,o)},N=async(e,t)=>{t.length&&t.forEach(async t=>{await e.removeItem(t)})};class O{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};let e=new S;this.storage=e;try{let t=new E;C(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}}},6578:(e,t,r)=>{"use strict";r.d(t,{z:()=>s});var i=r(70524);let n=(0,i.BX)({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0,initialized:!1}),s={state:n,subscribe:e=>(0,i.B1)(n,()=>e(n)),set(e){Object.assign(n,{...n,...e})}}},8444:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=function(e){if(e.length>=255)throw TypeError("Alphabet too long");let t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let r=0;r<e.length;r++){let i=e.charAt(r),n=i.charCodeAt(0);if(255!==t[n])throw TypeError(i+" is ambiguous");t[n]=r}let r=e.length,i=e.charAt(0),n=Math.log(r)/Math.log(256),s=Math.log(256)/Math.log(r);function o(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;let s=0,o=0,a=0;for(;e[s]===i;)o++,s++;let c=(e.length-s)*n+1>>>0,l=new Uint8Array(c);for(;s<e.length;){let i=e.charCodeAt(s);if(i>255)return;let n=t[i];if(255===n)return;let o=0;for(let e=c-1;(0!==n||o<a)&&-1!==e;e--,o++)n+=r*l[e]>>>0,l[e]=n%256>>>0,n=n/256>>>0;if(0!==n)throw Error("Non-zero carry");a=o,s++}let h=c-a;for(;h!==c&&0===l[h];)h++;let u=new Uint8Array(o+(c-h)),d=o;for(;h!==c;)u[d++]=l[h++];return u}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";let n=0,o=0,a=0,c=t.length;for(;
1a!==c&&0===t[a];)a++,n++;let l=(c-a)*s+1>>>0,h=new Uint8Array(l);for(;a!==c;){let e=t[a],i=0;for(let t=l-1;(0!==e||i<o)&&-1!==t;t--,i++)e+=256*h[t]>>>0,h[t]=e%r>>>0,e=e/r>>>0;if(0!==e)throw Error("Non-zero carry");o=i,a++}let u=l-o;for(;u!==l&&0===h[u];)u++;let d=i.repeat(n);for(;u<l;++u)d+=e.charAt(h[u]);return d},decodeUnsafe:o,decode:function(e){let t=o(e);if(t)return t;throw Error("Non-base"+r+" character")}}}("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},8567:(e,t,r)=>{"use strict";r.d(t,{o:()=>i});let i={METMASK_CONNECTOR_NAME:"MetaMask",TRUST_CONNECTOR_NAME:"Trust Wallet",SOLFLARE_CONNECTOR_NAME:"Solflare",PHANTOM_CONNECTOR_NAME:"Phantom",COIN98_CONNECTOR_NAME:"Coin98",MAGIC_EDEN_CONNECTOR_NAME:"Magic Eden",BACKPACK_CONNECTOR_NAME:"Backpack",BITGET_CONNECTOR_NAME:"Bitget Wallet",FRONTIER_CONNECTOR_NAME:"Frontier",XVERSE_CONNECTOR_NAME:"Xverse Wallet",LEATHER_CONNECTOR_NAME:"Leather",EIP155:"eip155",ADD_CHAIN_METHOD:"wallet_addEthereumChain",EIP6963_ANNOUNCE_EVENT:"eip6963:announceProvider",EIP6963_REQUEST_EVENT:"eip6963:requestProvider",CONNECTOR_RDNS_MAP:{coinbaseWallet:"com.coinbase.wallet",coinbaseWalletSDK:"com.coinbase.wallet"},CONNECTOR_TYPE_EXTERNAL:"EXTERNAL",CONNECTOR_TYPE_WALLET_CONNECT:"WALLET_CONNECT",CONNECTOR_TYPE_INJECTED:"INJECTED",CONNECTOR_TYPE_ANNOUNCED:"ANNOUNCED",CONNECTOR_TYPE_AUTH:"AUTH",CONNECTOR_TYPE_MULTI_CHAIN:"MULTI_CHAIN",CONNECTOR_TYPE_W3M_AUTH:"ID_AUTH"}},8821:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});let i={getSpacingStyles:(e,t)=>Array.isArray(e)?e[t]?`var(--wui-spacing-${e[t]})`:void 0:"string"==typeof e?`var(--wui-spacing-${e})`:void 0,getFormattedDate:e=>new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(e),getHostName(e){try{return new URL(e).hostname}catch(e){return""}},getTruncateString:({string:e,charsStart:t,charsEnd:r,truncate:i})=>e.length<=t+r?e:"end"===i?`${e.substring(0,t)}...`:"start"===i?`...${e.substring(e.length-r)}`:`${e.substring(0,Math.floor(t))}...${e.substring(e.length-Math.floor(r))}`,generateAvatarColors(e){let t=e.toLowerCase().replace(/^0x/iu,"").replace(/[^a-f0-9]/gu,"").substring(0,6).padEnd(6,"0"),r=this.hexToRgb(t),i=getComputedStyle(document.documentElement).getPropertyValue("--w3m-border-radius-master"),n=100-3*Number(i?.replace("px","")),s=`${n}% ${n}% at 65% 40%`,o=[];for(let e=0;e<5;e+=1){let t=this.tintColor(r,.15*e);o.push(`rgb(${t[0]}, ${t[1]}, ${t[2]})`)}return` 2 --local-color-1: ${o[0]}; 3 --local-color-2: ${o[1]}; 4 --local-color-3: ${o[2]}; 5 --local-color-4: ${o[3]}; 6 --local-color-5: ${o[4]}; 7 --local-radial-circle: ${s} 8 `},hexToRgb(e){let t=parseInt(e,16);return[t>>16&255,t>>8&255,255&t]},tintColor(e,t){let[r,i,n]=e;return[Math.round(r+(255-r)*t),Math.round(i+(255-i)*t),Math.round(n+(255-n)*t)]},isNumber:e=>/^[0-9]+$/u.test(e),getColorTheme:e=>e?e:"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)")?.matches?"dark":"light":"dark",splitBalance(e){let t=e.split(".");return 2===t.length?[t[0],t[1]]:["0","00"]},roundNumber:(e,t,r)=>e.toString().length>=t?Number(e).toFixed(r):e,formatNumberToLocalString:(e,t=2)=>void 0===e?"0.00":"number"==typeof e?e.toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t}):parseFloat(e).toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t})}},9748:(e,t,r)=>{"use strict";e.exports=function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([0x80000000],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971}(r(16611),r(99229))},9829:(e,t,r)=>{"use strict";let i,n;r.d(t,{Ay:()=>e_});var s,o={};r.r(o),r.d(o,{Decoder:()=>ed,Encoder:()=>eu,PacketType:()=>s,isPacketValid:()=>em,protocol:()=>eh});let a=Object.create(null);a.open="0",a.close="1",a.ping="2",a.pong="3",a.message="4",a.upgrade="5",a.noop="6";let c=Object.create(null);Object.keys(a).forEach(e=>{c[a[e]]=e});let l={type:"error",data:"parser error"},h="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),u="function"==typeof ArrayBuffer,d=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,f=({type:e,data:t},r,i)=>{if(h&&t instanceof Blob)if(r)return i(t);else return p(t,i);if(u&&(t instanceof ArrayBuffer||d(t)))if(r)return i(t);else return p(new Blob([t]),i);return i(a[e]+(t||""))},p=(e,t)=>{let r=new FileReader;return r.onload=function(){t("b"+(r.result.split(",")[1]||""))}
8,r.readAsDataURL(e)};function g(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<m.length;e++)y[m.charCodeAt(e)]=e;let b="function"==typeof ArrayBuffer,w=(e,t)=>{if("string"!=typeof e)return{type:"message",data:x(e,t)};let r=e.charAt(0);return"b"===r?{type:"message",data:v(e.substring(1),t)}:c[r]?e.length>1?{type:c[r],data:e.substring(1)}:{type:c[r]}:l},v=(e,t)=>b?x((e=>{let t=.75*e.length,r=e.length,i,n=0,s,o,a,c;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);let l=new ArrayBuffer(t),h=new Uint8Array(l);for(i=0;i<r;i+=4)s=y[e.charCodeAt(i)],o=y[e.charCodeAt(i+1)],a=y[e.charCodeAt(i+2)],c=y[e.charCodeAt(i+3)],h[n++]=s<<2|o>>4,h[n++]=(15&o)<<4|a>>2,h[n++]=(3&a)<<6|63&c;return l})(e),t):{base64:!0,data:e},x=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer;function E(e){return e.reduce((e,t)=>e+t.length,0)}function _(e,t){if(e[0].length===t)return e.shift();let r=new Uint8Array(t),i=0;for(let n=0;n<t;n++)r[n]=e[0][i++],i===e[0].length&&(e.shift(),i=0);return e.length&&i<e[0].length&&(e[0]=e[0].slice(i)),r}function I(e){if(e){var t=e;for(var r in I.prototype)t[r]=I.prototype[r];return t}}I.prototype.on=I.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},I.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},I.prototype.off=I.prototype.removeListener=I.prototype.removeAllListeners=I.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var n=0;n<i.length;n++)if((r=i[n])===t||r.fn===t){i.splice(n,1);break}return 0===i.length&&delete this._callbacks["$"+e],this},I.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),r=this._callbacks["$"+e],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(r){r=r.slice(0);for(var i=0,n=r.length;i<n;++i)r[i].apply(this,t)}return this},I.prototype.emitReserved=I.prototype.emit,I.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},I.prototype.hasListeners=function(e){return!!this.listeners(e).length};let A="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),S="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function C(e,...t){return t.reduce((t,r)=>(e.hasOwnProperty(r)&&(t[r]=e[r]),t),{})}let N=S.setTimeout,O=S.clearTimeout;function P(e,t){t.useNativeTimers?(e.setTimeoutFn=N.bind(S),e.clearTimeoutFn=O.bind(S)):(e.setTimeoutFn=S.setTimeout.bind(S),e.clearTimeoutFn=S.clearTimeout.bind(S))}function T(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class M extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}}class R extends I{constructor(e){super(),this.writable=!1,P(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,r){return super.emitReserved("error",new M(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return("opening"===this.readyState||"open"===this.readyState)&&(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=w(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return -1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&443!==Number(this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){let t=function(e){let t="";for(let r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t}(e);return t.length?"?"+t:""}}class k extends R{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}
8doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)};((e,t)=>{let r=e.split("\x1e"),i=[];for(let e=0;e<r.length;e++){let n=w(r[e],t);if(i.push(n),"error"===n.type)break}return i})(e,this.socket.binaryType).forEach(t),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{let r=e.length,i=Array(r),n=0;e.forEach((e,s)=>{f(e,!1,e=>{i[s]=e,++n===r&&t(i.join("\x1e"))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=T()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let D=!1;try{D="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}let L=D;function U(){}class B extends k{constructor(e){if(super(e),"undefined"!=typeof location){let t="https:"===location.protocol,r=location.port;r||(r=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,t){let r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}class j extends I{constructor(e,t,r){super(),this.createRequest=e,P(this,r),this._opts=r,this._method=r.method||"GET",this._uri=t,this._data=void 0!==r.data?r.data:null,this._create()}_create(){var e;let t=C(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(t);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders)for(let e in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}catch(e){}if("POST"===this._method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{r.setRequestHeader("Accept","*/*")}catch(e){}null==(e=this._opts.cookieJar)||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;3===r.readyState&&(null==(e=this._opts.cookieJar)||e.parseCookies(r.getResponseHeader("set-cookie"))),4===r.readyState&&(200===r.status||1223===r.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof r.status?r.status:0)},0))},r.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}"undefined"!=typeof document&&(this._index=j.requestsCount++,j.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=U,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete j.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}function $(){for(let e in j.requests)j.requests.hasOwnProperty(e)&&j.requests[e].abort()}j.requestsCount=0,j.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",$):"function"==typeof addEventListener&&addEventListener("onpagehide"in S?"pagehide":"unload",$,!1));let z=function(){let e=H({xdomain:!1});return e&&null!==e.responseType}();class q extends B{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=z&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new j(H,this.uri(),e)}}function H(e){let t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||L))return new XMLHttpRequest}catch(e){}if(!t)try{return new S[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(e){}}let F="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class W extends R{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,r=F?{}:C(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,r)}catch(e){return this.emitReserved("error",e)}
8this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],i=t===e.length-1;f(r,this.supportsBinary,e=>{try{this.doWrite(r,e)}catch(e){}i&&A(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=T()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}let V=S.WebSocket||S.MozWebSocket;class K extends W{createSocket(e,t,r){return F?new V(e,t,r):t?new V(e,t):new V(e)}doWrite(e,t){this.ws.send(t)}}class G extends R{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=function(e,t){n||(n=new TextDecoder);let r=[],i=0,s=-1,o=!1;return new TransformStream({transform(a,c){for(r.push(a);;){if(0===i){if(1>E(r))break;let e=_(r,1);o=(128&e[0])==128,i=(s=127&e[0])<126?3:126===s?1:2}else if(1===i){if(2>E(r))break;let e=_(r,2);s=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),i=3}else if(2===i){if(8>E(r))break;let e=_(r,8),t=new DataView(e.buffer,e.byteOffset,e.length),n=t.getUint32(0);if(n>2097151){c.enqueue(l);break}s=0x100000000*n+t.getUint32(4),i=3}else{if(E(r)<s)break;let e=_(r,s);c.enqueue(w(o?e:n.decode(e),t)),i=0}if(0===s||s>e){c.enqueue(l);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),s=new TransformStream({transform(e,t){var r;r=r=>{let i,n=r.length;if(n<126)new DataView((i=new Uint8Array(1)).buffer).setUint8(0,n);else if(n<65536){let e=new DataView((i=new Uint8Array(3)).buffer);e.setUint8(0,126),e.setUint16(1,n)}else{let e=new DataView((i=new Uint8Array(9)).buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(n))}e.data&&"string"!=typeof e.data&&(i[0]|=128),t.enqueue(i),t.enqueue(r)},h&&e.data instanceof Blob?e.data.arrayBuffer().then(g).then(r):u&&(e.data instanceof ArrayBuffer||d(e.data))?r(g(e.data)):f(e,!1,e=>{i||(i=new TextEncoder),r(i.encode(e))})}});s.readable.pipeTo(e.writable),this._writer=s.writable.getWriter();let o=()=>{r.read().then(({done:e,value:t})=>{e||(this.onPacket(t),o())}).catch(e=>{})};o();let a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],i=t===e.length-1;this._writer.write(r).then(()=>{i&&A(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null==(e=this._transport)||e.close()}}let Y={websocket:K,webtransport:G,polling:q},J=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,X=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Q(e){if(e.length>8e3)throw"URI too long";let t=e,r=e.indexOf("["),i=e.indexOf("]");-1!=r&&-1!=i&&(e=e.substring(0,r)+e.substring(r,i).replace(/:/g,";")+e.substring(i,e.length));let n=J.exec(e||""),s={},o=14;for(;o--;)s[X[o]]=n[o]||"";return -1!=r&&-1!=i&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=function(e,t){let r=t.replace(/\/{2,9}/g,"/").split("/");return("/"==t.slice(0,1)||0===t.length)&&r.splice(0,1),"/"==t.slice(-1)&&r.splice(r.length-1,1),r}(0,s.path),s.queryKey=function(e,t){let r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,i){t&&(r[t]=i)}),r}(0,s.query),s}let Z="function"==typeof addEventListener&&"function"==typeof removeEventListener,ee=[];Z&&addEventListener("offline",()=>
vendor: 1,395 bytes, line 8
8{ee.forEach(e=>e())},!1);class et extends I{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){let r=Q(e);t.hostname=r.host,t.secure="https"===r.protocol||"wss"===r.protocol,t.port=r.port,r.query&&(t.query=r.query)}else t.host&&(t.hostname=Q(t.host).host);P(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{let t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},r=e.split("&");for(let e=0,i=r.length;e<i;e++){let i=r[e].split("=");
8t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}(this.opts.query)),Z&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},ee.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);let e=this.opts.rememberUpgrade&&et.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";let t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",et.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let t=Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let r=this.writeBuffer[t].data;if(r&&(e+="string"==typeof r?function(e){let t=0,r=0;for(let i=0,n=e.length;i<n;i++)(t=e.charCodeAt(i))<128?r+=1:t<2048?r+=2:t<55296||t>=57344?r+=3:(i++,r+=4);return r}(r):Math.ceil(1.33*(r.byteLength||r.size))),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,A(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,r){return this._sendPacket("message",e,t,r),this}send(e,t,r){return this._sendPacket("message",e,t,r),this}_sendPacket(e,t,r,i){if("function"==typeof t&&(i=t,t=void 0),"function"==typeof r&&(i=r,r=null),"closing"===this.readyState||"closed"===this.readyState)return;(r=r||{}).compress=!1!==r.compress;let n={type:e,data:t,options:r};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),i&&this.once("flush",i),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return("opening"===this.readyState||"open"===this.readyState)&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(et.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Z&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=ee.indexOf(this._offlineEventListener);-1!==e&&ee.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}et.protocol=4;class er extends et{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),r=!1;et.priorWebsocketSuccess=!1;let i=()=>{r||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!r)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;et.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{r||"closed"!==this.readyState&&(l(),this.setTransport(t),t.send([{type:"upgrade"}
8]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let e=Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function n(){r||(r=!0,l(),t.close(),t=null)}let s=e=>{let r=Error("probe error: "+e);r.transport=t.name,n(),this.emitReserved("upgradeError",r)};function o(){s("transport closed")}function a(){s("socket closed")}function c(e){t&&e.name!==t.name&&n()}let l=()=>{t.removeListener("open",i),t.removeListener("error",s),t.removeListener("close",o),this.off("close",a),this.off("upgrading",c)};t.once("open",i),t.once("error",s),t.once("close",o),this.once("close",a),this.once("upgrading",c),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}}class ei extends er{constructor(e,t={}){let r="object"==typeof e?e:t;(!r.transports||r.transports&&"string"==typeof r.transports[0])&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(e=>Y[e]).filter(e=>!!e)),super(e,r)}}ei.protocol;let en="function"==typeof ArrayBuffer,es=Object.prototype.toString,eo="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===es.call(Blob),ea="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===es.call(File);function ec(e){return en&&(e instanceof ArrayBuffer||("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer))||eo&&e instanceof Blob||ea&&e instanceof File}let el=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],eh=5;!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(s||(s={}));class eu{constructor(e){this.replacer=e}encode(e){return(e.type===s.EVENT||e.type===s.ACK)&&function e(t,r){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(let r=0,i=t.length;r<i;r++)if(e(t[r]))return!0;return!1}if(ec(t))return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1==arguments.length)return e(t.toJSON(),!0);for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&e(t[r]))return!0;return!1}(e)?this.encodeAsBinary({type:e.type===s.EVENT?s.BINARY_EVENT:s.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===s.BINARY_EVENT||e.type===s.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=function(e){let t=[],r=e.data;return e.data=function e(t,r){if(!t)return t;if(ec(t)){let e={_placeholder:!0,num:r.length};return r.push(t),e}if(Array.isArray(t)){let i=Array(t.length);for(let n=0;n<t.length;n++)i[n]=e(t[n],r);return i}if("object"==typeof t&&!(t instanceof Date)){let i={};for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=e(t[n],r));return i}return t}(r,t),e.attachments=t.length,{packet:e,buffers:t}}(e),r=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(r),i}}class ed extends I{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},"function"==typeof e?{reviver:e}:e)}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");let r=(t=this.decodeString(e)).type===s.BINARY_EVENT;r||t.type===s.BINARY_ACK?(t.type=r?s.EVENT:s.ACK,this.reconstructor=new ef(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(ec(e)||e.base64)if(this.reconstructor)(t=this.reconstructor.takeBinaryData(e))&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw Error("got binary data when not reconstructing a packet");else throw Error("Unknown type: "+e)}decodeString(e){let t=0,r={type:Number(e.charAt(0))};if(void 0===s[r.type])throw Error("unknown packet type "+r.type);if(r.type===s.BINARY_EVENT||r.type===s.BINARY_ACK){let i=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);let n=e.substring(i,t);if(n!=Number(n)||"-"!==e.charAt(t))throw Error("Illegal attachments");let s=Number(n);if(!ep(s)||s<0)throw Error("Illegal attachments");if(s>this.opts.maxAttachments)throw Error("too many attachments");r.attachments=s}if("/"===e.charAt(t+1)){let i=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);r.nsp=e.substring(i,t)}else r.nsp="/";let i=e.charAt(t+1);if(""!==i&&Number(i)==i){let i=t+1;for(;++t;){let r=e.charAt(t);if(null==r||Number(r)!=r){--t;break}if(t===e.length)break}r.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){let i=this.tryParse(e.substr(t));if(ed.isPayloadValid(r.type,i))r.data=i;else throw Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case s.CONNECT:return eg(t);case s.DISCONNECT:return void 0===t;case s.CONNECT_ERROR:return"string"==typeof t||eg(t);case s.EVENT:case s.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===el.indexOf(t[0]));case s.ACK:case s.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class ef{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t,r;let e=(t=this.reconPack,r=this.buffers,t.data=function e(t,r){if(!t)return t;if(t&&!0===t._placeholder){if("number"==typeof t.num&&t.num>=0&&t.num<r.length)return r[t.num];throw Error("illegal attachments")}if(Array.isArray(t))for(let i=0;i<t.length;i++)t[i]=e(t[i],r);else if("object"==typeof t)for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(t[i]=e(t[i],r));return t}(t.data,r),delete t.attachments,t);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}let ep=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function eg(e){return"[object Object]"===Object.prototype.toString.call(e)}function em(e){var t;return"string"==typeof e.nsp&&(void 0===(t=e.id)||ep(t))&&function(e,t){switch(e){case s.CONNECT:return void 0===t||eg(t);case s.DISCONNECT:return void 0===t;case s.EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===el.indexOf(t[0]));case s.ACK:return Array.isArray(t);case s.CONNECT_ERROR:return"string"==typeof t||eg(t);default:return!1}}(e.type,e.data)}function ey(e,t,r){return e.on(t,r),function(){e.off(t,r)}}let eb=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ew extends I{constructor(e,t,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[ey(e,"open",this.onopen.bind(this)),ey(e,"packet",this.onpacket.b
8ind(this)),ey(e,"error",this.onerror.bind(this)),ey(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var r,i,n;if(eb.hasOwnProperty(e))throw Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let o={type:s.EVENT,data:t};if(o.options={},o.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){let e=this.ids++,r=t.pop();this._registerAckCallback(e,r),o.id=e}let a=null==(i=null==(r=this.io.engine)?void 0:r.transport)?void 0:i.writable,c=this.connected&&!(null==(n=this.io.engine)?void 0:n._hasPingExpired());return this.flags.volatile&&!a||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var r;let i=null!=(r=this.flags.timeout)?r:this._opts.ackTimeout;if(void 0===i){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error("operation has timed out"))},i),s=(...e)=>{this.io.clearTimeoutFn(n),t.apply(this,e)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise((r,i)=>{let n=(e,t)=>e?i(e):r(t);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());let r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...i)=>{if(r===this._queue[0])return null!==e?r.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...i)),r.pending=!1,this._drainQueue()}),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;let t=this._queue[0];(!t.pending||e)&&(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:s.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}
8_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){let t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case s.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case s.EVENT:case s.BINARY_EVENT:this.onevent(e);break;case s.ACK:case s.BINARY_ACK:this.onack(e);break;case s.DISCONNECT:this.ondisconnect();break;case s.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){let t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length)for(let t of this._anyListeners.slice())t.apply(this,e);super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,r=!1;return function(...i){r||(r=!0,t.packet({type:s.ACK,id:e,data:i}))}}onack(e){let t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:s.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r]){t.splice(r,1);break}}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r]){t.splice(r,1);break}}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length)for(let t of this._anyOutgoingListeners.slice())t.apply(this,e.data)}}function ev(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}ev.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=(1&Math.floor(10*t))==0?e-r:e+r}return 0|Math.min(e,this.max)},ev.prototype.reset=function(){this.attempts=0},ev.prototype.setMin=function(e){this.ms=e},ev.prototype.setMax=function(e){this.max=e},ev.prototype.setJitter=function(e){this.jitter=e};class ex extends I{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,P(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!=(r=t.randomizationFactor)?r:.5),this.backoff=new ev({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;let i=t.parser||o;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null==(t=this.backoff)||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null==(t=this.backoff)||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null==(t=this.backoff)||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new ei(this.uri,this.opts);let t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;let i=ey(t,"open",function(){r.onopen(),e&&e()}),n=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},s=ey(t,"error",n);if(!1!==this._timeout){let e=this._timeout,r=this.setTimeoutFn(()=>{i(),n(Error("timeout")),t.close()},e);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(ey(e,"ping",this.onping.bind(this)),ey(e,"data",this.ondata.bind(this)),ey(e,"error",this.onerror.bind(this)),ey(e,"close",this.onclose.bind(this)),ey(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){A(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new ew(this,e,t),this.nsps[e]=r),r}_destroy(e){for(let e of Object.keys(this.nsps))if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}
8cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var r;this.cleanup(),null==(r=this.engine)||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let r=this.setTimeoutFn(()=>{!e.skipReconnect&&(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}let eE={};function e_(e,t){let r;"object"==typeof e&&(t=e,e=void 0);let i=function(e,t="",r){let i=e;r=r||"undefined"!=typeof location&&location,null==e&&(e=r.protocol+"//"+r.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?r.protocol+e:r.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==r?r.protocol+"//"+e:"https://"+e),i=Q(e)),!i.port&&(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let n=-1!==i.host.indexOf(":")?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+n+":"+i.port+t,i.href=i.protocol+"://"+n+(r&&r.port===i.port?"":":"+i.port),i}(e,(t=t||{}).path||"/socket.io"),n=i.source,s=i.id,o=i.path,a=eE[s]&&o in eE[s].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||a?r=new ex(n,t):(eE[s]||(eE[s]=new ex(n,t)),r=eE[s]),i.query&&!t.query&&(t.query=i.queryKey),r.socket(i.path,t)}Object.assign(e_,{Manager:ex,Socket:ew,io:e_,connect:e_})},9956:(e,t,r)=>{"use strict";e.exports=function(e){var t;return t=e.lib.WordArray,e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s<r;s+=3)for(var o=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,a=0;a<4&&s+.75*a<r;a++)n.push(i.charAt(o>>>6*(3-a)&63));var c=i.charAt(64);if(c)for(;n.length%4;)n.push(c);return n.join("")},parse:function(e){var r=e.length,i=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var s=0;s<i.length;s++)n[i.charCodeAt(s)]=s}var o=i.charAt(64);if(o){var a=e.indexOf(o);-1!==a&&(r=a)}for(var c=e,l=r,h=n,u=[],d=0,f=0;f<l;f++)if(f%4){var p=h[c.charCodeAt(f-1)]<<f%4*2|h[c.charCodeAt(f)]>>>6-f%4*2;u[d>>>2]|=p<<24-d%4*8,d++}return t.create(u,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},e.enc.Base64}(r(16611))},10429:(e,t)=>{let r=new Uint8Array(512),i=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)r[t]=e,i[e]=t,256&(e<<=1)&&(e^=285);for(let e=255;e<512;e++)r[e]=r[e-255]}(),t.log=function(e){if(e<1)throw Error("log("+e+")");return i[e]},t.exp=function(e){return r[e]},t.mul=function(e,t){return 0===e||0===t?0:r[i[e]+i[t]]}},10562:(e,t,r)=>{"use strict";var i=r(19670),n=r(13798),s=r(78239),o=s.assert,a=s.parseBytes,c=r(33869),l=r(33372);function h(e){if(o("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof h))return new h(e);e=n[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=i.sha512}e.exports=h,h.prototype.sign=function(e,t){e=a(e);var r=this.keyFromSecret(t),i=this.hashInt(r.messagePrefix(),e),n=this.g.mul(i),s=this.encodePoint(n),o=this.hashInt(s,r.pubBytes(),e).mul(r.priv()),c=i.add(o).umod(this.curve.n);return this.makeSignature({R:n,S:c,Rencoded:s})},h.prototype.verify=function(e,t,r){if(e=a(e),(t=this.makeSignature(t)).S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var i=this.keyFromPublic(r),n=this.hashInt(t.Rencoded(),i.pubBytes(),e),s=this.g.mul(t.S());return t.R().add(i.pub().mul(n)).eq(s)},h.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return s.intFromLE(e.digest()).umod(this.curve.n)},h.prototype.keyFromPublic=function(e){return c.fromPublic(this,e)},h.prototype.keyFromSecret=function(e){return c.fromSecret(this,e)},h.prototype.makeSignature=function(e){return e instanceof l?e:new l(this,e)},h.prototype.encodePoint=function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=128*!!e.getX().isOdd(),t},h.prototype.decodePoint=function(e){var t=(e=s.parseBytes(e)).length-1,r=e.slice(0,t).concat(-129&e[t]),i=(128&e[t])!=0,n=s.intFromLE(r);return this.curve.pointFromY(n,i)},h.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)},h.prototype.decodeInt=function(e){return s.intFromLE(e)},h.prototype.isPoint=function(e){return e instanceof this.pointClass}},10824:(e,t,r)=>{"use strict";var i=r(87822);r.o(i,"IJsonRpcProvider")&&r.d(t,{IJsonRpcProvider:function(){return i.IJsonRpcProvider}}),r.o(i,"formatJsonRpcError")&&r.d(t,{formatJsonRpcError:function(){return i.formatJsonRpcError}}),r.o(i,"formatJsonRpcRequest")&&r.d(t,{formatJsonRpcRequest:function(){return i.formatJsonRpcRequest}}),r.o(i,"formatJsonRpcResult")&&r.d(t,{formatJsonRpcResult:function(){return i.formatJsonRpcResult}}),r.o(i,"getBigIntRpcId")&&r.d(t,{getBigIntRpcId:function(){return i.getBigIntRpcId}}),r.o(i,"isHttpUrl")&&r.d(t,{isHttpUrl:function(){return i.isHttpUrl}}),r.o(i,"isJsonRpcError")&&r.d(t,{isJsonRpcError:function(){return i.isJsonRpcError}}),r.o(i,"isJsonRpcRequest")&&r.d(t,{isJsonRpcRequest:function(){return i.isJsonRpcRequest}}),r.o(i,"isJsonRpcResponse")&&r.d(t,{isJsonRpcResponse:function(){return i.isJsonRpcResponse}}),r.o(i,"isJsonRpcResult")&&r.d(t,{isJsonRpcResult:function(){return i.isJsonRpcResult}}),r.o(i,"isLocalhostUrl")&&r.d(t,{isLocalhostUrl:function(){return i.isLocalhostUrl}}),r.o(i,"isReactNative")&&r.d(t,{isReactNative:function(){return i.isReactNative}}),r.o(i,"isWsUrl")&&r.d(t,{isWsUrl:function(){return i.isWsUrl}}),r.o(i,"payloadId")&&r.d(t,{payloadId:function(){return i.payloadId}})},11419:(e,t,r)=>{"use strict";r.d(t,{A:()=>c});var i=r(16459),n=r(25042),s=r(50155);let o=e=>e.split("?")[0],a="u">typeof WebSocket?WebSocket:"u">typeof r.g&&"u">typeof r.g.WebSocket?r.g.WebSocket:"u">typeof window&&"u">typeof window.WebSocket?window.WebSocket:"u">typeof self&&"u">typeof self.WebSocket?self.WebSocket:r(55762);class c{constructor(e){if(this.url=e,this.events=new i.EventEmitter,this.registering=!1,!(0,s.isWsUrl)(e))throw Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return"u">typeof this.socket}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>
8{if(typeof this.socket>"u")return void t(Error("Connection already closed"));this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send((0,n.h)(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!(0,s.isWsUrl)(e))throw Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise((e,t)=>{this.events.once("register_error",e=>{this.resetMaxListeners(),t(e)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return t(Error("WebSocket connection is missing or invalid"));e(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{let n=(0,s.isReactNative)()?void 0:{rejectUnauthorized:!(0,s.isLocalhostUrl)(e)},o=new a(e,[],n);"u">typeof WebSocket||"u">typeof r.g&&"u">typeof r.g.WebSocket||"u">typeof window&&"u">typeof window.WebSocket||"u">typeof self&&"u">typeof self.WebSocket?o.onerror=e=>{i(this.emitError(e.error))}:o.on("error",e=>{i(this.emitError(e))}),o.onopen=()=>{this.onOpen(o),t(o)}})}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let t="string"==typeof e.data?(0,n.j)(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let r=this.parseError(t),i=r.message||r.toString(),n=(0,s.formatJsonRpcError)(e,i);this.events.emit("payload",n)}parseError(e,t=this.url){return(0,s.parseConnectionError)(e,o(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}emitError(e){let t=this.parseError(Error(e?.message||`WebSocket connection failed for host: ${o(this.url)}`));return this.events.emit("register_error",t),t}}},11816:(e,t,r)=>{"use strict";e.exports=function(e){return!function(t){for(var r=e.lib,i=r.WordArray,n=r.Hasher,s=e.algo,o=[],a=0;a<64;a++)o[a]=0x100000000*t.abs(t.sin(a+1))|0;var c=s.MD5=n.extend({_doReset:function(){this._hash=new i.init([0x67452301,0xefcdab89,0x98badcfe,0x10325476])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=(n<<8|n>>>24)&0xff00ff|(n<<24|n>>>8)&0xff00ff00}var s=this._hash.words,a=e[t+0],c=e[t+1],f=e[t+2],p=e[t+3],g=e[t+4],m=e[t+5],y=e[t+6],b=e[t+7],w=e[t+8],v=e[t+9],x=e[t+10],E=e[t+11],_=e[t+12],I=e[t+13],A=e[t+14],S=e[t+15],C=s[0],N=s[1],O=s[2],P=s[3];C=l(C,N,O,P,a,7,o[0]),P=l(P,C,N,O,c,12,o[1]),O=l(O,P,C,N,f,17,o[2]),N=l(N,O,P,C,p,22,o[3]),C=l(C,N,O,P,g,7,o[4]),P=l(P,C,N,O,m,12,o[5]),O=l(O,P,C,N,y,17,o[6]),N=l(N,O,P,C,b,22,o[7]),C=l(C,N,O,P,w,7,o[8]),P=l(P,C,N,O,v,12,o[9]),O=l(O,P,C,N,x,17,o[10]),N=l(N,O,P,C,E,22,o[11]),C=l(C,N,O,P,_,7,o[12]),P=l(P,C,N,O,I,12,o[13]),O=l(O,P,C,N,A,17,o[14]),N=l(N,O,P,C,S,22,o[15]),C=h(C,N,O,P,c,5,o[16]),P=h(P,C,N,O,y,9,o[17]),O=h(O,P,C,N,E,14,o[18]),N=h(N,O,P,C,a,20,o[19]),C=h(C,N,O,P,m,5,o[20]),P=h(P,C,N,O,x,9,o[21]),O=h(O,P,C,N,S,14,o[22]),N=h(N,O,P,C,g,20,o[23]),C=h(C,N,O,P,v,5,o[24]),P=h(P,C,N,O,A,9,o[25]),O=h(O,P,C,N,p,14,o[26]),N=h(N,O,P,C,w,20,o[27]),C=h(C,N,O,P,I,5,o[28]),P=h(P,C,N,O,f,9,o[29]),O=h(O,P,C,N,b,14,o[30]),N=h(N,O,P,C,_,20,o[31]),C=u(C,N,O,P,m,4,o[32]),P=u(P,C,N,O,w,11,o[33]),O=u(O,P,C,N,E,16,o[34]),N=u(N,O,P,C,A,23,o[35]),C=u(C,N,O,P,c,4,o[36]),P=u(P,C,N,O,g,11,o[37]),O=u(O,P,C,N,b,16,o[38]),N=u(N,O,P,C,x,23,o[39]),C=u(C,N,O,P,I,4,o[40]),P=u(P,C,N,O,a,11,o[41]),O=u(O,P,C,N,p,16,o[42]),N=u(N,O,P,C,y,23,o[43]),C=u(C,N,O,P,v,4,o[44]),P=u(P,C,N,O,_,11,o[45]),O=u(O,P,C,N,S,16,o[46]),N=u(N,O,P,C,f,23,o[47]),C=d(C,N,O,P,a,6,o[48]),P=d(P,C,N,O,b,10,o[49]),O=d(O,P,C,N,A,15,o[50]),N=d(N,O,P,C,m,21,o[51]),C=d(C,N,O,P,_,6,o[52]),P=d(P,C,N,O,p,10,o[53]),O=d(O,P,C,N,x,15,o[54]),N=d(N,O,P,C,c,21,o[55]),C=d(C,N,O,P,w,6,o[56]),P=d(P,C,N,O,S,10,o[57]),O=d(O,P,C,N,y,15,o[58]),N=d(N,O,P,C,I,21,o[59]),C=d(C,N,O,P,g,6,o[60]),P=d(P,C,N,O,E,10,o[61]),O=d(O,P,C,N,f,15,o[62]),N=d(N,O,P,C,v,21,o[63]),s[0]=s[0]+C|0,s[1]=s[1]+N|0,s[2]=s[2]+O|0,s[3]=s[3]+P|0},_doFinalize:function(){var e=this._data,r=e.words,i=8*this._nDataBytes,n=8*e.sigBytes;r[n>>>5]|=128<<24-n%32;var s=t.floor(i/0x100000000);r[(n+64>>>9<<4)+15]=(s<<8|s>>>
824)&0xff00ff|(s<<24|s>>>8)&0xff00ff00,r[(n+64>>>9<<4)+14]=(i<<8|i>>>24)&0xff00ff|(i<<24|i>>>8)&0xff00ff00,e.sigBytes=(r.length+1)*4,this._process();for(var o=this._hash,a=o.words,c=0;c<4;c++){var l=a[c];a[c]=(l<<8|l>>>24)&0xff00ff|(l<<24|l>>>8)&0xff00ff00}return o},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,n,s,o){var a=e+(t&r|~t&i)+n+o;return(a<<s|a>>>32-s)+t}function h(e,t,r,i,n,s,o){var a=e+(t&i|r&~i)+n+o;return(a<<s|a>>>32-s)+t}function u(e,t,r,i,n,s,o){var a=e+(t^r^i)+n+o;return(a<<s|a>>>32-s)+t}function d(e,t,r,i,n,s,o){var a=e+(r^(t|~i))+n+o;return(a<<s|a>>>32-s)+t}e.MD5=n._createHelper(c),e.HmacMD5=n._createHmacHelper(c)}(Math),e.MD5}(r(16611))},11870:(e,t,r)=>{"use strict";r.r(t),r.d(t,{__assign:()=>s,__asyncDelegator:()=>v,__asyncGenerator:()=>w,__asyncValues:()=>x,__await:()=>b,__awaiter:()=>h,__classPrivateFieldGet:()=>A,__classPrivateFieldSet:()=>S,__createBinding:()=>d,__decorate:()=>a,__exportStar:()=>f,__extends:()=>n,__generator:()=>u,__importDefault:()=>I,__importStar:()=>
8_,__makeTemplateObject:()=>E,__metadata:()=>l,__param:()=>c,__read:()=>g,__rest:()=>o,__spread:()=>m,__spreadArrays:()=>y,__values:()=>p});var i=function(e,t){return(i=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function n(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return(s=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function o(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r}function a(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}function c(e,t){return function(r,i){t(r,i,e)}}function l(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function h(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((i=i.apply(e,t||[])).next())})}function u(e,t){var r,i,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){var c=[s,a];if(r)throw TypeError("Generator is already executing.");for(;o;)try{if(r=1,i&&(n=2&c[0]?i.return:c[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,c[1])).done)return n;switch(i=0,n&&(c=[2&c[0],n.value]),c[0]){case 0:case 1:n=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,i=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!n||c[1]>n[0]&&c[1]<n[3])){o.label=c[1];break}if(6===c[0]&&o.label<n[1]){o.label=n[1],n=c;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(c);break}n[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],i=0}finally{r=n=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function d(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}function f(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||(t[r]=e[r])}function p(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function y(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var i=Array(e),n=0,t=0;t<r;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i}function b(e){return this instanceof b?(this.v=e,this):new b(e)}function w(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var i,n=r.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){n[e]&&(i[e]=function(t){return new Promise(function(r,i){s.push([e,t,r,i])>1||a(e,t)})})}function a(e,t){try{var r;(r=n[e](t)).value instanceof b?Promise.resolve(r.value.v).then(c,l):h(s[0][2],r)}catch(e){h(s[0][3],e)}}function c(e){a("next",e)}function l(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function v(e){var t,r;return t={},i("next"),i("throw",function(e){throw e}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,n){t[i]=e[i]?function(t){return(r=!r)?{value:b(e[i](t)),done:"return"===i}:n?n(t):t}:n}}function x(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=p(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise(function(i,n){var s,o,a;s=i,o=n,a=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){s({value:e,done:a})},o)})}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}
8function _(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function I(e){return e&&e.__esModule?e:{default:e}}function A(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}function S(e,t,r){if(!t.has(e))throw TypeError("attempted to set private field on non-instance");return t.set(e,r),r}},12319:(e,t,r)=>{"use strict";r.d(t,{w:()=>o});var i=r(67934),n=r(28977),s=r(58653);let o={isMobile(){return!!this.isClient()&&!!(window?.matchMedia("(pointer:coarse)")?.matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent))},checkCaipNetwork:(e,t="")=>e?.caipNetworkId.toLocaleLowerCase().includes(t.toLowerCase()),isAndroid(){if(!this.isMobile())return!1;let e=window?.navigator.userAgent.toLowerCase();return o.isMobile()&&e.includes("android")},isIos(){if(!this.isMobile())return!1;let e=window?.navigator.userAgent.toLowerCase();return e.includes("iphone")||e.includes("ipad")},isSafari(){return!!this.isClient()&&(window?.navigator.userAgent.toLowerCase()).includes("safari")},isClient:()=>"undefined"!=typeof window,isPairingExpired:e=>!e||e-Date.now()<=n.oU.TEN_SEC_MS,isAllowedRetry:(e,t=n.oU.ONE_SEC_MS)=>Date.now()-e>=t,copyToClopboard(e){navigator.clipboard.writeText(e)},isIframe(){try{return window?.self!==window?.top}catch(e){return!1}},getPairingExpiry:()=>Date.now()+n.oU.FOUR_MINUTES_MS,getNetworkId:e=>e?.split(":")[1],getPlainAddress:e=>e?.split(":")[2],wait:async e=>new Promise(t=>{setTimeout(t,e)}),debounce(e,t=500){let r;return(...i)=>{r&&clearTimeout(r),r=setTimeout(function(){e(...i)},t)}},isHttpUrl:e=>e.startsWith("http://")||e.startsWith("https://"),formatNativeUrl(e,t){if(o.isHttpUrl(e))return this.formatUniversalUrl(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.isTelegram()&&this.isAndroid()&&(t=encodeURIComponent(t));let i=encodeURIComponent(t);return{redirect:`${r}wc?uri=${i}`,href:r}},formatUniversalUrl(e,t){if(!o.isHttpUrl(e))return this.formatNativeUrl(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let i=encodeURIComponent(t);return{redirect:`${r}wc?uri=${i}`,href:r}},getOpenTargetForPlatform(e){return"popupWindow"===e?e:this.isTelegram()?s.i.getTelegramSocialProvider()?"_top":"_blank":e},openHref(e,t,r){window?.open(e,this.getOpenTargetForPlatform(t),r||"noreferrer noopener")},returnOpenHref(e,t,r){return window?.open(e,this.getOpenTargetForPlatform(t),r||"noreferrer noopener")},isTelegram:()=>"undefined"!=typeof window&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto),preloadImage:async e=>Promise.race([new Promise((t,r)=>{let i=new Image;i.onload=t,i.onerror=r,i.crossOrigin="anonymous",i.src=e}),o.wait(2e3)]),formatBalance(e,t){let r="0.000";if("string"==typeof e){let t=Number(e);if(t){let e=Math.floor(1e3*t)/1e3;e&&(r=e.toString())}}return`${r}${t?` ${t}`:""}`},formatBalance2(e,t){let r;if("0"===e)r="0";else if("string"==typeof e){let t=Number(e);t&&(r=t.toString().match(/^-?\d+(?:\.\d{0,3})?/u)?.[0])}return{value:r??"0",rest:"0"===r?"000":"",symbol:t}},getApiUrl:()=>i.o.W3M_API_URL,getBlockchainApiUrl:()=>i.o.BLOCKCHAIN_API_RPC_URL,getAnalyticsUrl:()=>i.o.PULSE_API_URL,getUUID:()=>crypto?.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),parseError:e=>"string"==typeof e?e:"string"==typeof e?.issues?.[0]?.message?e.issues[0].message:e instanceof Error?e.message:"Unknown error",sortRequestedNetworks(e,t=[]){let r={};return t&&e&&(e.forEach((e,t)=>{r[e]=t}),t.sort((e,t)=>{let i=r[e.id],n=r[t.id];return void 0!==i&&void 0!==n?i-n:void 0!==i?-1:1*(void 0!==n)})),t},calculateBalance(e){let t=0;for(let r of e)t+=r.value??0;return t},formatTokenBalance(e){let[t,r]=e.toFixed(2).split(".");return{dollars:t,pennies:r}},isAddress(e,t="eip155"){switch(t){case"eip155":if(/^(?:0x)?[0-9a-f]{40}$/iu.test(e)&&(/^(?:0x)?[0-9a-f]{40}$/iu.test(e)||/^(?:0x)?[0-9A-F]{40}$/iu.test(e)))return!0;return!1;case"solana":return/[1-9A-HJ-NP-Za-km-z]{32,44}$/iu.test(e);default:return!1}},uniqueBy(e,t){let r=new Set;return e.filter(e=>{let i=e[t];return!r.has(i)&&(r.add(i),!0)})},generateSdkVersion(e,t,r){let i=0===e.length?n.oU.ADAPTER_TYPES.UNIVERSAL:e.map(e=>e.adapterType).join(",");return`${t}-${i}-${r}`},createAccount:(e,t,r,i,n)=>({namespace:e,address:t,type:r,publicKey:i,path:n}),isCaipAddress(e){if("string"!=typeof e)return!1;let t=e.split(":"),r=t[0];return 3===t.filter(Boolean).length&&r in i.o.CHAIN_NAME_MAP},isMac(){let e=window?.navigator.userAgent.toLowerCase();return e.includes("macintosh")&&!e.includes("safari")},formatTelegramSocialLoginUrl(e){let t=`--${encodeURIComponent(window?.location.href)}`,r="state=";if("auth.magic.link"===new URL(e).host){let i="provider_authorization_url=",n=e.substring(e.indexOf(i)+i.length),s=this.injectIntoUrl(decodeURIComponent(n),r,t);return e.replace(n,encodeURIComponent(s))}return this.injectIntoUrl(e,r,t)},injectIntoUrl(e,t,r){let i=e.indexOf(t);if(-1===i)throw Error(`${t} parameter not found in the URL: ${e}`);let n=e.indexOf("&",i),s=t.length,o=-1!==n?n:e.length,a=e.substring(0,i+s),c=e.substring(i+s,o);return a+(c+r)+e.substring(n)}}},12590:(e,t,r)=>{"use strict";r.r(t),r.d(t,{__assign:()=>s,__asyncDelegator:()=>v,__asyncGenerator:()=>w,__asyncValues:()=>x,__await:()=>b,__awaiter:()=>h,__classPrivateFieldGet:()=>A,__classPrivateFieldSet:()=>S,__createBinding:()=>d,__decorate:()=>a,__exportStar:()=>f,__extends:()=>n,__generator:()=>u,__importDefault:()=>I,__importStar:()=>
8_,__makeTemplateObject:()=>E,__metadata:()=>l,__param:()=>c,__read:()=>g,__rest:()=>o,__spread:()=>m,__spreadArrays:()=>y,__values:()=>p});var i=function(e,t){return(i=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function n(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return(s=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function o(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r}function a(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}function c(e,t){return function(r,i){t(r,i,e)}}function l(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function h(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((i=i.apply(e,t||[])).next())})}function u(e,t){var r,i,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){var c=[s,a];if(r)throw TypeError("Generator is already executing.");for(;o;)try{if(r=1,i&&(n=2&c[0]?i.return:c[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,c[1])).done)return n;switch(i=0,n&&(c=[2&c[0],n.value]),c[0]){case 0:case 1:n=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,i=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!n||c[1]>n[0]&&c[1]<n[3])){o.label=c[1];break}if(6===c[0]&&o.label<n[1]){o.label=n[1],n=c;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(c);break}n[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],i=0}finally{r=n=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function d(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}function f(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||(t[r]=e[r])}function p(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function y(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var i=Array(e),n=0,t=0;t<r;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i}function b(e){return this instanceof b?(this.v=e,this):new b(e)}function w(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var i,n=r.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){n[e]&&(i[e]=function(t){return new Promise(function(r,i){s.push([e,t,r,i])>1||a(e,t)})})}function a(e,t){try{var r;(r=n[e](t)).value instanceof b?Promise.resolve(r.value.v).then(c,l):h(s[0][2],r)}catch(e){h(s[0][3],e)}}function c(e){a("next",e)}function l(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function v(e){var t,r;return t={},i("next"),i("throw",function(e){throw e}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,n){t[i]=e[i]?function(t){return(r=!r)?{value:b(e[i](t)),done:"return"===i}:n?n(t):t}:n}}function x(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=p(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise(function(i,n){var s,o,a;s=i,o=n,a=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){s({value:e,done:a})},o)})}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}
8function _(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function I(e){return e&&e.__esModule?e:{default:e}}function A(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}function S(e,t,r){if(!t.has(e))throw TypeError("attempted to set private field on non-instance");return t.set(e,r),r}},13505:(e,t,r)=>{"use strict";r.d(t,{d:()=>c});var i=r(45669),n=r(51470),s=r(36452),o=r(51901),a=r(25223);class c extends i.DE{constructor(e={}){super(),this.name="Solflare",this.url="https://solflare.com",this.icon="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGlkPSJTIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MCA1MCI+PGRlZnM+PHN0eWxlPi5jbHMtMXtmaWxsOiMwMjA1MGE7c3Ryb2tlOiNmZmVmNDY7c3Ryb2tlLW1pdGVybGltaXQ6MTA7c3Ryb2tlLXdpZHRoOi41cHg7fS5jbHMtMntmaWxsOiNmZmVmNDY7fTwvc3R5bGU+PC9kZWZzPjxyZWN0IGNsYXNzPSJjbHMtMiIgeD0iMCIgd2lkdGg9IjUwIiBoZWlnaHQ9IjUwIiByeD0iMTIiIHJ5PSIxMiIvPjxwYXRoIGNsYXNzPSJjbHMtMSIgZD0iTTI0LjIzLDI2LjQybDIuNDYtMi4zOCw0LjU5LDEuNWMzLjAxLDEsNC41MSwyLjg0LDQuNTEsNS40MywwLDEuOTYtLjc1LDMuMjYtMi4yNSw0LjkzbC0uNDYuNS4xNy0xLjE3Yy42Ny00LjI2LS41OC02LjA5LTQuNzItNy40M2wtNC4zLTEuMzhoMFpNMTguMDUsMTEuODVsMTIuNTIsNC4xNy0yLjcxLDIuNTktNi41MS0yLjE3Yy0yLjI1LS43NS0zLjAxLTEuOTYtMy4zLTQuNTF2LS4wOGgwWk0xNy4zLDMzLjA2bDIuODQtMi43MSw1LjM0LDEuNzVjMi44LjkyLDMuNzYsMi4xMywzLjQ2LDUuMThsLTExLjY1LTQuMjJoMFpNMTMuNzEsMjAuOTVjMC0uNzkuNDItMS41NCwxLjEzLTIuMTcuNzUsMS4wOSwyLjA1LDIuMDUsNC4wOSwyLjcxbDQuNDIsMS40Ni0yLjQ2LDIuMzgtNC4zNC0xLjQyYy0yLS42Ny0yLjg0LTEuNjctMi44NC0yLjk2TTI2LjgyLDQyLjg3YzkuMTgtNi4wOSwxNC4xMS0xMC4yMywxNC4xMS0xNS4zMiwwLTMuMzgtMi01LjI2LTYuNDMtNi43MmwtMy4zNC0xLjEzLDkuMTQtOC43Ny0xLjg0LTEuOTYtMi43MSwyLjM4LTEyLjgxLTQuMjJjLTMuOTcsMS4yOS04Ljk3LDUuMDktOC45Nyw4Ljg5LDAsLjQyLjA0LjgzLjE3LDEuMjktMy4zLDEuODgtNC42MywzLjYzLTQuNjMsNS44LDAsMi4wNSwxLjA5LDQuMDksNC41NSw1LjIybDIuNzUuOTItOS41Miw5LjE0LDEuODQsMS45NiwyLjk2LTIuNzEsMTQuNzMsNS4yMmgwWiIvPjwvc3ZnPg==",this.supportedTransactionVersions=new Set(["legacy",0]),this._readyState="undefined"==typeof window||"undefined"==typeof document?n.Ok.Unsupported:n.Ok.Loadable,this._disconnected=()=>{let e=this._wallet;e&&(e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new s.PQ),this.emit("disconnect"))},this._accountChanged=e=>{if(!e)return;let t=this._publicKey;if(t){try{e=new a.PublicKey(e.toBytes())}catch(e){this.emit("error",new s.Kd(e?.message,e));return}t.equals(e)||(this._publicKey=e,this.emit("connect",e))}},this._connecting=!1,this._publicKey=null,this._wallet=null,this._config=e,this._readyState!==n.Ok.Unsupported&&(0,n.qG)(()=>(!!window.solflare?.isSolflare||!!window.SolflareApp)&&(this._readyState=n.Ok.Installed,this.emit("readyStateChange",this._readyState),!0))}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){return!!this._wallet?.connected}get readyState(){return this._readyState}async autoConnect(){this.readyState===n.Ok.Loadable&&(0,n.Br)()||await this.connect()}async connect(){try{let e,t,i;if(this.connected||this.connecting)return;if(this._readyState!==n.Ok.Loadable&&this._readyState!==n.Ok.Installed)throw new s.AE;if(this.readyState===n.Ok.Loadable&&(0,n.Br)()){let e=encodeURIComponent(window.location.href),t=encodeURIComponent(window.location.origin);window.location.href=`https://solflare.com/ul/v1/browse/${e}?ref=${t}`;return}try{e=(await r.e(1153).then(r.bind(r,81153))).default}catch(e){throw new s.Sz(e?.message,e)}try{t=new e({network:this._config.network})}catch(e){throw new s.Ez(e?.message,e)}if(this._connecting=!0,!t.connected)try{await t.connect()}catch(e){throw new s.Y6(e?.message,e)}if(!t.publicKey)throw new s.Y6;try{i=new a.PublicKey(t.publicKey.toBytes())}catch(e){throw new s.Kd(e?.message,e)}t.on("disconnect",this._disconnected),t.on("accountChanged",this._accountChanged),this._wallet=t,this._publicKey=i,this.emit("connect",i)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){let e=this._wallet;if(e){e.off("disconnect",this._disconnected),e.off("accountChanged",this._accountChanged),this._wallet=null,this._publicKey=null;try{await e.disconnect()}
8catch(e){this.emit("error",new s.Y8(e?.message,e))}}this.emit("disconnect")}async sendTransaction(e,t,r={}){try{let i=this._wallet;if(!i)throw new s.kW;try{let{signers:n,...s}=r;return(0,o.Y)(e)?n?.length&&e.sign(n):(e=await this.prepareTransaction(e,t,s),n?.length&&e.partialSign(...n)),s.preflightCommitment=s.preflightCommitment||t.commitment,await i.signAndSendTransaction(e,s)}catch(e){if(e instanceof s.m7)throw e;throw new s.UF(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signTransaction(e){try{let t=this._wallet;if(!t)throw new s.kW;try{return await t.signTransaction(e)||e}catch(e){throw new s.z4(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signAllTransactions(e){try{let t=this._wallet;if(!t)throw new s.kW;try{return await t.signAllTransactions(e)||e}catch(e){throw new s.z4(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signMessage(e){try{let t=this._wallet;if(!t)throw new s.kW;try{return await t.signMessage(e,"utf8")}catch(e){throw new s.K3(e?.message,e)}}catch(e){throw this.emit("error",e),e}}}},13798:(e,t,r)=>{"use strict";var i,n=r(19670),s=r(23750),o=r(78239).assert;function a(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(e,r){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){var i=new a(r);return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:i}),i}})}t.PresetCurve=a,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:n.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:n.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:n.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:n.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:n.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:n.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=r(97919)}catch(e){i=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:n.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"}
8,{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},14537:e=>{"use strict";e.exports={rE:"6.6.1"}},14744:(e,t,r)=>{"use strict";r.d(t,{$:()=>c});var i=r(70524),n=r(72880),s=r(29936);let o={eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700",polkadot:"",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00"},a=(0,i.BX)({networkImagePromises:{}}),c={async fetchWalletImage(e){if(e)return await n.N._fetchWalletImage(e),this.getWalletImageById(e)},async fetchNetworkImage(e){if(!e)return;let t=this.getNetworkImageById(e);return t||(a.networkImagePromises[e]||(a.networkImagePromises[e]=n.N._fetchNetworkImage(e)),await a.networkImagePromises[e],this.getNetworkImageById(e))},getWalletImageById(e){if(e)return s.j.state.walletImages[e]},getWalletImage:e=>e?.image_url?e?.image_url:e?.image_id?s.j.state.walletImages[e.image_id]:void 0,getNetworkImage:e=>e?.assets?.imageUrl?e?.assets?.imageUrl:e?.assets?.imageId?s.j.state.networkImages[e.assets.imageId]:void 0,getNetworkImageById(e){if(e)return s.j.state.networkImages[e]},getConnectorImage:e=>e?.imageUrl?e.imageUrl:e?.imageId?s.j.state.connectorImages[e.imageId]:void 0,getChainImage:e=>s.j.state.networkImages[o[e]]}},15168:(e,t,r)=>{e=r.nmd(e);var i,n,s="__lodash_hash_undefined__",o="[object Arguments]",a="[object Array]",c="[object Boolean]",l="[object Date]",h="[object Error]",u="[object Function]",d="[object Map]",f="[object Number]",p="[object Object]",g="[object Promise]",m="[object RegExp]",y="[object Set]",b="[object String]",w="[object WeakMap]",v="[object ArrayBuffer]",x="[object DataView]",E=/^\[object .+?Constructor\]$/,_=/^(?:0|[1-9]\d*)$/,I={};I["[object Float32Array]"]=I["[object Float64Array]"]=I["[object Int8Array]"]=I["[object Int16Array]"]=I["[object Int32Array]"]=I["[object Uint8Array]"]=I["[object Uint8ClampedArray]"]=I["[object Uint16Array]"]=I["[object Uint32Array]"]=!0,I[o]=I[a]=I[v]=I[c]=I[x]=I[l]=I[h]=I[u]=I[d]=I[f]=I[p]=I[m]=I[y]=I[b]=I[w]=!1;var A="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,S="object"==typeof self&&self&&self.Object===Object&&self,C=A||S||Function("return this")(),N=t&&!t.nodeType&&t,O=N&&e&&!e.nodeType&&e,P=O&&O.exports===N,T=P&&A.process,M=function(){try{return T&&T.binding&&T.binding("util")}catch(e){}}(),R=M&&M.isTypedArray;function k(e){var t=-1,r=Array(e.size);return e.forEach(function(e,i){r[++t]=[i,e]}),r}function D(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var L=Array.prototype,U=Function.prototype,B=Object.prototype,j=C["__core-js_shared__"],$=U.toString,z=B.hasOwnProperty,q=function(){var e=/[^.]+$/.exec(j&&j.keys&&j.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),H=B.toString,F=RegExp("^"+$.call(z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),W=P?C.Buffer:void 0,V=C.Symbol,K=C.Uint8Array,G=B.propertyIsEnumerable,Y=L.splice,J=V?V.toStringTag:void 0,X=Object.getOwnPropertySymbols,Q=W?W.isBuffer:void 0,Z=(i=Object.keys,n=Object,function(e){return i(n(e))}),ee=eI(C,"DataView"),et=eI(C,"Map"),er=eI(C,"Promise"),ei=eI(C,"Set"),en=eI(C,"WeakMap"),es=eI(Object,"create"),eo=eC(ee),ea=eC(et),ec=eC(er),el=eC(ei),eh=eC(en),eu=V?V.prototype:void 0,ed=eu?eu.valueOf:void 0;function ef(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function ep(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function eg(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function em(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new eg;++t<r;)this.add(e[t])}function ey(e){var t=this.__data__=new ep(e);this.size=t.size}function eb(e,t){for(var r=e.length;r--;)if(eN(e[r][0],t))return r;return -1}function ew(e){var t;return null==e?void 0===e?"[object Undefined]":"[object Null]":J&&J in Object(e)?function(e){var t=z.call(e,J),r=e[J];try{e[J]=void 0;var i=!0}catch(e){}var n=H.call(e);return i&&(t?e[J]=r:delete e[J]),n}(e):(t=e,H.call(t))}function ev(e){return eD(e)&&ew(e)==o}function ex(e,t,r,i,n,s){var o=1&r,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var l=s.get(e);if(l&&s.get(t))return l==t;var h=-1,u=!0,d=2&r?new em:void 0;for(s.set(e,t),s.set(t,e);++h<a;){var f=e[h],p=t[h];if(i)var g=o?i(p,f,h,t,e,s):i(f,p,h,e,t,s);if(void 0!==g){if(g)continue;u=!1;break}if(d){if(!function(e,t){for(var r=-1,i=null==e?0:e.length;++r<i;)if(t(e[r],r,e))return!0;return!1}(t,function(e,t){if(!d.has(t)&&(f===e||n(f,e,r,i,s)))return d.push(t)})){u=!1;break}}else if(!(f===p||n(f,p,r,i,s))){u=!1;break}}return s.delete(e),s.delete(t),u}function eE(e){var t;return t=eU(e),eP(e)?t:function(e,t){for(var r=-1,i=t.length,n=e.length;++r<i;)e[n+r]=t[r];return e}(t,eA(e))}function e_(e,t){var r,i,n=e.__data__;return("string"==(i=typeof(r=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==r:null===r)?n["string"==typeof t?"string":"hash"]:n.map}function eI(e,t){var r,i=null==e?void 0:e[t];return!(!ek(i)||(r=i,q&&q in r))&&(eM(i)?F:E).test(eC(i))?i:void 0}ef.prototype.clear=function(){this.__data__=es?es(null):{},this.size=0},ef.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},ef.prototype.get=function(e){var t=this.__data__;if(es){var r=t[e];return r===s?void 0:r}return z.call(t,e)?t[e]:void 0},ef.prototype.has=function(e){var t=this.__data__;return es?void 0!==t[e]:z.call(t,e)},ef.prototype.set=function(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=es&&void 0===t?s:t,this},ep.prototype.clear=function(){this.__data__=[],this.size=0},ep.prototype.delete=function(e){var t=this.__data__,r=eb(t,e);return!(r<0)&&(r==t.length-1?t.pop():Y.call(t,r,1),--this.size,!0)},ep.prototype.get=function(e){var t=this.__data__,r=eb(t,e);return r<0?void 0:t[r][1]},ep.prototype.has=function(e){return eb(this.__data__,e)>-1},ep.prototype.set=function(e,t){var r=this.__data__,i=eb(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this},eg.prototype.clear=function(){this.size=0,this.__data__={hash:new ef,map:new(et||ep),string:new ef}},eg.prototype.delete=function(e){var t=e_(this,e).delete(e);return this.size-=!!t,t},eg.prototype.get=function(e){return e_(this,e).get(e)},eg.prototype.has=function(e){return e_(this,e).has(e)},eg.prototype.set=function(e,t){var r=e_(this,e),i=r.size;return r.set(e,t),this.size+=+(r.size!=i),this},em.prototype.add=em.prototype.push=function(e){return this.__data__.set(e,s),this},em.prototype.has=function(e){return this.__data__.has(e)},ey.prototype.clear=function(){this.__data__=new ep,this.size=0},ey.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},ey.prototype.get=function(e){return this.__data__.get(e)},ey.prototype.has=function(e){return this.__data__.has(e)},ey.prototype.set=function(e,t){var r=this.__data__;if(r instanceof ep){var i=r.__data__;if(!et||i.length<199)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new eg(i)}return r.set(e,t),this.size=r.size,this};var eA=X?function(e){return null==e?[]:function(e,t){for(var r=-1,i=null==e?0:e.length,n=0,s=[];++r<i;){var o=e[r];t(o,r,e)&&(s[n++]=o)}return s}(X(e=Object(e)),function(t){return G.call(e,t)})}:function(){return[]},eS=ew;function eC(e){if(null!=e){try{return $.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function eN(e,t){return e===t||e!=e&&t!=t}(ee&&eS(new ee(new ArrayBuffer(1)))!=x||et&&eS(new et)!=d||er&&eS(er.resolve())!=g||ei&&eS(new ei)!=y||en&&eS(new en)!=w)&&(eS=function(e){var t=ew(e),r=t==p?e.constructor:void 0,i=r?eC(r):"";if(i)switch(i){case eo:return x;case ea:return d;case ec:return g;case el:return y;case eh:return w}return t});var eO=ev(function(){return arguments}())?ev:function(e){return eD(e)&&z.call(e,"callee")&&!G.call(e,"callee")},eP=Array.isArray,eT=Q||function(){return!1};function eM(e){if(!ek(e))return!1;var t=ew(e);return t==u||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function eR(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff}function ek(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eD(e){return null!=e&&"object"==typeof e}var eL=R?function(e){return R(e)}:function(e){return eD(e)&&eR(e.length)&&!!I[ew(e)]};function eU(e){return null!=e&&eR(e.length)&&!eM(e)?function(e,t){var r,i,n=eP(e),s=!n&&eO(e),o=!n&&!s&&eT(e),a=!n&&!s&&!o&&eL(e),c=n||s||o||a,l=c?function(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}(e.length,String):[],h=l.length;for(var u in e){z.call(e,u)&&!(c&&("length"==u||o&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||(r=u,(i=null==(i=h)?0x1fffffffffffff:i)&&("number"==typeof r||_.test(r))&&r>-1&&r%1==0&&r<i)))&&l.push(u)}return l}(e):function(e){if(r=(t=e)&&t.constructor,t!==("function"==typeof r&&r.prototype||B))return Z(e);var t,r,i=[];for(var n in Object(e))z.call(e,n)&&"constructor"!=n&&i.push(n);return i}(e)}e.exports=function(e,t){return function e(t,r,i,n,s){return t===r||(null!=t&&null!=r&&(eD(t)||eD(r))?function(e,t,r,i,n,s){var u=eP(e),g=eP(t),w=u?a:eS(e),E=g?a:eS(t);w=w==o?p:w,E=E==o?p:E;var _=w==p,I=E==p,A=w==E;if(A&&eT(e)){if(!eT(t))return!1;u=!0,_=!1}if(A&&!_)return s||(s=new ey),u||eL(e)?ex(e,t,r,i,n,s):function(e,t,r,i,n,s,o){switch(r){case x:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case v:if(e.byteLength!=t.byteLength||!s(new K(e),new K(t)))break;return!0;case c:case l:case f:return eN(+e,+t);case h:return e.name==t.name&&e.message==t.message;case m:case b:return e==t+"";case d:var a=k;
8case y:var u=1&i;if(a||(a=D),e.size!=t.size&&!u)break;var p=o.get(e);if(p)return p==t;i|=2,o.set(e,t);var g=ex(a(e),a(t),i,n,s,o);return o.delete(e),g;case"[object Symbol]":if(ed)return ed.call(e)==ed.call(t)}return!1}(e,t,w,r,i,n,s);if(!(1&r)){var S=_&&z.call(e,"__wrapped__"),C=I&&z.call(t,"__wrapped__");if(S||C){var N=S?e.value():e,O=C?t.value():t;return s||(s=new ey),n(N,O,r,i,s)}}return!!A&&(s||(s=new ey),function(e,t,r,i,n,s){var o=1&r,a=eE(e),c=a.length;if(c!=eE(t).length&&!o)return!1;for(var l=c;l--;){var h=a[l];if(!(o?h in t:z.call(t,h)))return!1}var u=s.get(e);if(u&&s.get(t))return u==t;var d=!0;s.set(e,t),s.set(t,e);for(var f=o;++l<c;){var p=e[h=a[l]],g=t[h];if(i)var m=o?i(g,p,h,t,e,s):i(p,g,h,e,t,s);if(!(void 0===m?p===g||n(p,g,r,i,s):m)){d=!1;break}f||(f="constructor"==h)}if(d&&!f){var y=e.constructor,b=t.constructor;y!=b&&"constructor"in e&&"constructor"in t&&!("function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b)&&(d=!1)}return s.delete(e),s.delete(t),d}(e,t,r,i,n,s))}(t,r,i,n,e,s):t!=t&&r!=r)}(e,t)}},15612:(e,t,r)=>{"use strict";var i=r(20920),n=r(40709);function s(){if(!(this instanceof s))return new s;n.call(this),this.h=[0xc1059ed8,0x367cd507,0x3070dd17,0xf70e5939,0xffc00b31,0x68581511,0x64f98fa7,0xbefa4fa4]}i.inherits(s,n),e.exports=s,s.blockSize=512,s.outSize=224,s.hmacStrength=192,s.padLength=64,s.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,7),"big"):i.split32(this.h.slice(0,7),"big")}},16459:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var n=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise(function(r,i){var n,s,o;function a(r){e.removeListener(t,c),i(r)}function c(){"function"==typeof e.removeListener&&e.removeListener("error",a),r([].slice.call(arguments))}g(e,t,c,{once:!0}),"error"!==t&&(n=e,s=a,o={once:!0},"function"==typeof n.on&&g(n,"error",s,o))})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,r,i){if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=c(e))>0&&o.length>n&&!o.warned){o.warned=!0;var n,s,o,l=Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,console&&console.warn&&console.warn(l)}return e}function h(){if(!this.fired)return(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0==arguments.length)?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=h.bind(i);return n.listener=r,i.wrapFn=n,n}function d(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):p(n,n.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=Array(t),i=0;i<t;++i)r[i]=e[i];return r}function g(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else if("function"==typeof e.addEventListener)e.addEventListener(t,function n(s){i.once&&e.removeEventListener(t,n),r(s)});else throw TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o}
8,set:function(e){if("number"!=typeof e||e<0||n(e))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),s.init=function(){(void 0===this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||n(e))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,s=this._events;if(void 0!==s)n=n&&void 0===s.error;else if(!n)return!1;if(n){if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var o,a=Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else for(var l=c.length,h=p(c,l),r=0;r<l;++r)i(h[r],this,t);return!0},s.prototype.addListener=function(e,t){return l(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return l(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,u(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,u(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,i,n,s,o;if(a(t),void 0===(i=this._events)||void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0==arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0==arguments.length){var n,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},16611:(e,t,r)=>{"use strict";e.exports=function(){var e=e||function(e,t){if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==r.g&&r.g.crypto&&(i=r.g.crypto),!i)try{i=r(50477)}catch(e){}var i,n=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),o={},a=o.lib={},c=a.Base={extend:function(e){var t=s(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},l=a.WordArray=c.extend({init:function(e,r){e=this.words=e||[],t!=r?this.sigBytes=r:this.sigBytes=4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,r=e.words,i=this.sigBytes,n=e.sigBytes;if(this.clamp(),i%4)for(var s=0;s<n;s++){var o=r[s>>>2]>>>24-s%4*8&255;t[i+s>>>2]|=o<<24-(i+s)%4*8}else for(var a=0;a<n;a+=4)t[i+a>>>2]=r[a>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=0xffffffff<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new l.init(t,e)}}),h=o.enc={},u=h.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var s=t[n>>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i+=2)r[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},d=h.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var s=t[n>>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},f=h.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,o=this.blockSize,a=s/(4*o),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,h=e.min(4*c,s);if(c){for(var u=0;u<c;u+=o)this._doProcessBlock(n,u);r=n.splice(0,c),i.sigBytes-=h}return new l.init(r,h)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});a.Hasher=p.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new g.HMAC.init(e,r).finalize(t)}}});var g=o.algo={};return o}(Math);return e}()},17891:(e,t,r)=>{"use strict";var i=r(19670),n=r(95119),s=r(3285);function o(e){if(!(this instanceof o))return new o(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;
8var t=n.toArray(e.entropy,e.entropyEnc||"hex"),r=n.toArray(e.nonce,e.nonceEnc||"hex"),i=n.toArray(e.pers,e.persEnc||"hex");s(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,i)}e.exports=o,o.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=0x1000000000000},o.prototype._hmac=function(){return new i.hmac(this.hash,this.K)},o.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},o.prototype.reseed=function(e,t,r,i){"string"!=typeof t&&(i=r,r=t,t=null),e=n.toArray(e,t),r=n.toArray(r,i),s(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},o.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");"string"!=typeof t&&(i=r,r=t,t=null),r&&(r=n.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var o=s.slice(0,e);return this._update(r),this._reseed++,n.encode(o,t)}},18085:function(e){e.exports=function(e,t,r){r.updateLocale=function(e,t){var i=r.Ls[e];if(i)return(t?Object.keys(t):[]).forEach(function(e){i[e]=t[e]}),i}}},18191:e=>{e.exports={style:{fontFamily:"'Inter', 'Inter Fallback'",fontStyle:"normal"},className:"__className_8b3a0b"}},18635:(e,t,r)=>{"use strict";r.d(t,{A:()=>h});var i=r(55480),n=r(66254),s=r(58653),o=r(12319),a=r(72880),c=r(48981),l=r(91867);let h={filterOutDuplicatesByRDNS(e){let t=i.H.state.enableEIP6963?n.a.state.connectors:[],r=s.i.getRecentWallets(),a=t.map(e=>e.info?.rdns).filter(Boolean),c=r.map(e=>e.rdns).filter(Boolean),l=a.concat(c);if(l.includes("io.metamask.mobile")&&o.w.isMobile()){let e=l.indexOf("io.metamask.mobile");l[e]="io.metamask"}return e.filter(e=>!l.includes(String(e?.rdns)))},filterOutDuplicatesByIds(e){let t=n.a.state.connectors.filter(e=>"ANNOUNCED"===e.type||"INJECTED"===e.type),r=s.i.getRecentWallets(),i=t.map(e=>e.explorerId),o=r.map(e=>e.id),a=i.concat(o);return e.filter(e=>!a.includes(e?.id))},filterOutDuplicateWallets(e){let t=this.filterOutDuplicatesByRDNS(e);return this.filterOutDuplicatesByIds(t)},markWalletsAsInstalled(e){let{connectors:t}=n.a.state,r=t.filter(e=>"ANNOUNCED"===e.type).reduce((e,t)=>(t.info?.rdns&&(e[t.info.rdns]=!0),e),{});return e.map(e=>({...e,installed:!!e.rdns&&!!r[e.rdns??""]})).sort((e,t)=>Number(t.installed)-Number(e.installed))},getConnectOrderMethod(e,t){let r=e?.connectMethodsOrder||i.H.state.features?.connectMethodsOrder,s=t||n.a.state.connectors;if(r)return r;let{injected:o,announced:h}=c.g.getConnectorsByType(s,a.N.state.recommended,a.N.state.featured),u=o.filter(c.g.showConnector),d=h.filter(c.g.showConnector);return u.length||d.length?["wallet","email","social"]:l.o.DEFAULT_CONNECT_METHOD_ORDER}}},19276:(e,t,r)=>{"use strict";e.exports=function(e){return!function(){var t=e.lib.StreamCipher,r=e.algo,i=[],n=[],s=[],o=r.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=(e[r]<<8|e[r]>>>24)&0xff00ff|(e[r]<<24|e[r]>>>8)&0xff00ff00;var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,0xffff0000&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,0xffff0000&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,0xffff0000&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,0xffff0000&e[3]|65535&e[0]];this._b=0;for(var r=0;r<4;r++)a.call(this);for(var r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,o=s[0],c=s[1],l=(o<<8|o>>>24)&0xff00ff|(o<<24|o>>>8)&0xff00ff00,h=(c<<8|c>>>24)&0xff00ff|(c<<24|c>>>8)&0xff00ff00,u=l>>>16|0xffff0000&h,d=h<<16|65535&l;n[0]^=l,n[1]^=u,n[2]^=h,n[3]^=d,n[4]^=l,n[5]^=u,n[6]^=h,n[7]^=d;for(var r=0;r<4;r++)a.call(this)}},_doProcessBlock:function(e,t){var r=this._X;a.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=(i[n]<<8|i[n]>>>
824)&0xff00ff|(i[n]<<24|i[n]>>>8)&0xff00ff00,e[t+n]^=i[n]},blockSize:4,ivSize:2});function a(){for(var e=this._X,t=this._C,r=0;r<8;r++)n[r]=t[r];t[0]=t[0]+0x4d34d34d+this._b|0,t[1]=t[1]+0xd34d34d3+ +(t[0]>>>0<n[0]>>>0)|0,t[2]=t[2]+0x34d34d34+ +(t[1]>>>0<n[1]>>>0)|0,t[3]=t[3]+0x4d34d34d+ +(t[2]>>>0<n[2]>>>0)|0,t[4]=t[4]+0xd34d34d3+ +(t[3]>>>0<n[3]>>>0)|0,t[5]=t[5]+0x34d34d34+ +(t[4]>>>0<n[4]>>>0)|0,t[6]=t[6]+0x4d34d34d+ +(t[5]>>>0<n[5]>>>0)|0,t[7]=t[7]+0xd34d34d3+ +(t[6]>>>0<n[6]>>>0)|0,this._b=+(t[7]>>>0<n[7]>>>0);for(var r=0;r<8;r++){var i=e[r]+t[r],o=65535&i,a=i>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((0xffff0000&i)*i|0)+((65535&i)*i|0);s[r]=c^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=t._createHelper(o)}(),e.Rabbit}(r(16611),r(9956),r(11816),r(93524),r(99229))},19511:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IWatch=void 0;class r{}t.IWatch=r},19542:(e,t)=>{t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};let r={N1:3,N2:3,N3:40,N4:10};t.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){let t=e.size,i=0,n=0,s=0,o=null,a=null;for(let c=0;c<t;c++){n=s=0,o=a=null;for(let l=0;l<t;l++){let t=e.get(c,l);t===o?n++:(n>=5&&(i+=r.N1+(n-5)),o=t,n=1),(t=e.get(l,c))===a?s++:(s>=5&&(i+=r.N1+(s-5)),a=t,s=1)}n>=5&&(i+=r.N1+(n-5)),s>=5&&(i+=r.N1+(s-5))}return i},t.getPenaltyN2=function(e){let t=e.size,i=0;for(let r=0;r<t-1;r++)for(let n=0;n<t-1;n++){let t=e.get(r,n)+e.get(r,n+1)+e.get(r+1,n)+e.get(r+1,n+1);(4===t||0===t)&&i++}return i*r.N2},t.getPenaltyN3=function(e){let t=e.size,i=0,n=0,s=0;for(let r=0;r<t;r++){n=s=0;for(let o=0;o<t;o++)n=n<<1&2047|e.get(r,o),o>=10&&(1488===n||93===n)&&i++,s=s<<1&2047|e.get(o,r),o>=10&&(1488===s||93===s)&&i++}return i*r.N3},t.getPenaltyN4=function(e){let t=0,i=e.data.length;for(let r=0;r<i;r++)t+=e.data[r];return Math.abs(Math.ceil(100*t/i/5)-10)*r.N4},t.applyMask=function(e,r){let i=r.size;for(let n=0;n<i;n++)for(let s=0;s<i;s++)r.isReserved(s,n)||r.xor(s,n,function(e,r,i){switch(e){case t.Patterns.PATTERN000:return(r+i)%2==0;case t.Patterns.PATTERN001:return r%2==0;case t.Patterns.PATTERN010:return i%3==0;case t.Patterns.PATTERN011:return(r+i)%3==0;case t.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(i/3))%2==0;case t.Patterns.PATTERN101:return r*i%2+r*i%3==0;case t.Patterns.PATTERN110:return(r*i%2+r*i%3)%2==0;case t.Patterns.PATTERN111:return(r*i%3+(r+i)%2)%2==0;default:throw Error("bad maskPattern:"+e)}}(e,s,n))},t.getBestMask=function(e,r){let i=Object.keys(t.Patterns).length,n=0,s=1/0;for(let o=0;o<i;o++){r(o),t.applyMask(o,e);let i=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(o,e),i<s&&(s=i,n=o)}return n}},19670:(e,t,r)=>{t.utils=r(20920),t.common=r(64874),t.sha=r(47887),t.ripemd=r(20036),t.hmac=r(46524),t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160},20036:(e,t,r)=>{"use strict";var i=r(20920),n=r(64874),s=i.rotl32,o=i.sum32,a=i.sum32_3,c=i.sum32_4,l=n.BlockHash;function h(){if(!(this instanceof h))return new h;l.call(this),this.h=[0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0],this.endian="little"}
8function u(e,t,r,i){return e<=15?t^r^i:e<=31?t&r|~t&i:e<=47?(t|~r)^i:e<=63?t&i|r&~i:t^(r|~i)}i.inherits(h,l),t.ripemd160=h,h.blockSize=512,h.outSize=160,h.hmacStrength=192,h.padLength=64,h.prototype._update=function(e,t){for(var r=this.h[0],i=this.h[1],n=this.h[2],l=this.h[3],h=this.h[4],m=r,y=i,b=n,w=l,v=h,x=0;x<80;x++){var E,_,I=o(s(c(r,u(x,i,n,l),e[d[x]+t],(E=x)<=15?0:E<=31?0x5a827999:E<=47?0x6ed9eba1:E<=63?0x8f1bbcdc:0xa953fd4e),p[x]),h);r=h,h=l,l=s(n,10),n=i,i=I,I=o(s(c(m,u(79-x,y,b,w),e[f[x]+t],(_=x)<=15?0x50a28be6:_<=31?0x5c4dd124:_<=47?0x6d703ef3:0x7a6d76e9*!!(_<=63)),g[x]),v),m=v,v=w,w=s(b,10),b=y,y=I}I=a(this.h[1],n,w),this.h[1]=a(this.h[2],l,v),this.h[2]=a(this.h[3],h,m),this.h[3]=a(this.h[4],r,y),this.h[4]=a(this.h[0],i,b),this.h[0]=I},h.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"little"):i.split32(this.h,"little")};var d=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],f=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],p=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],g=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},20063:(e,t,r)=>{"use strict";var i=r(47260);r.o(i,"useParams")&&r.d(t,{useParams:function(){return i.useParams}}),r.o(i,"usePathname")&&r.d(t,{usePathname:function(){return i.usePathname}}),r.o(i,"useRouter")&&r.d(t,{useRouter:function(){return i.useRouter}}),r.o(i,"useSearchParams")&&r.d(t,{useSearchParams:function(){return i.useSearchParams}})},20218:(e,t,r)=>{"use strict";r.d(t,{JH:()=>ec,M8:()=>em,WO:()=>tl,YY:()=>tf,_L:()=>tc,kC:()=>e9,ke:()=>eY,qw:()=>eg});var i,n=r(76688),s=r(87358),o=Object.create,a=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,h=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,d=((e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports))((e,t)=>{var r=Object.prototype.hasOwnProperty,i="~";function n(){}function s(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,r,n,o){if("function"!=typeof r)throw TypeError("The listener must be a function");var a=new s(r,n||e,o),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function c(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(i=!1)),c.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},c.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,s=r.length,o=Array(s);n<s;n++)o[n]=r[n].fn;return o},c.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},c.prototype.emit=function(e,t,r,n,s,o){var a=i?i+e:e;if(!this._events[a])return!1;var c,l,h=this._events[a],u=arguments.length;if(h.fn){switch(h.once&&this.removeListener(e,h.fn,void 0,!0),u){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,t),!0;case 3:return h.fn.call(h.context,t,r),!0;case 4:return h.fn.call(h.context,t,r,n),!0;case 5:return h.fn.call(h.context,t,r,n,s),!0;case 6:return h.fn.call(h.context,t,r,n,s,o),!0}for(l=1,c=Array(u-1);l<u;l++)c[l-1]=arguments[l];h.fn.apply(h.context,c)}else{var d,f=h.length;for(l=0;l<f;l++)switch(h[l].once&&this.removeListener(e,h[l].fn,void 0,!0),u){case 1:h[l].fn.call(h[l].context);break;case 2:h[l].fn.call(h[l].context,t);break;case 3:h[l].fn.call(h[l].context,t,r);break;case 4:h[l].fn.call(h[l].context,t,r,n);break;default:if(!c)for(d=1,c=Array(u-1);d<u;d++)c[d-1]=arguments[d];h[l].fn.apply(h[l].context,c)}}return!0},c.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},c.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},c.prototype.removeListener=function(e,t,r,n){var s=i?i+e:e;if(!this._events[s])return this;if(!t)return a(this,s),this;var o=this._events[s];if(o.fn)o.fn!==t||n&&!o.once||r&&o.context!==r||a(this,s);else{for(var c=0,l=[],h=o.length;c<h;c++)(o[c].fn!==t||n&&!o[c].once||r&&o[c].context!==r)&&l.push(o[c]);l.length?this._events[s]=1===l.length?l[0]:l:a(this,s)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=i,c.EventEmitter=c,"u">typeof t&&(t.exports=c)}
8),f={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||0x1fffffffffffff,MAX_SAFE_COMPONENT_LENGTH:16},p="object"==typeof s&&s.env&&s.env.NODE_DEBUG&&/\bsemver\b/i.test(s.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},g=function(e){let t={exports:{}};return e(t,t.exports),t.exports}(function(e,t){let{MAX_SAFE_COMPONENT_LENGTH:r}=f,i=(t=e.exports={}).re=[],n=t.src=[],s=t.t={},o=0,a=(e,t,r)=>{let a=o++;p(a,t),s[e]=a,n[a]=t,i[a]=new RegExp(t,r?"g":void 0)};a("NUMERICIDENTIFIER","0|[1-9]\\d*"),a("NUMERICIDENTIFIERLOOSE","[0-9]+"),a("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),a("MAINVERSION",`(${n[s.NUMERICIDENTIFIER]})\\.(${n[s.NUMERICIDENTIFIER]})\\.(${n[s.NUMERICIDENTIFIER]})`),a("MAINVERSIONLOOSE",`(${n[s.NUMERICIDENTIFIERLOOSE]})\\.(${n[s.NUMERICIDENTIFIERLOOSE]})\\.(${n[s.NUMERICIDENTIFIERLOOSE]})`),a("PRERELEASEIDENTIFIER",`(?:${n[s.NUMERICIDENTIFIER]}|${n[s.NONNUMERICIDENTIFIER]})`),a("PRERELEASEIDENTIFIERLOOSE",`(?:${n[s.NUMERICIDENTIFIERLOOSE]}|${n[s.NONNUMERICIDENTIFIER]})`),a("PRERELEASE",`(?:-(${n[s.PRERELEASEIDENTIFIER]}(?:\\.${n[s.PRERELEASEIDENTIFIER]})*))`),a("PRERELEASELOOSE",`(?:-?(${n[s.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${n[s.PRERELEASEIDENTIFIERLOOSE]}
8)*))`),a("BUILDIDENTIFIER","[0-9A-Za-z-]+"),a("BUILD",`(?:\\+(${n[s.BUILDIDENTIFIER]}(?:\\.${n[s.BUILDIDENTIFIER]})*))`),a("FULLPLAIN",`v?${n[s.MAINVERSION]}${n[s.PRERELEASE]}?${n[s.BUILD]}?`),a("FULL",`^${n[s.FULLPLAIN]}$`),a("LOOSEPLAIN",`[v=\\s]*${n[s.MAINVERSIONLOOSE]}${n[s.PRERELEASELOOSE]}?${n[s.BUILD]}?`),a("LOOSE",`^${n[s.LOOSEPLAIN]}$`),a("GTLT","((?:<|>)?=?)"),a("XRANGEIDENTIFIERLOOSE",`${n[s.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),a("XRANGEIDENTIFIER",`${n[s.NUMERICIDENTIFIER]}|x|X|\\*`),a("XRANGEPLAIN",`[v=\\s]*(${n[s.XRANGEIDENTIFIER]})(?:\\.(${n[s.XRANGEIDENTIFIER]})(?:\\.(${n[s.XRANGEIDENTIFIER]})(?:${n[s.PRERELEASE]})?${n[s.BUILD]}?)?)?`),a("XRANGEPLAINLOOSE",`[v=\\s]*(${n[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${n[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${n[s.XRANGEIDENTIFIERLOOSE]})(?:${n[s.PRERELEASELOOSE]})?${n[s.BUILD]}?)?)?`),a("XRANGE",`^${n[s.GTLT]}\\s*${n[s.XRANGEPLAIN]}$`),a("XRANGELOOSE",`^${n[s.GTLT]}\\s*${n[s.XRANGEPLAINLOOSE]}$`),a("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),a("COERCERTL",n[s.COERCE],!0),a("LONETILDE","(?:~>?)"),a("TILDETRIM",`(\\s*)${n[s.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",a("TILDE",`^${n[s.LONETILDE]}${n[s.XRANGEPLAIN]}$`),a("TILDELOOSE",`^${n[s.LONETILDE]}${n[s.XRANGEPLAINLOOSE]}$`),a("LONECARET","(?:\\^)"),a("CARETTRIM",`(\\s*)${n[s.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",a("CARET",`^${n[s.LONECARET]}${n[s.XRANGEPLAIN]}$`),a("CARETLOOSE",`^${n[s.LONECARET]}${n[s.XRANGEPLAINLOOSE]}$`),a("COMPARATORLOOSE",`^${n[s.GTLT]}\\s*(${n[s.LOOSEPLAIN]})$|^$`),a("COMPARATOR",`^${n[s.GTLT]}\\s*(${n[s.FULLPLAIN]})$|^$`),a("COMPARATORTRIM",`(\\s*)${n[s.GTLT]}\\s*(${n[s.LOOSEPLAIN]}|${n[s.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",a("HYPHENRANGE",`^\\s*(${n[s.XRANGEPLAIN]})\\s+-\\s+(${n[s.XRANGEPLAIN]})\\s*$`),a("HYPHENRANGELOOSE",`^\\s*(${n[s.XRANGEPLAINLOOSE]})\\s+-\\s+(${n[s.XRANGEPLAINLOOSE]})\\s*$`),a("STAR","(<|>)?=?\\s*\\*"),a("GTE0","^\\s*>
8=\\s*0.0.0\\s*$"),a("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}),m=/^[0-9]+$/,y=(e,t)=>{let r=m.test(e),i=m.test(t);return r&&i&&(e*=1,t*=1),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1},{MAX_LENGTH:b,MAX_SAFE_INTEGER:w}=f,{re:v,t:x}=g,{compareIdentifiers:E}={compareIdentifiers:y,rcompareIdentifiers:(e,t)=>y(t,e)},_=class e{constructor(t,r){if(r&&"object"==typeof r||(r={loose:!!r,includePrerelease:!1}),t instanceof e){if(!!r.loose===t.loose&&!!r.includePrerelease===t.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw TypeError(`Invalid Version: ${t}`);if(t.length>b)throw TypeError(`version is longer than ${b} characters`);p("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let i=t.trim().match(r.loose?v[x.LOOSE]:v[x.FULL]);if(!i)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>w||this.major<0)throw TypeError("Invalid major version");if(this.minor>w||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>w||this.patch<0)throw TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<w)return t}return e}):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(p("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if("string"==typeof t&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),E(this.major,t.major)||E(this.minor,t.minor)||E(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return -1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(p("prerelease compare",r,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return -1;if(e!==i)return E(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(p("prerelease compare",r,e,i),void 0===e&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===e)return -1;if(e!==i)return E(e,i)}while(++r)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}},I=(e,t,r)=>new _(e,r).compare(new _(t,r)),A=(e,t,r,i)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return 0===I(e,r,i);case"!=":return 0!==I(e,r,i);case">":return I(e,r,i)>0;case">=":return I(e,r,i)>=0;case"<":return 0>I(e,r,i);case"<=":return 0>=I(e,r,i);default:throw TypeError(`Invalid operator: ${t}`)}},S=Symbol("SemVer ANY"),C=class e{static get ANY(){return S}constructor(t,r){if(r&&"object"==typeof r||(r={loose:!!r,includePrerelease:!1}),t instanceof e){if(!!r.loose===t.loose)return t;t=t.value}p("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===S?this.value="":this.value=this.operator+this.semver.version,p("comp",this)}parse(e){let t=this.options.loose?N[O.COMPARATORLOOSE]:N[O.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new _(r[2],this.options.loose):this.semver=S}toString(){return this.value}test(e){if(p("Comparator.test",e,this.options.loose),this.semver===S||e===S)return!0;
8if("string"==typeof e)try{e=new _(e,this.options)}catch{return!1}return A(e,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw TypeError("a Comparator is required");if(r&&"object"==typeof r||(r={loose:!!r,includePrerelease:!1}),""===this.operator)return""===this.value||new P(t.value,r).test(this.value);if(""===t.operator)return""===t.value||new P(this.value,r).test(t.semver);let i=(">="===this.operator||">"===this.operator)&&(">="===t.operator||">"===t.operator),n=("<="===this.operator||"<"===this.operator)&&("<="===t.operator||"<"===t.operator),s=this.semver.version===t.semver.version,o=(">="===this.operator||"<="===this.operator)&&(">="===t.operator||"<="===t.operator),a=A(this.semver,"<",t.semver,r)&&(">="===this.operator||">"===this.operator)&&("<="===t.operator||"<"===t.operator),c=A(this.semver,">",t.semver,r)&&("<="===this.operator||"<"===this.operator)&&(">="===t.operator||">"===t.operator);return i||n||s&&o||a||c}},{re:N,t:O}=g,P=class e{constructor(t,r){if(r&&"object"==typeof r||(r={loose:!!r,includePrerelease:!1}),t instanceof e)return!!r.loose===t.loose&&!!r.includePrerelease===t.includePrerelease?t:new e(t.raw,r);if(t instanceof C)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t,this.set=t.split(/\s*\|\|\s*/).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${t}`);this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){let{loose:t}=this.options;e=e.trim();let r=t?T[M.HYPHENRANGELOOSE]:T[M.HYPHENRANGE];p("hyphen replace",e=e.replace(r,K(this.options.includePrerelease))),p("comparator trim",e=e.replace(T[M.COMPARATORTRIM],R),T[M.COMPARATORTRIM]),e=(e=(e=e.replace(T[M.TILDETRIM],k)).replace(T[M.CARETTRIM],D)).split(/\s+/).join(" ");let i=t?T[M.COMPARATORLOOSE]:T[M.COMPARATOR];return e.split(" ").map(e=>U(e,this.options)).join(" ").split(/\s+/).map(e=>V(e,this.options)).filter(this.options.loose?e=>!!e.match(i):()=>!0).map(e=>new C(e,this.options))}intersects(t,r){if(!(t instanceof e))throw TypeError("a Range is required");return this.set.some(e=>L(e,r)&&t.set.some(t=>L(t,r)&&e.every(e=>t.every(t=>e.intersects(t,r)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new _(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(G(this.set[t],e,this.options))return!0;return!1}},{re:T,t:M,comparatorTrimReplace:R,tildeTrimReplace:k,caretTrimReplace:D}=g,L=(e,t)=>{let r=!0,i=e.slice(),n=i.pop();for(;r&&i.length;)r=i.every(e=>n.intersects(e,t)),n=i.pop();return r},U=(e,t)=>(p("comp",e,t),p("caret",e=z(e,t)),p("tildes",e=j(e,t)),p("xrange",e=H(e,t)),p("stars",e=W(e,t)),e),B=e=>!e||"x"===e.toLowerCase()||"*"===e,j=(e,t)=>e.trim().split(/\s+/).map(e=>$(e,t)).join(" "),$=(e,t)=>{let r=t.loose?T[M.TILDELOOSE]:T[M.TILDE];return e.replace(r,(t,r,i,n,s)=>{let o;return p("tilde",e,t,r,i,n,s),B(r)?o="":B(i)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:B(n)?o=`>=${r}.${i}.0 <${r}.${+i+1}.0-0`:s?(p("replaceTilde pr",s),o=`>=${r}.${i}.${n}-${s} <${r}.${+i+1}.0-0`):o=`>=${r}.${i}.${n} <${r}.${+i+1}.0-0`,p("tilde return",o),o})},z=(e,t)=>e.trim().split(/\s+/).map(e=>q(e,t)).join(" "),q=(e,t)=>{p("caret",e,t);let r=t.loose?T[M.CARETLOOSE]:T[M.CARET],i=t.includePrerelease?"-0":"";return e.replace(r,(t,r,n,s,o)=>{let a;return p("caret",e,t,r,n,s,o),B(r)?a="":B(n)?a=`>=${r}.0.0${i} <${+r+1}.0.0-0`:B(s)?a="0"===r?`>=${r}.${n}.0${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.0${i} <${+r+1}.0.0-0`:o?(p("replaceCaret pr",o),a="0"===r?"0"===n?`>=${r}.${n}.${s}-${o} <${r}.${n}.${+s+1}-0`:`>=${r}.${n}.${s}-${o} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${s}-${o} <${+r+1}.0.0-0`):(p("no pr"),a="0"===r?"0"===n?`>=${r}.${n}.${s}${i} <${r}.${n}.${+s+1}-0`:`>=${r}.${n}.${s}${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${s} <${+r+1}.0.0-0`),p("caret return",a),a})},H=(e,t)=>(p("replaceXRanges",e,t),e.split(/\s+/).map(e=>F(e,t)).join(" ")),F=(e,t)=>{e=e.trim();let r=t.loose?T[M.XRANGELOOSE]:T[M.XRANGE];return e.replace(r,(r,i,n,s,o,a)=>{p("xRange",e,r,i,n,s,o,a);let c=B(n),l=c||B(s),h=l||B(o);return"="===i&&h&&(i=""),a=t.includePrerelease?"-0":"",c?r=">"===i||"<"===i?"<0.0.0-0":"*":i&&h?(l&&(s=0),o=0,">"===i?(i=">=",l?(n=+n+1,s=0):s=+s+1,o=0):"<="===i&&(i="<",l?n=+n+1:s=+s+1),"<"===i&&(a="-0"),r=`${i+n}.${s}.${o}${a}`):l?r=`>=${n}.0.0${a} <${+n+1}.0.0-0`:h&&(r=`>=${n}.${s}.0${a} <${n}.${+s+1}.0-0`),p("xRange return",r),r})},W=(e,t)=>(p("replaceStars",e,t),e.trim().replace(T[M.STAR],"")),V=(e,t)=>(p("replaceGTE0",e,t),e.trim().replace(T[t.includePrerelease?M.GTE0PRE:M.GTE0],"")),K=e=>(t,r,i,n,s,o,a,c,l,h,u,d,f)=>`${r=B(i)?"":B(n)?`>=${i}.0.0${e?"-0":""}`:B(s)?`>=${i}.${n}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=B(l)?"":B(h)?`<${+l+1}.0.0-0`:B(u)?`<${l}.${+h+1}.0-0`:d?`<=${l}.${h}.${u}-${d}`:e?`<${l}.${h}.${+u+1}-0`:`<=${c}`}`.trim(),G=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(p(e[r].semver),e[r].semver!==C.ANY&&e[r].semver.prerelease.length>0){let i=e[r].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0},{MAX_LENGTH:Y}=f,{re:J,t:X}=g,{re:Q,t:Z}=g;function ee(e){return String.fromCharCode(parseInt(e.slice(1),16))}function et(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function er(e){return btoa(encodeURIComponent(JSON.stringify(e)).replace(/%[0-9A-F]{2}/g,ee))}function ei(e){return JSON.parse(decodeURIComponent(Array.from(atob(e),et).join("")))}function en(e){return typeof e>"u"}function es(e){return null===e||en(e)}function eo(e){if(!e)return!0;for(let t in e)if(Object.hasOwnProperty.call(e,t))return!1;return!0}var ea={};function ec(e,t){return Object.assign(ea,t),e}var el={"magic-sdk":"magic-sdk","@magic-sdk/react-native":"magic-sdk-rn","@magic-sdk/react-native-bare":"magic-sdk-rn-bare","@magic-sdk/react-native-expo":"magic-sdk-rn-expo"}
8,eh=class e extends Error{constructor(t,r){super(`Magic SDK Error: [${t}] ${r}`),this.code=t,this.rawMessage=r,Object.setPrototypeOf(this,e.prototype)}__proto__=Error},eu=class e extends Error{__proto__=Error;code;rawMessage;data;constructor(t){super();let r=Number(t?.code);this.rawMessage=t?.message||"Internal error",this.code=!function(e){return!es(e)&&"number"==typeof e&&Object.values(n.fS).includes(e)}(r)?n.fS.InternalError:r,this.message=`Magic RPC Error: [${this.code}] ${this.rawMessage}`,this.data=t?.data||void 0,Object.setPrototypeOf(this,e.prototype)}},ed=class{constructor(e,t){this.code=e,this.rawMessage=t,this.message=`Magic SDK Warning: [${e}] ${t}`}message;log(){console.warn(this.message)}},ef=class e extends Error{constructor(t,r,i,n){super(`Magic Extension Error (${t.name}): [${r}] ${i}`),this.code=r,this.rawMessage=i,this.data=n,Object.setPrototypeOf(this,e.prototype)}__proto__=Error},ep=class{constructor(e,t,r){this.code=t,this.rawMessage=r,this.message=`Magic Extension Warning (${e.name}): [${t}] ${r}`}message;log(){console.warn(this.message)}};function eg(){return new eh(n.E.ModalNotReady,"Modal is not ready")}function em(){return new ed(n.QN.DuplicateIframe,"Duplicate iframes found.")}var ey=function*(){let e=0;for(;;)e<Number.MAX_SAFE_INTEGER?yield++e:e=0}();function eb(){return"@magic-sdk/react-native-bare"===ea.sdkName||"@magic-sdk/react-native-expo"===ea.sdkName?Math.floor(1e5*Math.random())+1:ey.next().value}var ew={};function ev(e){return async(...t)=>(i||(i=await ea.configureStorage()),await i.ready(),i[e](...t))}((e,t)=>{for(var r in t)a(e,r,{get:t[r],enumerable:!0})})(ew,{clear:()=>eI,getItem:()=>ex,iterate:()=>eN,key:()=>eS,keys:()=>eC,length:()=>eA,removeItem:()=>e_,setItem:()=>eE});var ex=ev("getItem"),eE=ev("setItem"),e_=ev("removeItem"),eI=ev("clear"),eA=ev("length"),eS=ev("key"),eC=ev("keys"),eN=ev("iterate"),eO="STORE_KEY_PRIVATE_KEY",eP="STORE_KEY_PUBLIC_JWK",eT="ECDSA",eM={name:eT,namedCurve:"P-256"};function eR(){let e="u">typeof window&&!!window.crypto,t=e&&!!window.crypto.subtle;return e&&t}async function ek(){var e,t;let r,i,n=await eD();if(!n)return void console.info("unable to creat kee publicy or webcrypto is unsupported");let{subtle:s}=window.crypto,o=await ex(eO);if(!o||!s)return void console.info("unable to find private key or webcrypto unsupported");let a={iat:Math.floor(new Date().getTime()/1e3),jti:((i=window.crypto.getRandomValues(new Uint8Array(16)))[6]=15&i[6]|64,i[8]=191&i[8]|128,""+i[0].toString(16)+i[1].toString(16)+i[2].toString(16)+i[3].toString(16)+"-"+i[4].toString(16)+i[5].toString(16)+"-"+i[6].toString(16)+i[7].toString(16)+"-"+i[8].toString(16)+i[9].toString(16)+"-"+i[10].toString(16)+i[11].toString(16)+i[12].toString(16)+i[13].toString(16)+i[14].toString(16)+i[15].toString(16))},c={protected:eU(eB(JSON.stringify({typ:"dpop+jwt",alg:"ES256",jwk:n}))),claims:eU(eB(JSON.stringify(a)))},l=(e=`${c.protected}.${c.claims}`,new TextEncoder().encode(e)),h=(t=new Uint8Array(await s.sign({name:eT,hash:{name:"SHA-256"}},o,l)),r="",t.forEach(e=>{r+=String.fromCharCode(e)}),eU(r));return`${c.protected}.${c.claims}.${h}`}async function eD(){return eR()?(await ex(eP)||await eL(),ex(eP)):void console.info("webcrypto is not supported")}async function eL(){let{subtle:e}=window.crypto,t=await e.generateKey(eM,!1,["sign"]),r=await e.exportKey("jwk",t.publicKey);await eE(eO,t.privateKey),await eE(eP,r)}function eU(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+/g,"")}function eB(e){return encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))}var ej=Symbol("Payload pre-processed by Magic SDK");function e$(e){return Object.defineProperty(e,ej,{value:!0,enumerable:!1}),e}function ez(e){return e[ej]||(e.jsonrpc=e.jsonrpc??"2.0",e.id=eb(),e.method=e.method??"noop",e.params=e.params??[],e$(e)),e}
8function eq(e,t=[]){return e$({params:t,method:e,jsonrpc:"2.0",id:eb()})}var eH=class e{_jsonrpc;_id;_result;_error;constructor(t){t instanceof e?(this._jsonrpc=t.payload.jsonrpc,this._id=t.payload.id,this._result=t.payload.result,this._error=t.payload.error):function(e){return!es(e)&&!en(e.jsonrpc)&&!en(e.id)&&(!en(e.result)||!en(e.error))}(t)?(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=t.result,this._error=t.error):(this._jsonrpc=t.jsonrpc,this._id=t.id,this._result=void 0,this._error=void 0)}applyError(e){return this._error=e,this}applyResult(e){return this._result=e,this}get hasError(){return this._error?.code===n.fS.DpopInvalidated&&(e_(eP),e_(eO)),"u">typeof this._error&&null!==this._error}get hasResult(){return"u">typeof this._result}get payload(){return{jsonrpc:this._jsonrpc,id:this._id,result:this._result,error:this._error}}},eF=((e,t,r)=>(r=null!=e?o(h(e)):{},((e,t,r,i)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of l(t))u.call(e,n)||n===r||a(e,n,{get:()=>t[n],enumerable:!(i=c(t,n))||i.enumerable});return e})(!t&&e&&e.__esModule?r:a(r,"default",{value:e,enumerable:!0}),e)))(d()),eW=class extends eF.default{};function eV(){let e=new eW;return{emitter:e,createChainingEmitterMethod:(t,r)=>(...i)=>(e[t].apply(e,i),r),createBoundEmitterMethod:t=>(...r)=>e[t].apply(e,r)}}var eK=Symbol("isPromiEvent");function eG(e){return!!e[eK]}function eY(e){let t=eJ(e),{createBoundEmitterMethod:r,createChainingEmitterMethod:i}=eV(),s=Symbol("Promise.then"),o=Symbol("Promise.catch"),a=Symbol("Promise.finally"),c=(e,t)=>(...r)=>l(t[e].apply(t,r)),l=e=>Object.assign(e,{[eK]:!0,[s]:e[s]||e.then,[o]:e[o]||e.catch,[a]:e[a]||e.finally,then:c(s,e),catch:c(o,e),finally:c(a,e),on:i("on",e),once:i("once",e),addListener:i("addListener",e),off:i("off",e),removeListener:i("removeListener",e),removeAllListeners:i("removeAllListeners",e),emit:r("emit"),eventNames:r("eventNames"),listeners:r("listeners"),listenerCount:r("listenerCount")}),h=l(t.then(e=>(h.emit("done",e),h.emit("settled"),e),e=>{throw h.emit("error",e),h.emit("settled"),e}));return h.on(n.pI.ClosedByUser,()=>{h.emit(n.C4.ClosedByUser)}
8),h}function eJ(e){return new Promise((t,r)=>{Promise.resolve(e(t,r)).catch(r)})}var eX=class{constructor(e){this.sdk=e}get overlay(){return this.sdk.overlay}request(e){return this.sdk.thirdPartyWallets.isConnected&&!n.eE.includes(e.method)?this.requestThirdPartyWallets(e):this.requestOverlay(e)}requestThirdPartyWallets(e){return eY((t,r)=>{this.sdk.thirdPartyWallets.requestOverride(e).then(t).catch(r)})}requestOverlay(e){let t=this.overlay.post(n.F8.MAGIC_HANDLE_REQUEST,ez(e)),r=eY((e,r)=>{t.then(t=>{if(i(),t.hasError)r(new eu(t.payload.error));else if(t.hasResult)e(t.payload.result);else throw new eh(n.E.MalformedResponse,"Response from the Magic iframe is malformed.")}).catch(e=>{i(),r(e)})}),i=this.overlay.on(n.rK.MAGIC_HANDLE_EVENT,t=>{let{response:i}=t.data;if(i.id===e.id&&i.result?.event){let{event:e,params:t=[]}=i.result;r.emit(e,...t)}});return r}createIntermediaryEvent(e,t){return r=>{let i=eq(n.$G.IntermediaryEvent,[{payloadId:t,eventType:e,args:r}]);this.request(i)}}},eQ={"magic-sdk":"v18.0.0","@magic-sdk/react-native":"v14.0.0","@magic-sdk/react-native-bare":"v19.0.0","@magic-sdk/react-native-expo":"v19.0.0"},eZ=class extends eX{loginWithMagicLink(e){let t="@magic-sdk/react-native"===ea.sdkName||"@magic-sdk/react-native-bare"===ea.sdkName||"@magic-sdk/react-native-expo"===ea.sdkName;if(t&&function(e,t){let[r]=e.split(".").map(Number);return r>=19}(ea.version,0))throw Error("loginWithMagicLink() is deprecated for this package, please utilize a passcode method like loginWithSMS or loginWithEmailOTP instead.");t&&(function(e){let{method:t,removalVersions:r,useInstead:i}=e,s=r[ea.sdkName],o=i?` Use \`${i}\` instead.`:"",a=`\`${t}\` will be removed from \`${ea.sdkName}\` in version \`${s}\`.${o}`;return new ed(n.QN.DeprecationNotice,a)})({method:"auth.loginWithMagicLink()",removalVersions:eQ,useInstead:"auth.loginWithEmailOTP()"}).log();let{email:r,showUI:i=!0,redirectURI:s,overrides:o,lifespan:a}=e,c=eq(this.sdk.testMode?n.$G.LoginWithMagicLinkTestMode:n.$G.LoginWithMagicLink,[{email:r,showUI:i,redirectURI:s,overrides:o,lifespan:a}]);return this.request(c)}loginWithSMS(e){let{phoneNumber:t,showUI:r=!0,lifespan:i}=e,s=eq(this.sdk.testMode?n.$G.LoginWithSmsTestMode:n.$G.LoginWithSms,[{phoneNumber:t,showUI:r,lifespan:i}]),o=this.request(s);return!r&&o&&(o.on(n.Pk.VerifySmsOtp,e=>{this.createIntermediaryEvent(n.Pk.VerifySmsOtp,s.id)(e)}),o.on(n.Pk.VerifyMFACode,e=>{this.createIntermediaryEvent(n.Pk.VerifyMFACode,s.id)(e)}),o.on(n.Pk.LostDevice,()=>{this.createIntermediaryEvent(n.Pk.LostDevice,s.id)()}),o.on(n.Pk.VerifyRecoveryCode,e=>{this.createIntermediaryEvent(n.Pk.VerifyRecoveryCode,s.id)(e)}),o.on(n.Pk.Cancel,()=>{this.createIntermediaryEvent(n.Pk.Cancel,s.id)()})),o}loginWithEmailOTP(e){let{email:t,showUI:r,deviceCheckUI:i,overrides:s,lifespan:o}=e,a=eq(this.sdk.testMode?n.$G.LoginWithEmailOTPTestMode:n.$G.LoginWithEmailOTP,[{email:t,showUI:r,deviceCheckUI:i,overrides:s,lifespan:o}]),c=this.request(a);return!i&&c&&c.on(n.jA.Retry,()=>{this.createIntermediaryEvent(n.jA.Retry,a.id)()}),!r&&c&&(c.on(n.C9.VerifyEmailOtp,e=>{this.createIntermediaryEvent(n.C9.VerifyEmailOtp,a.id)(e)}),c.on(n.C9.VerifyMFACode,e=>{this.createIntermediaryEvent(n.C9.VerifyMFACode,a.id)(e)}),c.on(n.C9.LostDevice,()=>{this.createIntermediaryEvent(n.C9.LostDevice,a.id)()}),c.on(n.C9.VerifyRecoveryCode,e=>{this.createIntermediaryEvent(n.C9.VerifyRecoveryCode,a.id)(e)}),c.on(n.C9.Cancel,()=>{this.createIntermediaryEvent(n.C9.Cancel,a.id)()})),c}loginWithCredential(e){let{credentialOrQueryString:t,lifespan:r}=e||{},i=t??"";if(!t&&"web"===ea.platform){i=window.location.search;let e=window.location.origin+window.location.pathname;window.history.replaceState(null,"",e)}let s=eq(this.sdk.testMode?n.$G.LoginWithCredentialTestMode:n.$G.LoginWithCredential,[i,r]);return this.request(s)}setAuthorizationToken(e){let t=eq(n.$G.SetAuthorizationToken,[{jwt:e}]);return this.request(t)}updateEmailWithUI(e){let{email:t,showUI:r=!0}
8=e,i=eq(this.sdk.testMode?n.$G.UpdateEmailTestMode:n.$G.UpdateEmail,[{email:t,showUI:r}]),s=this.request(i);return r||(s.on(n.p_.Retry,()=>{this.createIntermediaryEvent(n.p_.Retry,i.id)()}),s.on(n.p_.Cancel,()=>{this.createIntermediaryEvent(n.p_.Cancel,i.id)()}),s.on(n.p_.VerifyEmailOtp,e=>{this.createIntermediaryEvent(n.p_.VerifyEmailOtp,i.id)(e)}),s.on(n.p_.VerifyMFACode,e=>{this.createIntermediaryEvent(n.p_.VerifyMFACode,i.id)(e)}),s.on(n.jY.RetryWithNewEmail,e=>{this.createIntermediaryEvent(n.jY.RetryWithNewEmail,i.id)(e)}),s.on(n.jY.Cancel,()=>{this.createIntermediaryEvent(n.jY.Cancel,i.id)()}),s.on(n.jY.VerifyEmailOtp,e=>{this.createIntermediaryEvent(n.jY.VerifyEmailOtp,i.id)(e)})),s}},e0="AES-GCM";async function e1(){let e=[];for(let t of(await eN((t,r,i)=>{r.startsWith("ds_")&&e.push(r)}),e))await e_(t)}function e2(e){let t="",r=new Uint8Array(e),i=r.byteLength;for(let e=0;e<i;e++)t+=String.fromCharCode(r[e]);return window.btoa(t)}function e3(e){let t=window.atob(e),r=t.length,i=new Uint8Array(r);for(let e=0;e<r;e++)i[e]=t.charCodeAt(e);return i.buffer}async function e8(){if(!eR())return void console.info("webcrypto is not supported");let{crypto:e}=window;return await ex("iv")||e.getRandomValues(new Uint8Array(12))}async function e5(){if(!eR())return void console.info("webcrypto is not supported");let{subtle:e}=window.crypto;return await ex("ek")||await e.generateKey({name:e0,length:256},!1,["encrypt","decrypt"])}async function e6(e,t){let r=await e8(),i=await e5();if(!r||!i||!e)return;let n=e3(e),{subtle:s}=window.crypto,o=e2(await s.encrypt({name:e0,iv:r},i,n));await eE(`ds_${t}`,o),await eE("ek",i),await eE("iv",r)}async function e4(e){let t=await ex(`ds_${e}`),r=await ex("iv"),i=await ex("ek");if(!r||!t||!i||!eR())return;let{subtle:n}=window.crypto;return e2(await n.decrypt({name:e0,iv:r},i,e3(t)))}function e9(e,t){return t?new URL(e,t):new URL(e)}var e7=class extends eX{getIdToken(e){let t=eq(this.sdk.testMode?n.$G.GetIdTokenTestMode:n.$G.GetIdToken,[e]);return this.request(t)}generateIdToken(e){let t=eq(this.sdk.testMode?n.$G.GenerateIdTokenTestMode:n.$G.GenerateIdToken,[e]);return this.request(t)}getInfo(){let e=eq(n.$G.GetInfo,[]);return this.request(e)}isLoggedIn(){return eY(async(e,t)=>{try{let t=!1;this.sdk.useStorageCache&&(t=await ex(this.localForageIsLoggedInKey)==="true")&&e(!0);let r=eq(this.sdk.testMode?n.$G.IsLoggedInTestMode:n.$G.IsLoggedIn),i=await this.request(r);this.sdk.useStorageCache&&(i?eE(this.localForageIsLoggedInKey,!0):e_(this.localForageIsLoggedInKey),t&&!i&&this.emitUserLoggedOut(!0)),e(i)}catch(e){t(e)}})}logout(){return e_(this.localForageIsLoggedInKey),e_("rt"),e1(),eY(async(e,t)=>{try{let t=eq(this.sdk.testMode?n.$G.LogoutTestMode:n.$G.Logout),r=await this.request(t);this.sdk.useStorageCache&&this.emitUserLoggedOut(r),e(r)}catch(e){t(e)}})}requestInfoWithUI(e){let t=eq(n.$G.RequestUserInfoWithUI,e?[e]:[]);return this.request(t)}showSettings(e){let{showUI:t=!0}=e||{},r=eq(this.sdk.testMode?n.$G.UserSettingsTestMode:n.$G.UserSettings,[e]),i=this.request(r);return!t&&i&&(i.on(n.aW.SendNewPhoneNumber,e=>{this.createIntermediaryEvent(n.aW.SendNewPhoneNumber,r.id)(e)}),i.on(n.aW.SendOtpCode,e=>{this.createIntermediaryEvent(n.aW.SendOtpCode,r.id)(e)}),i.on(n.aW.StartEditPhoneNumber,()=>{this.createIntermediaryEvent(n.aW.StartEditPhoneNumber,r.id)()}),i.on(n.aW.Cancel,()=>{this.createIntermediaryEvent(n.aW.Cancel,r.id)()}),i.on(n.p_.VerifyEmailOtp,e=>{this.createIntermediaryEvent(n.p_.VerifyEmailOtp,r.id)(e)})),i}recoverAccount(e){let{email:t,showUI:r}=e,i=eq(this.sdk.testMode?n.$G.RecoverAccountTestMode:n.$G.RecoverAccount,[{email:t,showUI:r}]),s=this.request(i);return!r&&s&&(s.on(n.RQ.Cancel,()=>{this.createIntermediaryEvent(n.RQ.Cancel,i.id)()}),s.on(n.RQ.ResendSms,()=>{this.createIntermediaryEvent(n.RQ.ResendSms,i.id)()}),s.on(n.RQ.VerifyOtp,e=>{this.createIntermediaryEvent(n.RQ.VerifyOtp,i.id)(e)}),s.on(n.RQ.UpdateEmail,e=>{this.createIntermediaryEvent(n.RQ.UpdateEmail,i.id)(e)}),s.on(n.jY.Cancel,()=>{this.createIntermediaryEvent(n.jY.Cancel,i.id)()}),s.on(n.jY.RetryWithNewEmail,e=>{this.createIntermediaryEvent(n.jY.RetryWithNewEmail,i.id)(e)}),s.on(n.jY.VerifyEmailOtp,e=>{this.createIntermediaryEvent(n.jY.VerifyEmailOtp,i.id)(e)})),s}revealEVMPrivateKey(){let e=eq(n.$G.RevealPK,[{chain:"ETH"}]);return this.request(e)}revealPrivateKey(){throw Error("revealPrivateKey() has been decommissioned. For EVM chains, use `user.revealEVMPrivateKey()` instead. For non-EVM chains, use `[extension].revealPrivateKey()` instead.")}onUserLoggedOut(e){this.userLoggedOutCallbacks.push(e)}enableMFA(e){let{showUI:t=!0}=e,r=eq(n.$G.EnableMFA,[{showUI:t}]),i=this.request(r);return!t&&i&&(i.on(n.V1.VerifyMFACode,e=>{this.createIntermediaryEvent(n.V1.VerifyMFACode,r.id)(e)}),i.on(n.V1.Cancel,()=>{this.createIntermediaryEvent(n.V1.Cancel,r.id)()})),i}disableMFA(e){let{showUI:t=!0}=e,r=eq(n.$G.DisableMFA,[{showUI:t}]),i=this.request(r);return!t&&i&&(i.on(n.kI.VerifyMFACode,e=>{this.createIntermediaryEvent(n.kI.VerifyMFACode,r.id)(e)}),i.on(n.kI.LostDevice,e=>{this.createIntermediaryEvent(n.kI.LostDevice,r.id)(e)}),i.on(n.kI.Cancel,()=>{this.createIntermediaryEvent(n.kI.Cancel,r.id)()})),i}emitUserLoggedOut(e){this.userLoggedOutCallbacks.forEach(t=>{t(e)})}localForageIsLoggedInKey="magic_auth_is_logged_in";userLoggedOutCallbacks=[]},te=class extends eX{connectWithUI(e){let t=eY(async(r,i)=>{try{let s=eq(n.$G.Login,[{enabledWallets:this.sdk.thirdPartyWallets.enabledWallets,...e}]),o=this.request(s);
8this.sdk.thirdPartyWallets.eventListeners.forEach(({event:e,callback:t})=>{o.on(e,()=>t(s.id))}),o.on("id-token-created",e=>{t.emit("id-token-created",e)});let a=await o;a.error&&i(a),r(a)}catch(e){i(e)}});return t}showUI(e){return this.request(eq(n.$G.ShowUI,[e]))}showAddress(){return this.request(eq(n.$G.ShowAddress))}showSendTokensUI(){return this.request(eq(n.$G.ShowSendTokensUI))}showOnRamp(){return this.request(eq(n.$G.ShowOnRamp))}showNFTs(){return this.request(eq(n.$G.ShowNFTs))}showBalances(){return this.request(eq(n.$G.ShowBalances))}sign7702Authorization(e){return this.request(eq(n.$G.Sign7702Authorization,[e]))}send7702Transaction(e){return this.request(eq(n.$G.Send7702Transaction,[e]))}},tt=class extends eX{eventListeners=[];enabledWallets={};isConnected=!1;resetThirdPartyWalletState(){localStorage.removeItem(n.Hh.PROVIDER),localStorage.removeItem(n.Hh.ADDRESS),localStorage.removeItem(n.Hh.CHAIN_ID),this.isConnected=!1}requestOverride(e){return e.method===n.$G.Login?(this.resetThirdPartyWalletState(),super.request(e)):e.method===n.$G.GetInfo?this.getInfo(e):e.method===n.$G.IsLoggedIn?this.isLoggedIn(e):e.method===n.$G.Logout?this.logout(e):"magic-widget"===localStorage.getItem(n.Hh.PROVIDER)?this.magicWidgetRequest(e):(this.resetThirdPartyWalletState(),super.request(e))}isLoggedIn(e){return"magic-widget"===localStorage.getItem(n.Hh.PROVIDER)?super.requestOverlay(e):(this.resetThirdPartyWalletState(),super.request(e))}getInfo(e){return"magic-widget"===localStorage.getItem(n.Hh.PROVIDER)?super.requestOverlay(e):(this.resetThirdPartyWalletState(),super.request(e))}logout(e){let t=localStorage.getItem(n.Hh.PROVIDER);return(this.resetThirdPartyWalletState(),"magic-widget"===t)?this.magicWidgetLogout(e):super.request(e)}magicWidgetRequest(e){return["eth_","wallet_","net_","web3_"].some(t=>e.method?.startsWith(t))||["personal_sign"].includes(e.method)?eY((t,r)=>{this.sdk.walletKit.walletRequest(e).then(t).catch(e=>r(new eu(e)))}):super.requestOverlay(e)}magicWidgetLogout(e){return eY(async t=>{try{this.sdk.walletKit.clearConnectedState()}catch(e){console.error(e)}return super.requestOverlay(e)})}handleIframeThirdPartyWalletRequest(e){this.magicWidgetRequest(e.payload).then(t=>{this.overlay.postThirdPartyWalletResponse({id:e.payload.id,jsonrpc:"2.0",result:t})}).catch(t=>{this.overlay.postThirdPartyWalletResponse({id:e.payload.id,jsonrpc:"2.0",error:{code:t.code||-32603,message:t.message||"Internal error",data:t.data}})})}},{createBoundEmitterMethod:tr,createChainingEmitterMethod:ti}=eV(),tn=class extends eX{isMagic=!0;sendAsync(e,t){if(!t){var r;let e,i,s;throw r={procedure:"Magic.rpcProvider.sendAsync",argument:1,expected:"function",received:null===t?"null":typeof t},new eh(n.E.InvalidArgument,`Invalid ${(i=(e=r.argument+1)%10,s=e%100,1===i&&11!==s?`${e}st`:2===i&&12!==s?`${e}nd`:3===i&&13!==s?`${e}rd`:`${e}th`)} argument given to \`${r.procedure}\`. 9 Expected: \`${r.expected}\` 10 Received: \`${r.received}\``)}Array.isArray(e)?Promise.all(e.map(e=>ez(e)).map(e=>this.request(e).then(t=>({jsonrpc:e.jsonrpc??"2.0",id:e.id??null,result:t,error:null})).catch(t=>({jsonrpc:e.jsonrpc??"2.0",id:e.id??null,error:t})))).then(e=>{t(null,e)}):this.request(ez(e)).then(r=>{t(null,{jsonrpc:e.jsonrpc??"2.0",id:e.id??null,result:r,error:null})}).catch(r=>{t(r,{jsonrpc:e.jsonrpc??"2.0",id:e.id??null,error:r})})}send(e,t){if("string"==typeof e){let r=eq(e,Array.isArray(t)?t:[]);return this.request(r)}if(Array.isArray(e)||t)return void this.sendAsync(e,t);let r=new ed(n.QN.SyncWeb3Method,"Non-async web3 methods are deprecated
10in web3 > 1.0 and are not supported by the Magic web3 provider. Please use an async method instead.");return r.log(),new eH(e).applyError({code:-32603,message:r.rawMessage}).payload}enable(){let e=eq(n.$G.Login);return this.request(e)}request(e){return this.prefixPayloadMethodForTestMode(e),super.request(e)}prefixPayloadMethodForTestMode(e){this.sdk.testMode&&(e.method=`testMode/eth/${e.method}`)}on=ti("on",this);once=ti("once",this);addListener=ti("addListener",this);off=ti("off",this);removeListener=ti("removeListener",this);removeAllListeners=ti("removeAllListeners",this);emit=tr("emit");eventNames=tr("eventNames");listeners=tr("listeners");listenerCount=tr("listenerCount")},ts=class extends eX{purchase(e){let t=eq(n.$G.NFTPurchase,[e]);return this.request(t)}checkout(e){let t=this.sdk.thirdPartyWallets.isConnected,r=eq(n.$G.NFTCheckout,[{...e,walletProvider:t?"web3modal":"magic"}]),i=this.request(r);return t&&(i.on(n.H$.Initiated,async e=>{try{let t=await this.request({method:"eth_sendTransaction",params:[e]});this.createIntermediaryEvent(n.H$.Success,r.id)(t)}catch{this.createIntermediaryEvent(n.H$.Failure,r.id)()}}),i.on(n.H$.Disconnect,()=>{this.sdk.thirdPartyWallets.resetThirdPartyWalletState(),i.emit("disconnect")})),i}transfer(e){let t=eq(n.$G.NFTTransfer,[e]);return this.request(t)}};function to(e){return!e.compat||null==e.compat[ea.sdkName]||("string"==typeof e.compat[ea.sdkName]?((e,t,r)=>{try{t=new P(t,r)}catch{return!1}return t.test(e)})(((e,t)=>{if(e instanceof _)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=Q[Z.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),Q[Z.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;Q[Z.COERCERTL].lastIndex=-1}else r=e.match(Q[Z.COERCE]);return null===r?null:((e,t)=>{if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof _)return e;if("string"!=typeof e||e.length>Y||!(t.loose?J[X.LOOSE]:J[X.FULL]).test(e))return null;try{return new _(e,t)}catch{return null}})(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)})(ea.version),e.compat[ea.sdkName]):!!e.compat[ea.sdkName])}function ta(e){let t=e?.extensions??[],r={},i=[];if(Array.isArray(t)?t.forEach(e=>{to(e)?(e.init(this),e.name&&(this[e.name]=e),eo(e.config)||(r[e.name]=e.config)):i.push(e)}):Object.keys(t).forEach(e=>{if(to(t[e])){t[e].init(this);let i=t[e];this[e]=i,eo(i.config)||(r[t[e].name]=i.config)}else i.push(t[e])}),i.length){let e;throw e=`Some extensions are incompatible with \`${ea.sdkName}@${ea.version}\`:`,i.filter(e=>"u">typeof e.compat&&null!==e.compat).forEach(t=>{let r=t.compat[ea.sdkName];"string"==typeof r?e+=` 11 - Extension \`${t.name}\` supports version(s) \`${r}\``:r||(e+=` 12 - Extension \`${t.name}\` does not support ${ea.platform} environments.`)}),new eh(n.E.IncompatibleExtensions,e)}return r}var tc=class e{constructor(e,t){if(this.apiKey=e,!e)throw new eh(n.E.MissingApiKey,"Please provide an API key that you acquired from the Magic developer dashboard.");"react-native"===ea.platform&&t?.endpoint&&new ed(n.QN.ReactNativeEndpointConfiguration,`CUSTOM DOMAINS ARE NOT SUPPORTED WHEN USING MAGIC SDK WITH REACT NATIVE! The \`endpoint\` parameter SHOULD NOT be provided. The Magic \`<iframe>\` is automatically wrapped by a WebView pointed at \`${ea.defaultEndpoint}\`. Changing this default behavior will lead to unexpected results and potentially security-threatening bugs.`).log();let{defaultEndpoint:r,version:i}=ea;this.testMode=!!t?.testMode,this.useStorageCache=!!t?.useStorageCache,this.endpoint=e9(t?.endpoint??r).origin,this.auth=new eZ(this),this.user=new e7(this),this.wallet=new te(this),this.nft=new ts(this),this.thirdPartyWallets=new tt(this),this.rpcProvider=new tn(this);let s=ta.call(this,t);this.parameters=er({API_KEY:this.apiKey,DOMAIN_ORIGIN:"u">typeof window&&window?.location?window?.location.origin:"",ETH_NETWORK:t?.network,host:e9(this.endpoint).host,sdk:el[ea.sdkName],version:i,ext:eo(s)?void 0:s,locale:t?.locale||"en_US",authConfig:t?.authConfig?{...t.authConfig}:void 0,...ea.bundleId?{bundleId:ea.bundleId}:{},meta:t?.meta}),this.networkHash=function(e,t,r){return t||r?r?`${e}_${JSON.stringify(r)}`:t?"string"==typeof t?`${e}_eth_${t}`:`${e}_${t.rpcUrl}_${t.chainId}_${t.chainType}`:`${e}_unknown`:`${e}_eth_mainnet`}(this.apiKey,t?.network,eo(s)?void 0:s),t?.deferPreload||this.preload()}static __overlays__=new Map;endpoint;parameters;networkHash;testMode;useStorageCache;auth;user;wallet;nft;thirdPartyWallets;rpcProvider;get overlay(){if(!e.__overlays__.has(this.parameters)){let t=new ea.ViewController(this.endpoint,this.parameters,this.networkHash);
12t.init(),t.onThirdPartyWalletRequest(e=>this.thirdPartyWallets.handleIframeThirdPartyWalletRequest(e)),e.__overlays__.set(this.parameters,t)}return e.__overlays__.get(this.parameters)}async preload(){await this.overlay.waitForReady()}},tl=class{constructor(e,t,r){this.endpoint=e,this.parameters=t,this.networkHash=r,this.listen()}isReadyForRequest=!1;messageHandlers=new Set;isConnectedToInternet=!0;lastPongTime=null;heartbeatIntervalTimer=null;heartbeatDebounce=(function(e,t){let r=null;return function(...t){r&&clearTimeout(r),r=setTimeout(()=>{e(...t)},36e5)}})(()=>{"https://auth.magic.link/"===this.endpoint&&this.heartBeatCheck()},36e5);thirdPartyWalletRequestHandler=()=>{};async post(e,t){return eJ(async(r,i)=>{this.isConnectedToInternet||i(eg()),await this.checkRelayerExistsInDOM()||(this.isReadyForRequest=!1,await this.reloadRelayer()),this.isReadyForRequest||await this.waitForReady();let s=[],o=Array.isArray(t)?t.map(e=>e.id):[],a=await this.createMagicRequest(`${e}-${this.parameters}`,t,this.networkHash);await this._post(a);let c=e=>i=>{let n,a,{id:c,response:l}=(n=i.data.response?.id,a=n&&Array.isArray(t)?t.find(e=>e.id===n):t,n&&a?{id:n,response:new eH(a).applyResult(i.data.response.result).applyError(i.data.response.error)}:{});if(this.persistMagicEventRefreshToken(i),l?.payload.error?.message==="User denied account access.")e1();else if(i.data.deviceShare){let{deviceShare:e}=i.data;e6(e,this.networkHash)}c&&l&&Array.isArray(t)&&o.includes(c)?(s.push(l),s.length===t.length&&(e(),r(s))):c&&l&&!Array.isArray(t)&&c===t.id&&(e(),r(l))},l=this.on(n.rK.MAGIC_HANDLE_RESPONSE,c(()=>l()))})}async postThirdPartyWalletResponse(e){return eJ(async(t,r)=>{this.isConnectedToInternet||r(eg()),await this.checkRelayerExistsInDOM()||(this.isReadyForRequest=!1,await this.reloadRelayer()),this.isReadyForRequest||await this.waitForReady();let i={msgType:`${n.F8.MAGIC_THIRD_PARTY_WALLET_RESPONSE}-${this.parameters}`,response:e};await this._post(i),t()})}async postThirdPartyWalletUpdate(e){return eJ(async(t,r)=>{this.isConnectedToInternet||r(eg()),await this.checkRelayerExistsInDOM()||(this.isReadyForRequest=!1,await this.reloadRelayer()),this.isReadyForRequest||await this.waitForReady();let i=JSON.parse(JSON.stringify(e,(e,t)=>"function"==typeof t?void 0:t)),s={msgType:`${n.F8.MAGIC_THIRD_PARTY_WALLET_UPDATE}-${this.parameters}`,details:i};await this._post(s),t()})}on(e,t){let r=t.bind(window),i=t=>{t.data.msgType===`${e}-${this.parameters}`&&r(t)};return this.messageHandlers.add(i),()=>this.messageHandlers.delete(i)}waitForReady(){return new Promise(e=>{let t=this.on(n.rK.MAGIC_OVERLAY_READY,()=>{this.isReadyForRequest=!0,e(),t()})})}onThirdPartyWalletRequest(e){this.thirdPartyWalletRequestHandler=e}listen(){this.on(n.rK.MAGIC_HIDE_OVERLAY,()=>{this.hideOverlay()}),this.on(n.rK.MAGIC_SHOW_OVERLAY,()=>{this.showOverlay()}),this.on(n.rK.MAGIC_SEND_PRODUCT_ANNOUNCEMENT,e=>{e.data.response.result.product_announcement&&new ed(n.QN.ProductAnnouncement,e.data.response.result.product_announcement).log()})}heartBeatCheck(){let e=!0,t=async()=>{let e={msgType:`${n.F8.MAGIC_PING}-${this.parameters}`,payload:[]};await this._post(e)};this.heartbeatIntervalTimer=setInterval(async()=>{if(this.lastPongTime){if(Date.now()-this.lastPongTime>6e5){this.reloadRelayer(),e=!0;return}}else if(!e){this.reloadRelayer(),e=!0;return}await t(),e=!1},3e5)}stopHeartBeat(){this.heartbeatDebounce(),this.lastPongTime=null,this.heartbeatIntervalTimer&&(clearInterval(this.heartbeatIntervalTimer),this.heartbeatIntervalTimer=null)}async persistMagicEventRefreshToken(e){e.data.rt&&await eE("rt",e.data.rt)}async createMagicRequest(e,t,r){let i={msgType:e,payload:t},n=await this.getRT(),s=await this.getJWT(),o=await this.getDecryptedDeviceShare(r);return s&&(i.jwt=s),s&&n&&(i.rt=n),o&&(i.deviceShare=o),i}async getJWT(){if("web"!==ea.platform)return null;try{return await ex("jwt")||await ek()}catch(e){return console.error("webcrypto error",e),null}}async getRT(){return await ex("rt")}async getDecryptedDeviceShare(e){return await e4(e)}},th=["request","overlay","sdk"],tu=class extends eX{compat;__sdk_access_field_descriptors__=new Map;__is_initialized__=!1;utils={createPromiEvent:eY,isPromiEvent:eG,encodeJSON:er,decodeJSON:ei,createJsonRpcRequestPayload:eq,standardizeJsonRpcRequestPayload:ez,storage:ew};constructor(){super(void 0);let e=[this,...function(e){let t=Object.getPrototypeOf(e),r=[t];for(;t&&t!==eX.prototype;)r.push(t=Object.getPrototypeOf(t));return r}(this)];th.forEach(t=>{let r=e.map(e=>Object.getOwnPropertyDescriptor(e,t)),i=r.findIndex(e=>!!e),s=r[i];s&&(this.__sdk_access_field_descriptors__.set(t,{descriptor:s,isPrototypeField:i>
120}),Object.defineProperty(this,t,{configurable:!0,get:()=>{throw function(e){return new eh(n.E.ExtensionNotInitialized,`Extensions must be initialized with a Magic SDK instance before \`Extension.${e}\` can be accessed. Do not invoke \`Extension.${e}\` inside an extension constructor.`)}(t)}}))})}init(e){this.__is_initialized__||(th.forEach(e=>{if(this.__sdk_access_field_descriptors__.has(e)){let{descriptor:t,isPrototypeField:r}=this.__sdk_access_field_descriptors__.get(e);r?delete this[e]:Object.defineProperty(this,e,t)}}),this.sdk=e,this.__is_initialized__=!0)}createDeprecationWarning(e){let{method:t,removalVersion:r,useInstead:i}=e,n=i?` Use \`${i}\` instead.`:"";return new ep(this,"DEPRECATION_NOTICE",`\`${t}\` will be removed from this Extension in version \`${r}\`.${n}`)}createWarning(e,t){return new ep(this,e,t)}createError(e,t,r){return new ef(this,e,t,r)}},td=class extends tu{},tf=class{static Internal=td}},20852:(e,t,r)=>{"use strict";r.d(t,{Cq:()=>tv,FA:()=>tE,TZ:()=>tx,UF:()=>tw});var i=r(5566),n=r(25042);function s(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function o(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}let a="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,c=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);function l(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(e)),s(e),e}class h{clone(){return this._cloneInto()}}function u(e=32){if(a&&"function"==typeof a.getRandomValues)return a.getRandomValues(new Uint8Array(e));if(a&&"function"==typeof a.randomBytes)return a.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}
12class d extends h{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=c(this.buffer)}update(e){o(this);let{view:t,buffer:r,blockLen:i}=this,n=(e=l(e)).length;for(let s=0;s<n;){let o=Math.min(i-this.pos,n-s);if(o===i){let t=c(e);for(;i<=n-s;s+=i)this.process(t,s);continue}r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){o(this),function(e,t){s(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:i,isLE:n}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>i-a&&(this.process(r,0),a=0);for(let e=a;e<i;e++)t[e]=0;(function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(0xffffffff),o=Number(r>>n&s),a=Number(r&s),c=4*!!i,l=4*!i;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)})(r,i-8,BigInt(8*this.length),n),this.process(r,0);let l=c(e),h=this.outputLen;if(h%4)throw Error("_sha2: outputLen should be aligned to 32bit");let u=h/4,d=this.get();if(u>d.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)l.setUint32(4*e,d[e],n)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:i,finished:n,destroyed:s,pos:o}=this;return e.length=i,e.pos=o,e.finished=n,e.destroyed=s,i%t&&e.buffer.set(r),e}}let f=BigInt(0x100000000-1),p=BigInt(32),g={split:function(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let n=0;n<e.length;n++){let{h:s,l:o}=function(e,t=!1){return t?{h:Number(e&f),l:Number(e>>p&f)}:{h:0|Number(e>>p&f),l:0|Number(e&f)}}(e[n],t);[r[n],i[n]]=[s,o]}return[r,i]},shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,add:function(e,t,r,i){let n=(t>>
12>0)+(i>>>0);return{h:e+r+(n/0x100000000|0)|0,l:0|n}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,i)=>t+r+i+(e/0x100000000|0)|0,add4L:(e,t,r,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0),add4H:(e,t,r,i,n)=>t+r+i+n+(e/0x100000000|0)|0,add5H:(e,t,r,i,n,s)=>t+r+i+n+s+(e/0x100000000|0)|0,add5L:(e,t,r,i,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0)+(n>>>0)},[m,y]=g.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
125771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),b=new Uint32Array(80),w=new Uint32Array(80);class v extends d{constructor(){super(128,64,16,!1),this.Ah=0x6a09e667,this.Al=-0xc4336f8,this.Bh=-0x4498517b,this.Bl=-0x7b3558c5,this.Ch=0x3c6ef372,this.Cl=-0x16b07d5,this.Dh=-0x5ab00ac6,this.Dl=0x5f1d36f1,this.Eh=0x510e527f,this.El=-0x52197d2f,this.Fh=-0x64fa9774,this.Fl=0x2b3e6c1f,this.Gh=0x1f83d9ab,this.Gl=-0x4be4295,this.Hh=0x5be0cd19,this.Hl=0x137e2179}get(){let{Ah:e,Al:t,Bh:r,Bl:i,Ch:n,Cl:s,Dh:o,Dl:a,Eh:c,El:l,Fh:h,Fl:u,Gh:d,Gl:f,Hh:p,Hl:g}=this;return[e,t,r,i,n,s,o,a,c,l,h,u,d,f,p,g]}set(e,t,r,i,n,s,o,a,c,l,h,u,d,f,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|i,this.Ch=0|n,this.Cl=0|s,this.Dh=0|o,this.Dl=0|a,this.Eh=0|c,this.El=0|l,this.Fh=0|h,this.Fl=0|u,this.Gh=0|d,this.Gl=0|f,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)b[r]=e.getUint32(t),w[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|b[e-15],r=0|w[e-15],i=g.rotrSH(t,r,1)^g.rotrSH(t,r,8)^g.shrSH(t,r,7),n=g.rotrSL(t,r,1)^g.rotrSL(t,r,8)^g.shrSL(t,r,7),s=0|b[e-2],o=0|w[e-2],a=g.rotrSH(s,o,19)^g.rotrBH(s,o,61)^g.shrSH(s,o,6),c=g.rotrSL(s,o,19)^g.rotrBL(s,o,61)^g.shrSL(s,o,6),l=g.add4L(n,c,w[e-7],w[e-16]),h=g.add4H(l,i,a,b[e-7],b[e-16]);b[e]=0|h,w[e]=0|l}let{Ah:r,Al:i,Bh:n,Bl:s,Ch:o,Cl:a,Dh:c,Dl:l,Eh:h,El:u,Fh:d,Fl:f,Gh:p,Gl:v,Hh:x,Hl:E}=this;for(let e=0;e<80;e++){let t=g.rotrSH(h,u,14)^g.rotrSH(h,u,18)^g.rotrBH(h,u,41),_=g.rotrSL(h,u,14)^g.rotrSL(h,u,18)^g.rotrBL(h,u,41),I=h&d^~h&p,A=u&f^~u&v,S=g.add5L(E,_,A,y[e],w[e]),C=g.add5H(S,x,t,I,m[e],b[e]),N=0|S,O=g.rotrSH(r,i,28)^g.rotrBH(r,i,34)^g.rotrBH(r,i,39),P=g.rotrSL(r,i,28)^g.rotrBL(r,i,34)^g.rotrBL(r,i,39),T=r&n^r&o^n&o,M=i&s^i&a^s&a;x=0|p,E=0|v,p=0|d,v=0|f,d=0|h,f=0|u,({h:h,l:u}=g.add(0|c,0|l,0|C,0|N)),c=0|o,l=0|a,o=0|n,a=0|s,n=0|r,s=0|i;let R=g.add3L(N,P,M);r=g.add3H(R,C,O,T),i=0|R}({h:r,l:i}=g.add(0|this.Ah,0|this.Al,0|r,0|i)),({h:n,l:s}=g.add(0|this.Bh,0|this.Bl,0|n,0|s)),({h:o,l:a}=g.add(0|this.Ch,0|this.Cl,0|o,0|a)),({h:c,l:l}=g.add(0|this.Dh,0|this.Dl,0|c,0|l)),({h:h,l:u}=g.add(0|this.Eh,0|this.El,0|h,0|u)),({h:d,l:f}=g.add(0|this.Fh,0|this.Fl,0|d,0|f)),({h:p,l:v}=g.add(0|this.Gh,0|this.Gl,0|p,0|v)),({h:x,l:E}=g.add(0|this.Hh,0|this.Hl,0|x,0|E)),this.set(r,i,n,s,o,a,c,l,h,u,d,f,p,v,x,E)}roundClean(){b.fill(0),w.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}let x=function(e){let t=t=>e().update(l(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}(()=>new v),E=BigInt(0),_=BigInt(1),I=BigInt(2);function A(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function S(e){if(!A(e))throw Error("Uint8Array expected")}function C(e,t){if("boolean"!=typeof t)throw Error(e+" boolean expected, got "+t)}let N=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function O(e){S(e);let t="";for(let r=0;r<e.length;r++)t+=N[e[r]];return t}function P(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?E:BigInt("0x"+e)}let T={_0:48,_9:57,A:65,F:70,a:97,f:102};function M(e){return e>=T._0&&e<=T._9?e-T._0:e>=T.A&&e<=T.F?e-(T.A-10):e>=T.a&&e<=T.f?e-(T.a-10):void 0}function R(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let i=new Uint8Array(r);for(let t=0,n=0;t<r;t++,n+=2){let r=M(e.charCodeAt(n)),s=M(e.charCodeAt(n+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[n]+e[n+1])+'" at index '+n);i[t]=16*r+s}return i}function k(e){return S(e),P(O(Uint8Array.from(e).reverse()))}function D(e,t){return R(e.toString(16).padStart(2*t,"0"))}function L(e,t){return D(e,t).reverse()}function U(e,t,r){let i;if("string"==typeof t)try{i=R(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if(A(t))i=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let n=i.length;if("number"==typeof r&&n!==r)throw Error(e+" of length "+r+" expected, got "+n);return i}function B(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];S(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){let n=e[t];r.set(n,i),i+=n.length}return r}let j=e=>"bigint"==typeof e&&E<=e;
12function $(e,t,r,i){if(!(j(t)&&j(r)&&j(i))||!(r<=t)||!(t<i))throw Error("expected valid "+e+": "+r+" <= n < "+i+", got "+t)}let z={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||A(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function q(e,t,r={}){let i=(t,r,i)=>{let n=z[r];if("function"!=typeof n)throw Error("invalid validator function");let s=e[t];if(!(i&&void 0===s)&&!n(s,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))i(e,r,!1);for(let[e,t]of Object.entries(r))i(e,t,!0);return e}function H(e){let t=new WeakMap;return(r,...i)=>{let n=t.get(r);if(void 0!==n)return n;let s=e(r,...i);return t.set(r,s),s}}let F=BigInt(0),W=BigInt(1),V=BigInt(2),K=BigInt(3),G=BigInt(4),Y=BigInt(5),J=BigInt(8);function X(e,t){let r=e%t;return r>=F?r:t+r}function Q(e,t,r){let i=e;for(;t-- >F;)i*=i,i%=r;return i}function Z(e,t){if(e===F)throw Error("invert: expected non-zero number");if(t<=F)throw Error("invert: expected positive modulus, got "+t);let r=X(e,t),i=t,n=F,s=W;for(;r!==F;){let e=i/r,t=i%r,o=n-s*e;i=r,r=t,n=s,s=o}if(i!==W)throw Error("invert: does not exist");return X(n,t)}let ee=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function et(e,t){let r=void 0!==t?t:e.toString(2).length,i=Math.ceil(r/8);return{nBitLength:r,nByteLength:i}}function er(e,t,r=!1,i={}){let n;if(e<=F)throw Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:s,nByteLength:o}=et(e,t);if(o>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let a=Object.freeze({ORDER:e,isLE:r,BITS:s,BYTES:o,MASK:(I<<BigInt(s-1))-_,ZERO:F,ONE:W,create:t=>X(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return F<=t&&t<e},is0:e=>e===F,isOdd:e=>(e&W)===W,neg:t=>X(-t,e),eql:(e,t)=>e===t,sqr:t=>X(t*t,e),add:(t,r)=>X(t+r,e),sub:(t,r)=>X(t-r,e),mul:(t,r)=>X(t*r,e),pow:(e,t)=>(function(e,t,r){if(r<F)throw Error("invalid exponent, negatives unsupported");if(r===F)return e.ONE;if(r===W)return t;let i=e.ONE,n=t;for(;r>F;)r&W&&(i=e.mul(i,n)),n=e.sqr(n),r>>=W;return i})(a,e,t),div:(t,r)=>X(t*Z(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>Z(t,e),sqrt:i.sqrt||(t=>(n||(n=function(e){if(e%G===K){let t=(e+W)/G;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}if(e%J===Y){let t=(e-Y)/J;return function(e,r){let i=e.mul(r,V),n=e.pow(i,t),s=e.mul(r,n),o=e.mul(e.mul(s,V),n),a=e.mul(s,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),r))throw Error("Cannot find square root");return a}}return function(e){let t,r,i,n=(e-W)/V;for(t=e-W,r=0;t%V===F;t/=V,r++);for(i=V;i<e&&function(e,t,r){if(t<F)throw Error("invalid exponent, negatives unsupported");if(r<=F)throw Error("invalid modulus");if(r===W)return F;let i=W;for(;t>F;)t&W&&(i=i*e%r),e=e*e%r,t>>=W;return i}(i,n,e)!==e-W;i++)if(i>1e3)throw Error("Cannot find square root: likely non-prime P");if(1===r){let t=(e+W)/G;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}let s=(t+W)/V;return function(e,o){if(e.pow(o,n)===e.neg(e.ONE))throw Error("Cannot find square root");let a=r,c=e.pow(e.mul(e.ONE,i),t),l=e.pow(o,s),h=e.pow(o,t);for(;!e.eql(h,e.ONE);){if(e.eql(h,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(h);t<a&&!e.eql(r,e.ONE);t++)r=e.sqr(r);let r=e.pow(c,W<<BigInt(a-t-1));c=e.sqr(r),l=e.mul(l,r),h=e.mul(h,c),a=t}return l}}(e)}(e)),n(a,t))),invertBatch:e=>(function(e,t){let r=Array(t.length),i=t.reduce((t,i,n)=>e.is0(i)?t:(r[n]=t,e.mul(t,i)),e.ONE),n=e.inv(i);return t.reduceRight((t,i,n)=>e.is0(i)?t:(r[n]=e.mul(t,r[n]),e.mul(t,i)),n),r})(a,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?L(e,o):D(e,o),fromBytes:e=>{if(e.length!==o)throw Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);return r?k(e):P(O(e))}});return Object.freeze(a)}let ei=BigInt(0),en=BigInt(1);function es(e,t){let r=t.negate();return e?r:t}function eo(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function ea(e,t){return eo(e,t),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}let ec=new WeakMap,el=new WeakMap;function eh(e){return el.get(e)||1}let eu=BigInt(0),ed=BigInt(1),ef=BigInt(2),ep=BigInt(8),eg={zip215:!0};BigInt(0),BigInt(1);let em=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ey=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);let eb=BigInt(1),ew=BigInt(2);BigInt(3);let ev=BigInt(5),ex=BigInt(8),eE=er(em,void 0,!0),e_=function(e){var t;let r=function(e){let t=(q(e.Fp,ee.reduce((e,t)=>
12(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),q(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...et(e.n,e.nBitLength),...e,p:e.Fp.ORDER}));return q(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:i,n:n,prehash:s,hash:o,randomBytes:a,nByteLength:c,h:l}=r,h=ef<<BigInt(8*c)-ed,u=i.create,d=er(r.n,r.nBitLength),f=r.uvRatio||((e,t)=>{try{return{isValid:!0,value:i.sqrt(e*i.inv(t))}}catch{return{isValid:!1,value:eu}}}),p=r.adjustScalarBytes||(e=>e),g=r.domain||((e,t,r)=>{if(C("phflag",r),t.length||r)throw Error("Contexts/pre-hash are not supported");return e});function m(e,t){$("coordinate "+e,t,eu,h)}function y(e){if(!(e instanceof v))throw Error("ExtendedPoint expected")}let b=H((e,t)=>{let{ex:r,ey:n,ez:s}=e,o=e.is0();null==t&&(t=o?ep:i.inv(s));let a=u(r*t),c=u(n*t),l=u(s*t);if(o)return{x:eu,y:ed};if(l!==ed)throw Error("invZ was invalid");return{x:a,y:c}}),w=H(e=>{let{a:t,d:i}=r;if(e.is0())throw Error("bad point: ZERO");let{ex:n,ey:s,ez:o,et:a}=e,c=u(n*n),l=u(s*s),h=u(o*o),d=u(h*h),f=u(c*t);if(u(h*u(f+l))!==u(d+u(i*u(c*l))))throw Error("bad point: equation left != right (1)");if(u(n*s)!==u(o*a))throw Error("bad point: equation left != right (2)");return!0});
12class v{constructor(e,t,r,i){this.ex=e,this.ey=t,this.ez=r,this.et=i,m("x",e),m("y",t),m("z",r),m("t",i),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof v)throw Error("extended point not allowed");let{x:t,y:r}=e||{};return m("x",t),m("y",r),new v(t,r,ed,u(t*r))}static normalizeZ(e){let t=i.invertBatch(e.map(e=>e.ez));return e.map((e,r)=>e.toAffine(t[r])).map(v.fromAffine)}static msm(e,t){return function(e,t,r,i){if(function(e,t){if(!Array.isArray(e))throw Error("array expected");e.forEach((e,r)=>{if(!(e instanceof t))throw Error("invalid point at index "+r)})}(r,e),function(e,t){if(!Array.isArray(e))throw Error("array of scalars expected");e.forEach((e,r)=>{if(!t.isValid(e))throw Error("invalid scalar at index "+r)})}(i,t),r.length!==i.length)throw Error("arrays of points and scalars must have equal length");let n=e.ZERO,s=function(e){let t;for(t=0;e>E;e>>=_,t+=1);return t}(BigInt(r.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=(1<<o)-1,c=Array(a+1).fill(n),l=Math.floor((t.BITS-1)/o)*o,h=n;for(let e=l;e>=0;e-=o){c.fill(n);for(let t=0;t<i.length;t++){let n=Number(i[t]>>BigInt(e)&BigInt(a));c[n]=c[n].add(r[t])}let t=n;for(let e=c.length-1,r=n;e>0;e--)r=r.add(c[e]),t=t.add(r);if(h=h.add(t),0!==e)for(let e=0;e<o;e++)h=h.double()}return h}(v,d,e,t)}_setWindowSize(e){A.setWindowSize(this,e)}assertValidity(){w(this)}equals(e){y(e);let{ex:t,ey:r,ez:i}=this,{ex:n,ey:s,ez:o}=e,a=u(t*o),c=u(n*i),l=u(r*o),h=u(s*i);return a===c&&l===h}is0(){return this.equals(v.ZERO)}negate(){return new v(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:e}=r,{ex:t,ey:i,ez:n}=this,s=u(t*t),o=u(i*i),a=u(ef*u(n*n)),c=u(e*s),l=t+i,h=u(u(l*l)-s-o),d=c+o,f=d-a,p=c-o,g=u(h*f),m=u(d*p),y=u(h*p);return new v(g,m,u(f*d),y)}add(e){y(e);let{a:t,d:i}=r,{ex:n,ey:s,ez:o,et:a}=this,{ex:c,ey:l,ez:h,et:d}=e;if(t===BigInt(-1)){let e=u((s-n)*(l+c)),t=u((s+n)*(l-c)),r=u(t-e);if(r===eu)return this.double();let i=u(o*ef*d),f=u(a*ef*h),p=f+i,g=t+e,m=f-i,y=u(p*r),b=u(g*m),w=u(p*m);return new v(y,b,u(r*g),w)}let f=u(n*c),p=u(s*l),g=u(a*i*d),m=u(o*h),b=u((n+s)*(c+l)-f-p),w=m-g,x=m+g,E=u(p-t*f),_=u(b*w),I=u(x*E),A=u(b*E);return new v(_,I,u(w*x),A)}subtract(e){return this.add(e.negate())}wNAF(e){return A.wNAFCached(this,e,v.normalizeZ)}multiply(e){$("scalar",e,ed,n);let{p:t,f:r}=this.wNAF(e);return v.normalizeZ([t,r])[0]}multiplyUnsafe(e,t=v.ZERO){return $("scalar",e,eu,n),e===eu?I:this.is0()||e===ed?this:A.wNAFCachedUnsafe(this,e,v.normalizeZ,t)}isSmallOrder(){return this.multiplyUnsafe(l).is0()}isTorsionFree(){return A.unsafeLadder(this,n).is0()}toAffine(e){return b(this,e)}clearCofactor(){let{h:e}=r;return e===ed?this:this.multiplyUnsafe(e)}static fromHex(e,t=!1){let{d:n,a:s}=r,o=i.BYTES;e=U("pointHex",e,o),C("zip215",t);let a=e.slice(),c=e[o-1];a[o-1]=-129&c;let l=k(a);$("pointHex.y",l,eu,t?h:i.ORDER);let d=u(l*l),{isValid:p,value:g}=f(u(d-ed),u(n*d-s));if(!p)throw Error("Point.fromHex: invalid y coordinate");let m=(g&ed)===ed,y=(128&c)!=0;if(!t&&g===eu&&y)throw Error("Point.fromHex: x=0 and x_0=1");return y!==m&&(g=u(-g)),v.fromAffine({x:g,y:l})}static fromPrivateKey(e){return S(e).point}toRawBytes(){let{x:e,y:t}=this.toAffine(),r=L(t,i.BYTES);return r[r.length-1]|=e&ed?128:0,r}toHex(){return O(this.toRawBytes())}}v.BASE=new v(r.Gx,r.Gy,ed,u(r.Gx*r.Gy)),v.ZERO=new v(eu,ed,ed,eu);let{BASE:x,ZERO:I}=v,A=(t=8*c,{constTimeNegate:es,hasPrecomputes:e=>1!==eh(e),unsafeLadder(e,t,r=v.ZERO){let i=e;for(;t>ei;)t&en&&(r=r.add(i)),i=i.double(),t>>=en;return r},precomputeWindow(e,r){let{windows:i,windowSize:n}=ea(r,t),s=[],o=e,a=o;for(let e=0;e<i;e++){a=o,s.push(a);for(let e=1;e<n;e++)a=a.add(o),s.push(a);o=a.double()}return s},wNAF(e,r,i){let{windows:n,windowSize:s}=ea(e,t),o=v.ZERO,a=v.BASE,c=BigInt(2**e-1),l=2**e,h=BigInt(e);for(let e=0;e<n;e++){let t=e*s,n=Number(i&c);i>>=h,n>s&&(n-=l,i+=en);let u=t+Math.abs(n)-1,d=e%2!=0,f=n<0;0===n?a=a.add(es(d,r[t])):o=o.add(es(f,r[u]))}return{p:o,f:a}},wNAFUnsafe(e,r,i,n=v.ZERO){let{windows:s,windowSize:o}=ea(e,t),a=BigInt(2**e-1),c=2**e,l=BigInt(e);for(let e=0;e<s;e++){let t=e*o;if(i===ei)break;let s=Number(i&a);if(i>>=l,s>o&&(s-=c,i+=en),0===s)continue;let h=r[t+Math.abs(s)-1];s<0&&(h=h.negate()),n=n.add(h)}return n},getPrecomputes(e,t,r){let i=ec.get(t);
12return i||(i=this.precomputeWindow(t,e),1!==e&&ec.set(t,r(i))),i},wNAFCached(e,t,r){let i=eh(e);return this.wNAF(i,this.getPrecomputes(i,e,r),t)},wNAFCachedUnsafe(e,t,r,i){let n=eh(e);return 1===n?this.unsafeLadder(e,t,i):this.wNAFUnsafe(n,this.getPrecomputes(n,e,r),t,i)},setWindowSize(e,r){eo(r,t),el.set(e,r),ec.delete(e)}});function S(e){let t=i.BYTES;e=U("private key",e,t);let r=U("hashed private key",o(e),2*t),s=p(r.slice(0,t)),a=r.slice(t,2*t),c=X(k(s),n),l=x.multiply(c),h=l.toRawBytes();return{head:s,prefix:a,scalar:c,point:l,pointBytes:h}}function N(e=new Uint8Array,...t){return X(k(o(g(B(...t),U("context",e),!!s))),n)}return x._setWindowSize(8),{CURVE:r,getPublicKey:function(e){return S(e).pointBytes},sign:function(e,t,r={}){e=U("message",e),s&&(e=s(e));let{prefix:o,scalar:a,pointBytes:c}=S(t),l=N(r.context,o,e),h=x.multiply(l).toRawBytes(),u=X(l+N(r.context,h,c,e)*a,n);return $("signature.s",u,eu,n),U("result",B(h,L(u,i.BYTES)),2*i.BYTES)},verify:function(e,t,r,n=eg){let o,a,c,{context:l,zip215:h}=n,u=i.BYTES;e=U("signature",e,2*u),t=U("message",t),r=U("publicKey",r,u),void 0!==h&&C("zip215",h),s&&(t=s(t));let d=k(e.slice(u,2*u));try{o=v.fromHex(r,h),a=v.fromHex(e.slice(0,u),h),c=x.multiplyUnsafe(d)}catch{return!1}if(!h&&o.isSmallOrder())return!1;let f=N(l,a.toRawBytes(),o.toRawBytes(),t);return a.add(o.multiplyUnsafe(f)).subtract(c).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:S,randomPrivateKey:()=>a(i.BYTES),precompute:(e=8,t=v.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}}({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:eE,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:ex,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:x,randomBytes:u,adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},uvRatio:function(e,t){let r=X(t*t*t,em),i=function(e){let t=BigInt(10),r=BigInt(20),i=BigInt(40),n=BigInt(80),s=e*e%em*e%em,o=Q(s,ew,em)*s%em,a=Q(o,eb,em)*e%em,c=Q(a,ev,em)*a%em,l=Q(c,t,em)*c%em,h=Q(l,r,em)*l%em,u=Q(h,i,em)*h%em,d=Q(u,n,em)*u%em,f=Q(d,n,em)*u%em,p=Q(f,t,em)*c%em;return{pow_p_5_8:Q(p,ew,em)*e%em,b2:s}}(e*X(r*r*t,em)).pow_p_5_8,n=X(e*r*i,em),s=X(t*n*n,em),o=n,a=X(n*ey,em),c=s===e,l=s===X(-e,em),h=s===X(-e*ey,em);return c&&(n=o),(l||h)&&(n=a),(X(n,em)&W)===W&&(n=X(-n,em)),{isValid:c||l,value:n}}}),eI="base64url",eA="utf8",eS="utf8",eC="base58btc";function eN(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function eO(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?eN(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function eP(e,t){t||(t=e.reduce((e,t)=>e+t.length,0));let r=eO(t),i=0;for(let t of e)r.set(t,i),i+=t.length;return eN(r)}var eT=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==r[o])throw TypeError(s+" is ambiguous");r[o]=n}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function u(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[0]){for(var i=0,n=0;e[t]===c;)i++,t++;for(var s=(e.length-t)*l+1>>>0,o=new Uint8Array(s);e[t];){var h=r[e.charCodeAt(t)];if(255===h)return;for(var u=0,d=s-1;(0!==h||u<n)&&-1!==d;d--,u++)h+=a*o[d]>>>0,o[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw Error("Non-zero carry");n=u,t++}if(" "!==e[t]){for(var f=s-n;f!==s&&0===o[f];)f++;for(var p=new Uint8Array(i+(s-f)),g=i;f!==s;)p[g++]=o[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*h+1>>>0,l=new Uint8Array(o);n!==s;){for(var u=t[n],d=0,f=o-1;(0!==u||d<i)&&-1!==f;f--,d++)u+=256*l[f]>>>0,l[f]=u%a>>>0,u=u/a>>>0;if(0!==u)throw Error("Non-zero carry");i=d,n++}for(var p=o-i;p!==o&&0===l[p];)p++;for(var g=c.repeat(r);p<o;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:u,decode:function(e){var r=u(e);if(r)return r;throw Error(`Non-${t} character`)}}};let eM=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error("Unknown type, must be binary type")};class eR{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class ek{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name}
12 decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return eL(this,e)}}class eD{constructor(e){this.decoders=e}or(e){return eL(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}let eL=(e,t)=>new eD({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class eU{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new eR(e,t,r),this.decoder=new ek(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let eB=({name:e,prefix:t,encode:r,decode:i})=>new eU(e,t,r,i),ej=({prefix:e,name:t,alphabet:r})=>{let{encode:i,decode:n}=eT(r,t);return eB({prefix:e,name:t,encode:i,decode:e=>eM(n(e))})},e$=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>eB({prefix:t,name:e,encode:e=>((e,t,r)=>{let i="="===t[t.length-1],n=(1<<r)-1,s="",o=0,a=0;for(let i=0;i<e.length;++i)for(a=a<<8|e[i],o+=8;o>r;)o-=r,s+=t[n&a>>o];if(o&&(s+=t[n&a<<r-o]),i)for(;s.length*r&7;)s+="=";return s})(e,i,r),decode:t=>((e,t,r,i)=>{let n={};for(let e=0;e<t.length;++e)n[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;let o=new Uint8Array(s*r/8|0),a=0,c=0,l=0;for(let t=0;t<s;++t){let s=n[e[t]];if(void 0===s)throw SyntaxError(`Non-${i} character`);c=c<<r|s,(a+=r)>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw SyntaxError("Unexpected end of data");return o})(t,i,r,e)});var ez=Object.freeze({__proto__:null,identity:eB({prefix:"\0",name:"identity",encode:e=>new TextDecoder().decode(e),decode:e=>new TextEncoder().encode(e)})}),eq=Object.freeze({__proto__:null,base2:e$({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})}),eH=Object.freeze({__proto__:null,base8:e$({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})}),eF=Object.freeze({__proto__:null,base10:ej({prefix:"9",name:"base10",alphabet:"0123456789"})}),eW=Object.freeze({__proto__:null,base16:e$({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper:e$({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});let eV=e$({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),eK=e$({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),eG=e$({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),eY=e$({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),eJ=e$({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),eX=e$({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),eQ=e$({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5});var eZ=Object.freeze({__proto__:null,base32:eV,base32upper:eK,base32pad:eG,base32padupper:eY,base32hex:eJ,base32hexupper:eX,base32hexpad:eQ,base32hexpadupper:e$({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z:e$({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}),e0=Object.freeze({__proto__:null,base36:ej({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper:ej({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})}),e1=Object.freeze({__proto__:null,base58btc:ej({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr:ej({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});let e2=e$({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),e3=e$({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6});var e8=Object.freeze({__proto__:null,base64:e2,base64pad:e3,base64url:e$({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad:e$({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});let e5=Array.from("\uD83D\uDE80\uD83E\uDE90â\uD83D\uDEF0\uD83C\uDF0C\uD83C\uDF11\uD83C\uDF12\uD83C\uDF13\uD83C\uDF14\uD83C\uDF15\uD83C\uDF16\uD83C\uDF17\uD83C\uDF18\uD83C\uDF0D\uD83C\uDF0F\uD83C\uDF0E\uD83D\uDC09â\uD83D\uDCBB\uD83D\uDDA5\uD83D\uDCBE\uD83D\uDCBF\uD83D\uDE02â¤\uD83D\uDE0D\uD83E\uDD23\uD83D\uDE0A\uD83D\uDE4F\uD83D\uDC95\uD83D\uDE2D\uD83D\uDE18\uD83D\uDC4D\uD83D\uDE05\uD83D\uDC4F\uD83D\uDE01\uD83D\uDD25\uD83E\uDD70\uD83D\uDC94\uD83D\uDC96\uD83D\uDC99\uD83D\uDE22\uD83E\uDD14\uD83D\uDE06\uD83D\uDE44\uD83D\uDCAA\uD83D\uDE09âº\uD83D\uDC4C\uD83E\uDD17\uD83D\uDC9C\uD83D\uDE14\uD83D\uDE0E\uD83D\uDE07\uD83C\uDF39\uD83E\uDD26\uD83C\uDF89\uD83D\uDC9Eââ¨\uD83E\uDD37\uD83D\uDE31\uD83D\uDE0C\uD83C\uDF38\uD83D\uDE4C\uD83D\uDE0B\uD83D\uDC97\uD83D\uDC9A\uD83D\uDE0F\uD83D\uDC9B\uD83D\uDE42\uD83D\uDC93\uD83E\uDD29\uD83D\uDE04\uD83D\uDE00\uD83D\uDDA4\uD83D\uDE03\uD83D\uDCAF\uD83D\uDE48\uD83D\uDC47\uD83C\uDFB6\uD83D\uDE12\uD83E\uDD2Dâ£\uD83D\uDE1C\uD83D\uDC8B\uD83D\uDC40\uD83D\uDE2A\uD83D\uDE11\uD83D\uDCA5\uD83D\uDE4B\uD83D\uDE1E\uD83D\uDE29\uD83D\uDE21\uD83E\uDD2A\uD83D\uDC4A\uD83E\uDD73\uD83D\uDE25\uD83E\uDD24\uD83D\uDC49\uD83D\uDC83\uD83D\uDE33â\uD83D\uDE1A\uD83D\uDE1D\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE2C\uD83D\uDE43\uD83C\uDF40\uD83C\uDF37\uD83D\uDE3B\uD83D\uDE13ââ
\uD83E\uDD7A\uD83C\uDF08\uD83D\uDE08\uD83E\uDD18\uD83D\uDCA6â\uD83D\uDE23\uD83C\uDFC3\uD83D\uDC90â¹\uD83C\uDF8A\uD83D\uDC98\uD83D\uDE20â\uD83D\uDE15\uD83C\uDF3A\uD83C\uDF82\uD83C\uDF3B\uD83D\uDE10\uD83D\uDD95\uD83D\uDC9D\uD83D\uDE4A\uD83D\uDE39\uD83D\uDDE3\uD83D\uDCAB\uD83D\uDC80\uD83D\uDC51\uD83C\uDFB5\uD83E\uDD1E\uD83D\uDE1B\uD83D\uDD34\uD83D\uDE24\uD83C\uDF3C\uD83D\uDE2Bâ½\uD83E\uDD19â\uD83C\uDFC6\uD83E\uDD2B\uD83D\uDC48\uD83D\uDE2E\uD83D\uDE46\uD83C\uDF7B\uD83C\uDF43\uD83D\uDC36\uD83D\uDC81\uD83D\uDE32\uD83C\uDF3F\uD83E\uDDE1\uD83C\uDF81â¡\uD83C\uDF1E\uD83C\uDF88ââ\uD83D\uDC4B\uD83D\uDE30\uD83E\uDD28\uD83D\uDE36\uD83E\uDD1D\uD83D\uDEB6\uD83D\uDCB0\uD83C\uDF53\uD83D\uDCA2\uD83E\uDD1F\uD83D\uDE41\uD83D\uDEA8\uD83D\uDCA8\uD83E\uDD2Câ\uD83C\uDF80\uD83C\uDF7A\uD83E\uDD13\uD83D\uDE19\uD83D\uDC9F\uD83C\uDF31\uD83D\uDE16\uD83D\uDC76\uD83E\uDD74â¶â¡â\uD83D\uDC8E\uD83D\uDCB8â¬\uD83D\uDE28\uD83C\uDF1A\uD83E\uDD8B\uD83D\uDE37\uD83D\uDD7Aâ \uD83D\uDE45\uD83D\uDE1F\uD83D\uDE35\uD83D\uDC4E\uD83E\uDD32\uD83E\uDD20\uD83E\uDD27\uD83D\uDCCC\uD83D\uDD35\uD83D\uDC85\uD83E\uDDD0\uD83D\uDC3E\uD83C\uDF52\uD83D\uDE17\uD83E\uDD11\uD83C\uDF0A\uD83E\uDD2F\uD83D\uDC37â\uD83D\uDCA7\uD83D\uDE2F\uD83D\uDC86\uD83D\uDC46\uD83C\uDFA4\uD83D\uDE47\uD83C\uDF51â\uD83C\uDF34\uD83D\uDCA3\uD83D\uDC38\uD83D\uDC8C\uD83D\uDCCD\uD83E\uDD40\uD83E\uDD22\uD83D\uDC45\uD83D\uDCA1\uD83D\uDCA9\uD83D\uDC50\uD83D\uDCF8\uD83D\uDC7B\uD83E\uDD10\uD83E\uDD2E\uD83C\uDFBC\uD83E\uDD75\uD83D\uDEA9\uD83C\uDF4E\uD83C\uDF4A\uD83D\uDC7C\uD83D\uDC8D\uD83D\uDCE3\uD83E\uDD42"),e6=e5.reduce((e,t,r)=>(e[r]=t,e),[]),e4=e5.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);var e9=Object.freeze({__proto__:null,base256emoji:eB({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>
12e+=e6[t],"")},decode:function(e){let t=[];for(let r of e){let e=e4[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}})});function e7(e,t,r){t=t||[],r=r||0;for(var i=r;e>=0x80000000;)t[r++]=255&e|128,e/=128;for(;-128&e;)t[r++]=255&e|128,e>>>=7;return t[r]=0|e,e7.bytes=r-i+1,t}var te={encode:e7,encodingLength:function(e){return e<128?1:e<16384?2:e<2097152?3:e<0x10000000?4:e<0x800000000?5:e<0x40000000000?6:e<0x2000000000000?7:e<0x100000000000000?8:e<0x8000000000000000?9:10}};let tt=(e,t,r=0)=>(te.encode(e,t,r),t),tr=e=>te.encodingLength(e),ti=(e,t)=>{let r=t.byteLength,i=tr(e),n=i+tr(r),s=new Uint8Array(n+r);return tt(e,s,0),tt(r,s,i),s.set(t,n),new tn(e,r,t,s)};class tn{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}let ts=({name:e,code:t,encode:r})=>new to(e,t,r);class to{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?ti(this.code,t):t.then(e=>ti(this.code,e))}throw Error("Unknown type, must be binary type")}}let ta=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));var tc=Object.freeze({__proto__:null,sha256:ts({name:"sha2-256",code:18,encode:ta("SHA-256")}),sha512:ts({name:"sha2-512",code:19,encode:ta("SHA-512")})}),tl=Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:eM,digest:e=>ti(0,eM(e))}});new TextEncoder,new TextDecoder;let th={...ez,...eq,...eH,...eF,...eW,...eZ,...e0,...e1,...e8,...e9};
12function tu(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}({...tc,...tl});let td=tu("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),tf=tu("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{let t=eO((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),tp={utf8:td,"utf-8":td,hex:th.base16,latin1:tf,ascii:tf,binary:tf,...th};function tg(e,t="utf8"){let r=tp[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}function tm(e,t="utf8"){let r=tp[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?eN(globalThis.Buffer.from(e,"utf-8")):r.decoder.decode(`${r.prefix}${e}`)}function ty(e){return(0,n.j)(tg(tm(e,eI),eA))}function tb(e){return tg(tm((0,n.h)(e),eA),eI)}function tw(e){return["did:key","z"+tg(eP([tm("K36",eC),e]),eC)].join(":")}function tv(e){let t=e.split("."),r=ty(t[0]),i=ty(t[1]);return{header:r,payload:i,signature:tm(t[2],eI),data:tm(t.slice(0,2).join("."),eS)}}function tx(e=u(32)){let t=e_.getPublicKey(e);return{secretKey:eP([e,t]),publicKey:t}}async function tE(e,t,r,n,s=(0,i.fromMiliseconds)(Date.now())){let o={alg:"EdDSA",typ:"JWT"},a={iss:tw(n.publicKey),sub:e,aud:t,iat:s,exp:s+r},c=tm([tb((l={header:o,payload:a}).header),tb(l.payload)].join("."),eS);var l,h={header:o,payload:a,signature:e_.sign(c,n.secretKey.slice(0,32))};return[tb(h.header),tb(h.payload),tg(h.signature,eI)].join(".")}},20920:(e,t,r)=>{"use strict";var i=r(3285);function n(e){return(e>>>24|e>>>8&65280|e<<8&0xff0000|(255&e)<<24)>>>0}function s(e){return 1===e.length?"0"+e:e}function o(e){if(7===e.length)return"0"+e;if(6===e.length)return"00"+e;if(5===e.length)return"000"+e;if(4===e.length)return"0000"+e;if(3===e.length)return"00000"+e;else if(2===e.length)return"000000"+e;else if(1===e.length)return"0000000"+e;else return e}t.inherits=r(43770),t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/ig,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var i=0,n=0;n<e.length;n++){var s,o,a=e.charCodeAt(n);a<128?r[i++]=a:(a<2048?r[i++]=a>>6|192:((s=e,o=n,(64512&s.charCodeAt(o))!=55296||o<0||o+1>=s.length?1:(64512&s.charCodeAt(o+1))!=56320)?r[i++]=a>>12|224:(a=65536+((1023&a)<<10)+(1023&e.charCodeAt(++n)),r[i++]=a>>18|240,r[i++]=a>>12&63|128),r[i++]=a>>6&63|128),r[i++]=63&a|128)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r},t.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=s(e[r].toString(16));return t},t.htonl=n,t.toHex32=function(e,t){for(var r="",i=0;i<e.length;i++){var s=e[i];"little"===t&&(s=n(s)),r+=o(s.toString(16))}return r},t.zero2=s,t.zero8=o,t.join32=function(e,t,r,n){var s,o=r-t;i(o%4==0);for(var a=Array(o/4),c=0,l=t;c<a.length;c++,l+=4)s="big"===n?e[l]<<24|e[l+1]<<16|e[l+2]<<8|e[l+3]:e[l+3]<<24|e[l+2]<<16|e[l+1]<<8|e[l],a[c]=s>>>0;return a},t.split32=function(e,t){for(var r=Array(4*e.length),i=0,n=0;i<e.length;i++,n+=4){var s=e[i];"big"===t?(r[n]=s>>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=255&s):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=255&s)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,i){return e+t+r+i>>>0},t.sum32_5=function(e,t,r,i,n){return e+t+r+i+n>>>0},t.sum64=function(e,t,r,i){var n=e[t],s=i+e[t+1]>>>0;e[t]=+(s<i)+r+n>>>0,e[t+1]=s},t.sum64_hi=function(e,t,r,i){return+(t+i>>>0<t)+e+r>>>0},t.sum64_lo=function(e,t,r,i){return t+i>>>0},t.sum64_4_hi=function(e,t,r,i,n,s,o,a){var c,l=t;return e+r+n+o+(c=0+ +((l=l+i>>>0)<t)+ +((l=l+s>>>0)<s)+ +((l=l+a>>>0)<a))>>>0},t.sum64_4_lo=function(e,t,r,i,n,s,o,a){return t+i+s+a>>>0},t.sum64_5_hi=function(e,t,r,i,n,s,o,a,c,l){var h,u=t;return e+r+n+o+c+(h=0+ +((u=u+i>>>0)<t)+ +((u=u+s>>>0)<s)+ +((u=u+a>>>0)<a)+ +((u=u+l>>>0)<l))>>>0},t.sum64_5_lo=function(e,t,r,i,n,s,o,a,c,l){return t+i+s+a+l>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>
12>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},22527:(e,t,r)=>{"use strict";r.d(t,{D0:()=>N,LH:()=>C,Tp:()=>P,dQ:()=>E,jr:()=>I,pS:()=>A,qy:()=>T,zH:()=>m,zi:()=>g});var i=r(5257),n=r(458);let s=BigInt(0),o=BigInt(1),a=BigInt(2),c=BigInt(3),l=BigInt(4),h=BigInt(5),u=BigInt(7),d=BigInt(8),f=BigInt(9),p=BigInt(16);function g(e,t){let r=e%t;return r>=s?r:t+r}function m(e,t,r){let i=e;for(;t-- >s;)i*=i,i%=r;return i}function y(e,t){if(e===s)throw Error("invert: expected non-zero number");if(t<=s)throw Error("invert: expected positive modulus, got "+t);let r=g(e,t),i=t,n=s,a=o,c=o,l=s;for(;r!==s;){let e=i/r,t=i%r,s=n-c*e,o=a-l*e;i=r,r=t,n=c,a=l,c=s,l=o}if(i!==o)throw Error("invert: does not exist");return g(n,t)}function b(e,t,r){if(!e.eql(e.sqr(t),r))throw Error("Cannot find square root")}function w(e,t){let r=(e.ORDER+o)/l,i=e.pow(t,r);return b(e,i,t),i}function v(e,t){let r=(e.ORDER-h)/d,i=e.mul(t,a),n=e.pow(i,r),s=e.mul(t,n),o=e.mul(e.mul(s,a),n),c=e.mul(s,e.sub(o,e.ONE));return b(e,c,t),c}function x(e){if(e<c)throw Error("sqrt is not defined for small field");let t=e-o,r=0;for(;t%a===s;)t/=a,r++;let i=a,n=N(e);for(;1===S(n,i);)if(i++>1e3)throw Error("Cannot find square root: probably non-prime P");if(1===r)return w;let l=n.pow(i,t),h=(t+o)/a;return function(e,i){if(e.is0(i))return i;if(1!==S(e,i))throw Error("Cannot find square root");let n=r,s=e.mul(e.ONE,l),a=e.pow(i,t),c=e.pow(i,h);for(;!e.eql(a,e.ONE);){if(e.is0(a))return e.ZERO;let t=1,r=e.sqr(a);for(;!e.eql(r,e.ONE);)if(t++,r=e.sqr(r),t===n)throw Error("Cannot find square root");let i=o<<BigInt(n-t-1),l=e.pow(s,i);n=t,s=e.sqr(l),a=e.mul(a,s),c=e.mul(c,l)}return c}}let E=(e,t)=>(g(e,t)&o)===o,_=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function I(e){let t=_.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"});return(0,i.DS)(e,t),e}function A(e,t,r=!1){let i=Array(t.length).fill(r?e.ZERO:void 0),n=t.reduce((t,r,n)=>e.is0(r)?t:(i[n]=t,e.mul(t,r)),e.ONE),s=e.inv(n);return t.reduceRight((t,r,n)=>e.is0(r)?t:(i[n]=e.mul(t,i[n]),e.mul(t,r)),s),i}function S(e,t){let r=(e.ORDER-o)/a,i=e.pow(t,r),n=e.eql(i,e.ONE),s=e.eql(i,e.ZERO),c=e.eql(i,e.neg(e.ONE));if(!n&&!s&&!c)throw Error("invalid Legendre symbol result");return n?1:s?0:-1}function C(e,t){void 0!==t&&(0,n.Fe)(t);let r=void 0!==t?t:e.toString(2).length,i=Math.ceil(r/8);return{nBitLength:r,nByteLength:i}}function N(e,t,r=!1,n={}){let a,m,E,_;if(e<=s)throw Error("invalid field: expected ORDER > 0, got "+e);let I=!1;if("object"==typeof t&&null!=t){if(n.sqrt||r)throw Error("cannot specify opts in two arguments");t.BITS&&(m=t.BITS),t.sqrt&&(E=t.sqrt),"boolean"==typeof t.isLE&&(r=t.isLE),"boolean"==typeof t.modFromBytes&&(I=t.modFromBytes),_=t.allowedLengths}else"number"==typeof t&&(m=t),n.sqrt&&(E=n.sqrt);let{nBitLength:S,nByteLength:O}=C(e,m);if(O>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let P=Object.freeze({ORDER:e,isLE:r,BITS:S,BYTES:O,MASK:(0,i.OG)(S),ZERO:s,ONE:o,allowedLengths:_,create:t=>g(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return s<=t&&t<e},is0:e=>e===s,isValidNot0:e=>!P.is0(e)&&P.isValid(e),isOdd:e=>(e&o)===o,neg:t=>g(-t,e),eql:(e,t)=>e===t,sqr:t=>g(t*t,e),add:(t,r)=>g(t+r,e),sub:(t,r)=>g(t-r,e),mul:(t,r)=>g(t*r,e),pow:(e,t)=>(function(e,t,r){if(r<s)throw Error("invalid exponent, negatives unsupported");if(r===s)return e.ONE;if(r===o)return t;let i=e.ONE,n=t;for(;r>s;)r&o&&(i=e.mul(i,n)),n=e.sqr(n),r>>=o;return i})(P,e,t),div:(t,r)=>g(t*y(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>y(t,e),sqrt:E||(t=>(a||(a=e%l===c?w:e%d===h?v:e%p===f?function(e){let t=N(e),r=x(e),i=r(t,t.neg(t.ONE)),n=r(t,i),s=r(t,t.neg(i)),o=(e+u)/p;return(e,t)=>{let r=e.pow(t,o),a=e.mul(r,i),c=e.mul(r,n),l=e.mul(r,s),h=e.eql(e.sqr(a),t),u=e.eql(e.sqr(c),t);r=e.cmov(r,a,h),a=e.cmov(l,c,u);let d=e.eql(e.sqr(a),t),f=e.cmov(r,a,d);return b(e,f,t),f}}(e):x(e)),a(P,t))),toBytes:e=>r?(0,i.z)(e,O):(0,i.lq)(e,O),fromBytes:(t,n=!0)=>
12{if(_){if(!_.includes(t.length)||t.length>O)throw Error("Field.fromBytes: expected "+_+" bytes, got "+t.length);let e=new Uint8Array(O);e.set(t,r?0:e.length-t.length),t=e}if(t.length!==O)throw Error("Field.fromBytes: expected "+O+" bytes, got "+t.length);let s=r?(0,i.lX)(t):(0,i.Ph)(t);if(I&&(s=g(s,e)),!n&&!P.isValid(s))throw Error("invalid field element: outside of range 0..ORDER");return s},invertBatch:e=>A(P,e),cmov:(e,t,r)=>r?t:e});return Object.freeze(P)}function O(e){if("bigint"!=typeof e)throw Error("field order must be bigint");return Math.ceil(e.toString(2).length/8)}function P(e){let t=O(e);return t+Math.ceil(t/2)}function T(e,t,r=!1){let n=e.length,s=O(t),a=P(t);if(n<16||n<a||n>1024)throw Error("expected "+a+"-1024 bytes of input, got "+n);let c=g(r?(0,i.lX)(e):(0,i.Ph)(e),t-o)+o;return r?(0,i.z)(c,s):(0,i.lq)(c,s)}},22633:(e,t,r)=>{"use strict";var i=r(20920),n=r(31e3);function s(){if(!(this instanceof s))return new s;n.call(this),this.h=[0xcbbb9d5d,0xc1059ed8,0x629a292a,0x367cd507,0x9159015a,0x3070dd17,0x152fecd8,0xf70e5939,0x67332667,0xffc00b31,0x8eb44a87,0x68581511,0xdb0c2e0d,0x64f98fa7,0x47b5481d,0xbefa4fa4]}i.inherits(s,n),e.exports=s,s.blockSize=1024,s.outSize=384,s.hmacStrength=192,s.padLength=128,s.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h.slice(0,12),"big"):i.split32(this.h.slice(0,12),"big")}},22926:(e,t,r)=>{"use strict";r.d(t,{kF:()=>s});class i{}class n extends i{constructor(){super()}}class s extends n{constructor(e){super()}}},23308:(e,t,r)=>{let i=r(52686);function n(e,t){let r=e.a/255,i=t+'="'+e.hex+'"';return r<1?i+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':i}function s(e,t,r){let i=e+t;return void 0!==r&&(i+=" "+r),i}t.render=function(e,t,r){let o=i.getOptions(t),a=e.modules.size,c=e.modules.data,l=a+2*o.margin,h=o.color.light.a?"<path "+n(o.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",u="<path "+n(o.color.dark,"stroke")+' d="'+function(e,t,r){let i="",n=0,o=!1,a=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),h=Math.floor(c/t);l||o||(o=!0),e[c]?(a++,c>0&&l>0&&e[c-1]||(i+=o?s("M",l+r,.5+h+r):s("m",n,0),n=0,o=!1),l+1<t&&e[c+1]||(i+=s("h",a),a=0)):n++}return i}(c,a,o.margin)+'"/>',d='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+('viewBox="0 0 '+l+" ")+l+'" shape-rendering="crispEdges">'+h+u+"</svg>\n";return"function"==typeof r&&r(null,d),d}},23511:(e,t,r)=>{"use strict";e.exports=function(e){var t,r;return t=e.lib.CipherParams,r=e.enc.Hex,e.format.Hex={stringify:function(e){return e.ciphertext.toString(r)},parse:function(e){var i=r.parse(e);return t.create({ciphertext:i})}},e.format.Hex}(r(16611),r(99229))},23750:(e,t,r)=>{"use strict";t.base=r(92963),t.short=r(70064),t.mont=r(83176),t.edwards=r(85574)},24691:(e,t,r)=>{"use strict";r.d(t,{Xt:()=>l,x7:()=>c});var i=r(2339),n=r(83262),s=r(25223),o=r(82910),a=r(28898);r(81029).Buffer;let c=(0,i.struct)([(0,i.u32)("mintAuthorityOption"),(0,n.jE)("mintAuthority"),(0,n._l)("supply"),(0,i.u8)("decimals"),(0,n.lc)("isInitialized"),(0,i.u32)("freezeAuthorityOption"),(0,n.jE)("freezeAuthority")]);function l(e,t,r=!1,i=o.x5,n=o.EK){if(!r&&!s.PublicKey.isOnCurve(t.toBuffer()))throw new a.lu;let[c]=s.PublicKey.findProgramAddressSync([t.toBuffer(),i.toBuffer(),e.toBuffer()],n);return c}c.span},24755:(e,t,r)=>{"use strict";r.d(t,{sc:()=>i});let i=r(34918).sc},24967:(e,t)=>{t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},t.from=function(e,r){if(t.isValid(e))return e;try{if("string"!=typeof e)throw Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw Error("Unknown EC Level: "+e)}}catch(e){return r}}},25042:(e,t,r)=>{"use strict";function i(e){if("string"!=typeof e)throw Error(`Cannot safe json parse value of type ${typeof e}`);try{return JSON.parse(e.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3'),(e,t)=>"string"==typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t)}catch(t){return e}}function n(e){return"string"==typeof e?e:JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString()+"n":t)||""}r.d(t,{h:()=>n,j:()=>i})},25648:(e,t,r)=>{"use strict";
12Object.defineProperty(t,"__esModule",{value:!0});let i=r(12590);i.__exportStar(r(81452),t),i.__exportStar(r(80361),t)},25939:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromMiliseconds=t.toMiliseconds=void 0;let i=r(25648);t.toMiliseconds=function(e){return e*i.ONE_THOUSAND},t.fromMiliseconds=function(e){return Math.floor(e/i.ONE_THOUSAND)}},26254:(e,t,r)=>{e.exports=r(42937)("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},26662:(e,t)=>{"use strict";function r(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function i(e){let t=r(e);if(!t)throw Error(`${e} is not defined in Window`);return t}Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalStorage=t.getLocalStorageOrThrow=t.getCrypto=t.getCryptoOrThrow=t.getLocation=t.getLocationOrThrow=t.getNavigator=t.getNavigatorOrThrow=t.getDocument=t.getDocumentOrThrow=t.getFromWindowOrThrow=t.getFromWindow=void 0,t.getFromWindow=r,t.getFromWindowOrThrow=i,t.getDocumentOrThrow=function(){return i("document")},t.getDocument=function(){return r("document")},t.getNavigatorOrThrow=function(){return i("navigator")},t.getNavigator=function(){return r("navigator")},t.getLocationOrThrow=function(){return i("location")},t.getLocation=function(){return r("location")},t.getCryptoOrThrow=function(){return i("crypto")},t.getCrypto=function(){return r("crypto")},t.getLocalStorageOrThrow=function(){return i("localStorage")},t.getLocalStorage=function(){return r("localStorage")}},26721:(e,t,r)=>{"use strict";e.exports=function(e){var t;return t=e.lib.WordArray,e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],o=0;o<i;o+=3)for(var a=(r[o>>>2]>>>24-o%4*8&255)<<16|(r[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|r[o+2>>>2]>>>24-(o+2)%4*8&255,c=0;c<4&&o+.75*c<i;c++)s.push(n.charAt(a>>>6*(3-c)&63));var l=n.charAt(64);if(l)for(;s.length%4;)s.push(l);return s.join("")},parse:function(e,r){void 0===r&&(r=!0);var i=e.length,n=r?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var o=0;o<n.length;o++)s[n.charCodeAt(o)]=o}var a=n.charAt(64);if(a){var c=e.indexOf(a);-1!==c&&(i=c)}for(var l=e,h=i,u=s,d=[],f=0,p=0;p<h;p++)if(p%4){var g=u[l.charCodeAt(p-1)]<<p%4*2|u[l.charCodeAt(p)]>>>6-p%4*2;d[f>>>2]|=g<<24-f%4*8,f++}return t.create(d,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},e.enc.Base64url}(r(16611))},28397:(e,t,r)=>{"use strict";e.exports=function(e){var t,r;return e.mode.CTR=(r=(t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,s=this._counter;n&&(s=this._counter=n.slice(0),this._iv=void 0);var o=s.slice(0);r.encryptBlock(o,0),s[i-1]=s[i-1]+1|0;for(var a=0;a<i;a++)e[t+a]^=o[a]}}),t.Decryptor=r,t),e.mode.CTR}(r(16611),r(99229))},28898:(e,t,r)=>{"use strict";r.d(t,{bY:()=>o,ce:()=>s,kD:()=>n,lu:()=>c,vd:()=>a});class i extends Error{constructor(e){super(e)}}class n extends i{constructor(){super(...arguments),this.name="TokenAccountNotFoundError"}}class s extends i{constructor(){super(...arguments),this.name="TokenInvalidAccountError"}}class o extends i{constructor(){super(...arguments),this.name="TokenInvalidAccountOwnerError"}}class a extends i{constructor(){super(...arguments),this.name="TokenInvalidAccountSizeError"}}class c extends i{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}},28977:(e,t,r)=>{"use strict";r.d(t,{oU:()=>s});var i=r(87358);let n=(void 0!==i&&void 0!==i.env?i.env.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",s={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,FIVE_SEC_MS:5e3,THREE_SEC_MS:3e3,ONE_SEC_MS:1e3,SECURE_SITE:n,SECURE_SITE_DASHBOARD:`${n}/dashboard`,SECURE_SITE_FAVICON:`${n}/images/favicon.png`,RESTRICTED_TIMEZONES:["ASIA/SHANGHAI","ASIA/URUMQI","ASIA/CHONGQING","ASIA/HARBIN","ASIA/KASHGAR","ASIA/MACAU","ASIA/HONG_KONG","ASIA/MACAO","ASIA/BEIJING","ASIA/HARBIN"],WC_COINBASE_PAY_SDK_CHAINS:["ethereum","arbitrum","polygon","berachain","avalanche-c-chain","optimism","celo","base"],WC_COINBASE_PAY_SDK_FALLBACK_CHAIN:"ethereum",WC_COINBASE_PAY_SDK_CHAIN_NAME_MAP:{Ethereum:"ethereum","Arbitrum One":"arbitrum",Polygon:"polygon",Berachain:"berachain",Avalanche:"avalanche-c-chain","OP Mainnet":"optimism",Celo:"celo",Base:"base"},WC_COINBASE_ONRAMP_APP_ID:"bf18c88d-495a-463b-b249-0b9d3656cf5e",SWAP_SUGGESTED_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP"],SWAP_POPULAR_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP","METAL","DAI","CHAMP","WOLF","SALE","BAL","BUSD","MUST","BTCpx","ROUTE","HEX","WELT","amDAI","VSQ","VISION","AURUM","pSP","SNX","VC","LINK","CHP","amUSDT","SPHERE","FOX","GIDDY","GFC","OMEN","OX_OLD","DE","WNT"],BALANCE_SUPPORTED_CHAINS:["eip155","solana"],SWAP_SUPPORTED_NETWORKS:["eip155:1","eip155:42161","eip155:10","eip155:324","eip155:8453","eip155:
1256","eip155:137","eip155:100","eip155:43114","eip155:250","eip155:8217","eip155:1313161554"],NAMES_SUPPORTED_CHAIN_NAMESPACES:["eip155"],ONRAMP_SUPPORTED_CHAIN_NAMESPACES:["eip155","solana"],ACTIVITY_ENABLED_CHAIN_NAMESPACES:["eip155","solana"],NATIVE_TOKEN_ADDRESS:{eip155:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",solana:"So11111111111111111111111111111111111111111",polkadot:"0x",bip122:"0x"},CONVERT_SLIPPAGE_TOLERANCE:1,CONNECT_LABELS:{MOBILE:"Open and continue in a new browser tab"},DEFAULT_FEATURES:{swaps:!0,onramp:!0,receive:!0,send:!0,email:!0,emailShowWallets:!0,socials:["google","x","discord","farcaster","github","apple","facebook"],connectorTypeOrder:["walletConnect","recent","injected","featured","custom","external","recommended"],history:!0,analytics:!0,allWallets:!0,legalCheckbox:!1,smartSessions:!1,collapseWallets:!1,walletFeaturesOrder:["onramp","swaps","receive","send"],connectMethodsOrder:void 0},DEFAULT_ACCOUNT_TYPES:{bip122:"payment",eip155:"smartAccount",polkadot:"eoa",solana:"eoa"},ADAPTER_TYPES:{UNIVERSAL:"universal",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5",BITCOIN:"bitcoin"}}},29143:(e,t,r)=>{"use strict";r.d(t,{lY:()=>v});var i=r(78710),n=r(458);let s=BigInt(0),o=BigInt(1),a=BigInt(2),c=BigInt(7),l=BigInt(256),h=BigInt(113),u=[],d=[],f=[];for(let e=0,t=o,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],u.push(2*(5*i+r)),d.push((e+1)*(e+2)/2%64);let n=s;for(let e=0;e<7;e++)(t=(t<<o^(t>>c)*h)%l)&a&&(n^=o<<(o<<BigInt(e))-o);f.push(n)}let p=(0,i.lD)(f,!0),g=p[0],m=p[1],y=(e,t,r)=>r>32?(0,i.WM)(e,t,r):(0,i.P5)(e,t,r),b=(e,t,r)=>r>32?(0,i.im)(e,t,r):(0,i.B4)(e,t,r);class w extends n.Vw{constructor(e,t,r,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=i,this.rounds=s,(0,n.Fe)(r),!(0<e&&e<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,n.DH)(this.state)}clone(){return this._cloneInto()}keccak(){(0,n.fd)(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let i=(t+8)%10,n=(t+2)%10,s=r[n],o=r[n+1],a=y(s,o,1)^r[i],c=b(s,o,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],n=e[3];for(let r=0;r<24;r++){let i=d[r],s=y(t,n,i),o=b(t,n,i),a=u[r];t=e[a],n=e[a+1],e[a]=s,e[a+1]=o}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=g[i],e[1]^=m[i]}(0,n.uH)(r)}(this.state32,this.rounds),(0,n.fd)(this.state32),this.posOut=0,this.pos=0}update(e){(0,n.CC)(this),e=(0,n.ZJ)(e),(0,n.DO)(e);let{blockLen:t,state:r}=this,i=e.length;for(let n=0;n<i;){let s=Math.min(t-this.pos,i-n);for(let t=0;t<s;t++)r[this.pos++]^=e[n++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:i}=this;e[r]^=t,(128&t)!=0&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){(0,n.CC)(this,!1),(0,n.DO)(e),this.finish();let t=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,n.Fe)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,n.Ht)(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,n.uH)(this.state)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new w(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}let v=(()=>(0,n.qj)(()=>new w(136,1,32)))()},29762:(e,t)=>
12{t.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}},29936:(e,t,r)=>{"use strict";r.d(t,{j:()=>o});var i=r(70524),n=r(98866);let s=(0,i.BX)({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),o={state:s,subscribeNetworkImages:e=>(0,i.B1)(s.networkImages,()=>e(s.networkImages)),subscribeKey:(e,t)=>(0,n.u$)(s,e,t),subscribe:e=>(0,i.B1)(s,()=>e(s)),setWalletImage(e,t){s.walletImages[e]=t},setNetworkImage(e,t){s.networkImages[e]=t},setChainImage(e,t){s.chainImages[e]=t},setConnectorImage(e,t){s.connectorImages={...s.connectorImages,[e]:t}},setTokenImage(e,t){s.tokenImages[e]=t},setCurrencyImage(e,t){s.currencyImages[e]=t}}},30120:(e,t,r)=>{"use strict";e.exports=function(e){return!function(){var t=e.lib.StreamCipher,r=e.algo,i=[],n=[],s=[],o=r.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,0xffff0000&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,0xffff0000&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,0xffff0000&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,0xffff0000&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)a.call(this);for(var n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,o=s[0],c=s[1],l=(o<<8|o>>>24)&0xff00ff|(o<<24|o>>>8)&0xff00ff00,h=(c<<8|c>>>24)&0xff00ff|(c<<24|c>>>8)&0xff00ff00,u=l>>>16|0xffff0000&h,d=h<<16|65535&l;i[0]^=l,i[1]^=u,i[2]^=h,i[3]^=d,i[4]^=l,i[5]^=u,i[6]^=h,i[7]^=d;for(var n=0;n<4;n++)a.call(this)}},_doProcessBlock:function(e,t){var r=this._X;a.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=(i[n]<<8|i[n]>>>24)&0xff00ff|(i[n]<<24|i[n]>>>8)&0xff00ff00,e[t+n]^=i[n]},blockSize:4,ivSize:2});function a(){for(var e=this._X,t=this._C,r=0;r<8;r++)n[r]=t[r];t[0]=t[0]+0x4d34d34d+this._b|0,t[1]=t[1]+0xd34d34d3+ +(t[0]>>>0<n[0]>>>0)|0,t[2]=t[2]+0x34d34d34+ +(t[1]>>>0<n[1]>>>0)|0,t[3]=t[3]+0x4d34d34d+ +(t[2]>>>0<n[2]>>>0)|0,t[4]=t[4]+0xd34d34d3+ +(t[3]>>>0<n[3]>>>0)|0,t[5]=t[5]+0x34d34d34+ +(t[4]>>>0<n[4]>>>0)|0,t[6]=t[6]+0x4d34d34d+ +(t[5]>>>0<n[5]>>>0)|0,t[7]=t[7]+0xd34d34d3+ +(t[6]>>>0<n[6]>>>0)|0,this._b=+(t[7]>>>0<n[7]>>>0);for(var r=0;r<8;r++){var i=e[r]+t[r],o=65535&i,a=i>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((0xffff0000&i)*i|0)+((65535&i)*i|0);s[r]=c^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=t._createHelper(o)}(),e.RabbitLegacy}(r(16611),r(9956),r(11816),r(93524),r(99229))},30598:(e,t,r)=>{"use strict";function i(e,t){let r=e.toString(),i=r.startsWith("-");i&&(r=r.slice(1));let[n,s]=[(r=r.padStart(t,"0")).slice(0,r.length-t),r.slice(r.length-t)];return s=s.replace(/(0+)$/,""),`${i?"-":""}${n||"0"}${s?`.${s}`:""}`}r.d(t,{J:()=>i})},31e3:(e,t,r)=>{"use strict";var i=r(20920),n=r(64874),s=r(3285),o=i.rotr64_hi,a=i.rotr64_lo,c=i.shr64_hi,l=i.shr64_lo,h=i.sum64,u=i.sum64_hi,d=i.sum64_lo,f=i.sum64_4_hi,p=i.sum64_4_lo,g=i.sum64_5_hi,m=i.sum64_5_lo,y=n.BlockHash,b=[0x428a2f98,0xd728ae22,0x71374491,0x23ef65cd,0xb5c0fbcf,0xec4d3b2f,0xe9b5dba5,0x8189dbbc,0x3956c25b,0xf348b538,0x59f111f1,0xb605d019,0x923f82a4,0xaf194f9b,0xab1c5ed5,0xda6d8118,0xd807aa98,0xa3030242,0x12835b01,0x45706fbe,0x243185be,0x4ee4b28c,0x550c7dc3,0xd5ffb4e2,0x72be5d74,0xf27b896f,0x80deb1fe,0x3b1696b1,0x9bdc06a7,0x25c71235,0xc19bf174,0xcf692694,0xe49b69c1,0x9ef14ad2,0xefbe4786,0x384f25e3,0xfc19dc6,0x8b8cd5b5,0x240ca1cc,0x77ac9c65,0x2de92c6f,0x592b0275,0x4a7484aa,0x6ea6e483,0x5cb0a9dc,0xbd41fbd4,0x76f988da,0x831153b5,0x983e5152,0xee66dfab,0xa831c66d,0x2db43210,0xb00327c8,0x98fb213f,0xbf597fc7,0xbeef0ee4,0xc6e00bf3,0x3da88fc2,0xd5a79147,0x930aa725,0x6ca6351,0xe003826f,0x14292967,0xa0e6e70,0x27b70a85,0x46d22ffc,0x2e1b2138,0x5c26c926,0x4d2c6dfc,0x5ac42aed,0x53380d13,0x9d95b3df,0x650a7354,0x8baf63de,0x766a0abb,0x3c77b2a8,0x81c2c92e,0x47edaee6,0x92722c85,0x1482353b,0xa2bfe8a1,0x4cf10364,0xa81a664b,0xbc423001,0xc24b8b70,0xd0f89791,0xc76c51a3,0x654be30,0xd192e819,0xd6ef5218,0xd6990624,0x5565a910,0xf40e3585,0x5771202a,0x106aa070,0x32bbd1b8,0x19a4c116,0xb8d2d0c8,0x1e376c08,0x5141ab53,0x2748774c,0xdf8eeb99,0x34b0bcb5,0xe19b48a8,0x391c0cb3,0xc5c95a63,0x4ed8aa4a,0xe3418acb,0x5b9cca4f,0x7763e373,0x682e6ff3,0xd6b2b8a3,0x748f82ee,0x5defb2fc,0x78a5636f,0x43172f60,0x84c87814,0xa1f0ab72,0x8cc70208,0x1a6439ec,0x90befffa,0x23631e28,0xa4506ceb,0xde82bde9,0xbef9a3f7,0xb2c67915,0xc67178f2,0xe372532b,0xca273ece,0xea26619c,0xd186b8c7,0x21c0c207,0xeada7dd6,0xcde0eb1e,0xf57d4f7f,0xee6ed178,0x6f067aa,0x72176fba,0xa637dc5,0xa2c898a6,0x113f9804,0xbef90dae,0x1b710b35,0x131c471b,0x28db77f5,0x23047d84,0x32caab7b,0x40c72493,0x3c9ebe0a,0x15c9bebc,0x431d67c4,0x9c100d4c,0x4cc5d4be,0xcb3e42b6,0x597f299c,0xfc657e2a,0x5fcb6fab,0x3ad6faec,0x6c44198c,0x4a475817];function w(){if(!(this instanceof w))return new w;
12y.call(this),this.h=[0x6a09e667,0xf3bcc908,0xbb67ae85,0x84caa73b,0x3c6ef372,0xfe94f82b,0xa54ff53a,0x5f1d36f1,0x510e527f,0xade682d1,0x9b05688c,0x2b3e6c1f,0x1f83d9ab,0xfb41bd6b,0x5be0cd19,0x137e2179],this.k=b,this.W=Array(160)}i.inherits(w,y),e.exports=w,w.blockSize=1024,w.outSize=512,w.hmacStrength=192,w.padLength=128,w.prototype._prepareBlock=function(e,t){for(var r=this.W,i=0;i<32;i++)r[i]=e[t+i];for(;i<r.length;i+=2){var n=function(e,t){var r=o(e,t,19)^o(t,e,29)^c(e,t,6);return r<0&&(r+=0x100000000),r}(r[i-4],r[i-3]),s=function(e,t){var r=a(e,t,19)^a(t,e,29)^l(e,t,6);return r<0&&(r+=0x100000000),r}(r[i-4],r[i-3]),h=r[i-14],u=r[i-13],d=function(e,t){var r=o(e,t,1)^o(e,t,8)^c(e,t,7);return r<0&&(r+=0x100000000),r}(r[i-30],r[i-29]),g=function(e,t){var r=a(e,t,1)^a(e,t,8)^l(e,t,7);return r<0&&(r+=0x100000000),r}(r[i-30],r[i-29]),m=r[i-32],y=r[i-31];r[i]=f(n,s,h,u,d,g,m,y),r[i+1]=p(n,s,h,u,d,g,m,y)}},w.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,i=this.h[0],n=this.h[1],c=this.h[2],l=this.h[3],f=this.h[4],p=this.h[5],y=this.h[6],b=this.h[7],w=this.h[8],v=this.h[9],x=this.h[10],E=this.h[11],_=this.h[12],I=this.h[13],A=this.h[14],S=this.h[15];s(this.k.length===r.length);for(var C=0;C<r.length;C+=2){var N=A,O=S,P=function(e,t){var r=o(e,t,14)^o(e,t,18)^o(t,e,9);return r<0&&(r+=0x100000000),r}(w,v),T=function(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=0x100000000),r}(w,v),M=function(e,t,r,i,n){var s=e&r^~e&n;return s<0&&(s+=0x100000000),s}(w,0,x,0,_,I),R=function(e,t,r,i,n,s){var o=t&i^~t&s;return o<0&&(o+=0x100000000),o}(0,v,0,E,0,I),k=this.k[C],D=this.k[C+1],L=r[C],U=r[C+1],B=g(N,O,P,T,M,R,k,D,L,U),j=m(N,O,P,T,M,R,k,D,L,U);N=function(e,t){var r=o(e,t,28)^o(t,e,2)^o(t,e,7);return r<0&&(r+=0x100000000),r}(i,n),O=function(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=0x100000000),r}(i,n);var $=u(N,O,P=function(e,t,r,i,n){var s=e&r^e&n^r&n;return s<0&&(s+=0x100000000),s}(i,0,c,0,f,p),T=function(e,t,r,i,n,s){var o=t&i^t&s^i&s;return o<0&&(o+=0x100000000),o}(0,n,0,l,0,p)),z=d(N,O,P,T);A=_,S=I,_=x,I=E,x=w,E=v,w=u(y,b,B,j),v=d(b,b,B,j),y=f,b=p,f=c,p=l,c=i,l=n,i=u(B,j,$,z),n=d(B,j,$,z)}h(this.h,0,i,n),h(this.h,2,c,l),h(this.h,4,f,p),h(this.h,6,y,b),h(this.h,8,w,v),h(this.h,10,x,E),h(this.h,12,_,I),h(this.h,14,A,S)},w.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},31937:(e,t,r)=>{let i=r(89158),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function s(e){this.mode=i.ALPHANUMERIC,this.data=e}s.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let r=45*n.indexOf(this.data[t]);r+=n.indexOf(this.data[t+1]),e.put(r,11)}this.data.length%2&&e.put(n.indexOf(this.data[t]),6)},e.exports=s},32464:(e,t,r)=>{"use strict";async function i(...e){let t=await fetch(...e);if(!t.ok)throw Error(`HTTP status code: ${t.status}`,{cause:t});return t}r.d(t,{Z:()=>n});class n{constructor({baseUrl:e,clientId:t}){this.baseUrl=e,this.clientId=t}async get({headers:e,signal:t,cache:r,...n}){let s=this.createUrl(n);return(await i(s,{method:"GET",headers:e,signal:t,cache:r})).json()}async getBlob({headers:e,signal:t,...r}){let n=this.createUrl(r);return(await i(n,{method:"GET",headers:e,signal:t})).blob()}async post({body:e,headers:t,signal:r,...n}){let s=this.createUrl(n);return(await i(s,{method:"POST",headers:t,body:e?JSON.stringify(e):void 0,signal:r})).json()}async put({body:e,headers:t,signal:r,...n}){let s=this.createUrl(n);return(await i(s,{method:"PUT",headers:t,body:e?JSON.stringify(e):void 0,signal:r})).json()}async delete({body:e,headers:t,signal:r,...n}){let s=this.createUrl(n);return(await i(s,{method:"DELETE",headers:t,body:e?JSON.stringify(e):void 0,signal:r})).json()}createUrl({path:e,params:t}){let r=new URL(e,this.baseUrl);return t&&Object.entries(t).forEach(([e,t])=>{t&&r.searchParams.append(e,t)}),this.clientId&&r.searchParams.append("clientId",this.clientId),r}}},32671:(e,t,r)=>{"use strict";r.d(t,{ev:()=>I});var i=r(34918),n=r(458),s=r(40950),o=r(5257),a=r(22527);let c=BigInt(0),l=BigInt(1),h=BigInt(2),u=BigInt(8);class d{constructor(e){this.ep=e}static fromBytes(e){(0,o.SJ)()}static fromHex(e){(0,o.SJ)()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(e){return this.ep.toAffine(e)}toHex(){return(0,n.My)(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}
12add(e){return this.assertSame(e),this.init(this.ep.add(e.ep))}subtract(e){return this.assertSame(e),this.init(this.ep.subtract(e.ep))}multiply(e){return this.init(this.ep.multiply(e))}multiplyUnsafe(e){return this.init(this.ep.multiplyUnsafe(e))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(e,t){return this.init(this.ep.precompute(e,t))}toRawBytes(){return this.toBytes()}}(0,n.AI)("HashToScalar-");let f=BigInt(0),p=BigInt(1),g=BigInt(2);BigInt(3);let m=BigInt(5),y=BigInt(8),b=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),w={p:b,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:y,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")},v=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function x(e,t){let r=(0,a.zi)(t*t*t,b),i=function(e){let t=BigInt(10),r=BigInt(20),i=BigInt(40),n=BigInt(80),s=e*e%b*e%b,o=(0,a.zH)(s,g,b)*s%b,c=(0,a.zH)(o,p,b)*e%b,l=(0,a.zH)(c,m,b)*c%b,h=(0,a.zH)(l,t,b)*l%b,u=(0,a.zH)(h,r,b)*h%b,d=(0,a.zH)(u,i,b)*u%b,f=(0,a.zH)(d,n,b)*d%b,y=(0,a.zH)(f,n,b)*d%b,w=(0,a.zH)(y,t,b)*l%b;return{pow_p_5_8:(0,a.zH)(w,g,b)*e%b,b2:s}}(e*(0,a.zi)(r*r*t,b)).pow_p_5_8,n=(0,a.zi)(e*r*i,b),s=(0,a.zi)(t*n*n,b),o=n,c=(0,a.zi)(n*v,b),l=s===e,h=s===(0,a.zi)(-e,b),u=s===(0,a.zi)(-e*v,b);return l&&(n=o),(h||u)&&(n=c),(0,a.dQ)(n,b)&&(n=(0,a.zi)(-n,b)),{isValid:l||h,value:n}}let E=(0,a.D0)(w.p,{isLE:!0}),_=(0,a.D0)(w.n,{isLE:!0}),I=function(e){let{CURVE:t,curveOpts:r,hash:i,eddsaOpts:d}=function(e){let t={a:e.a,d:e.d,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},r={Fp:e.Fp,Fn:(0,a.D0)(t.n,e.nBitLength,!0),uvRatio:e.uvRatio},i={randomBytes:e.randomBytes,adjustScalarBytes:e.adjustScalarBytes,domain:e.domain,prehash:e.prehash,mapToCurve:e.mapToCurve};return{CURVE:t,curveOpts:r,hash:e.hash,eddsaOpts:i}}(e),f=function(e,t,r={}){if("function"!=typeof t)throw Error('"hash" function param is required');(0,o.DS)(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:i}=r,{BASE:s,Fp:a,Fn:c}=e,h=r.randomBytes||n.po,u=r.adjustScalarBytes||(e=>e),d=r.domain||((e,t,r)=>{if((0,o.d6)(r,"phflag"),t.length||r)throw Error("Contexts/pre-hash are not supported");return e});function f(e){return c.create((0,o.lX)(e))}function p(e){let{head:r,prefix:i,scalar:n}=function(e){let r=w.secretKey;e=(0,o.qj)("private key",e,r);let i=(0,o.qj)("hashed private key",t(e),2*r),n=u(i.slice(0,r)),s=i.slice(r,2*r),a=f(n);return{head:n,prefix:s,scalar:a}}(e),a=s.multiply(n),c=a.toBytes();return{head:r,prefix:i,scalar:n,point:a,pointBytes:c}}function g(e){return p(e).pointBytes}function m(e=Uint8Array.of(),...r){return f(t(d((0,n.Id)(...r),(0,o.qj)("context",e),!!i)))}let y={zip215:!0},b=a.BYTES,w={secretKey:b,publicKey:b,signature:2*b,seed:b};function v(e=h(w.seed)){return(0,o.eV)(e,w.seed,"seed")}let x={getExtendedPublicKey:p,randomSecretKey:v,isValidSecretKey:function(e){return(0,n.aY)(e)&&e.length===c.BYTES},isValidPublicKey:function(t,r){try{return!!e.fromBytes(t,r)}catch(e){return!1}},toMontgomery(t){let{y:r}=e.fromBytes(t),i=w.publicKey,n=32===i;if(!n&&57!==i)throw Error("only defined for 25519 and 448");let s=n?a.div(l+r,l-r):a.div(r-l,r+l);return a.toBytes(s)},toMontgomerySecret(e){let r=w.secretKey;return(0,o.eV)(e,r),u(t(e.subarray(0,r))).subarray(0,r)},randomPrivateKey:v,precompute:(t=8,r=e.BASE)=>r.precompute(t,!1)};return Object.freeze({keygen:function(e){let t=x.randomSecretKey(e);return{secretKey:t,publicKey:g(t)}},getPublicKey:g,sign:function(e,t,r={}){e=(0,o.qj)("message",e),i&&(e=i(e));let{prefix:a,scalar:l,pointBytes:h}=p(t),u=m(r.context,a,e),d=s.multiply(u).toBytes(),f=m(r.context,d,h,e),g=c.create(u+f*l);if(!c.isValid(g))throw Error("sign failed: invalid s");let y=(0,n.Id)(d,c.toBytes(g));return(0,o.eV)(y,w.signature,"result")},verify:function(t,r,n,a=y){let c,l,h,{context:u,zip215:d}=a,f=w.signature;t=(0,o.qj)("signature",t,f),r=(0,o.qj)("message",r),n=(0,o.qj)("publicKey",n,w.publicKey),void 0!==d&&(0,o.d6)(d,"zip215"),i&&(r=i(r));let p=f/2,g=t.subarray(0,p),b=(0,o.lX)(t.subarray(p,f));try{c=e.fromBytes(n,d),l=e.fromBytes(g,d),h=s.multiplyUnsafe(b)}catch(e){return!1}if(!d&&c.isSmallOrder())return!1;let v=m(u,l.toBytes(),c.toBytes(),r);return l.add(c.multiplyUnsafe(v)).subtract(h).clearCofactor().is0()},utils:x,Point:e,lengths:w})}(function(e,t={}){let r=(0,s.UT)("edwards",e,t,t.FpFnLE),{Fp:i,Fn:a}=r,d=r.CURVE,{h:f}=d;(0,o.DS)(t,{},{uvRatio:"function"});let p=h<<BigInt(8*a.BYTES)-l,g=e=>i.create(e),m=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:i.sqrt(i.div(e,t))}}catch(e){return{isValid:!1,value:c}}});if(!function(e,t,r,i){let n=e.sqr(r),s=e.sqr(i),o=e.add(e.mul(t.a,n),s),a=e.add(e.ONE,e.mul(t.d,e.mul(n,s)));return e.eql(o,a)}(i,d,d.Gx,d.Gy))throw Error("bad curve params: generator point");function y(e,t,r=!1){let i=r?l:c;return(0,o.aK)("coordinate "+e,t,i,p),t}function b(e){if(!(e instanceof x))throw Error("ExtendedPoint expected")}let w=(0,o.x)((e,t)=>{let{X:r,Y:n,Z:s}=e,o=e.is0();null==t&&(t=o?u:i.inv(s));let a=g(r*t),h=g(n*t),d=i.mul(s,t);if(o)return{x:c,y:l};
12if(d!==l)throw Error("invZ was invalid");return{x:a,y:h}}),v=(0,o.x)(e=>{let{a:t,d:r}=d;if(e.is0())throw Error("bad point: ZERO");let{X:i,Y:n,Z:s,T:o}=e,a=g(i*i),c=g(n*n),l=g(s*s),h=g(l*l),u=g(a*t);if(g(l*g(u+c))!==g(h+g(r*g(a*c))))throw Error("bad point: equation left != right (1)");if(g(i*n)!==g(s*o))throw Error("bad point: equation left != right (2)");return!0});class x{constructor(e,t,r,i){this.X=y("x",e),this.Y=y("y",t),this.Z=y("z",r,!0),this.T=y("t",i),Object.freeze(this)}static CURVE(){return d}static fromAffine(e){if(e instanceof x)throw Error("extended point not allowed");let{x:t,y:r}=e||{};return y("x",t),y("y",r),new x(t,r,l,g(t*r))}static fromBytes(e,t=!1){let r=i.BYTES,{a:n,d:s}=d;e=(0,o.nC)((0,o.eV)(e,r,"point")),(0,o.d6)(t,"zip215");let a=(0,o.nC)(e),h=e[r-1];a[r-1]=-129&h;let u=(0,o.lX)(a),f=t?p:i.ORDER;(0,o.aK)("point.y",u,c,f);let y=g(u*u),{isValid:b,value:w}=m(g(y-l),g(s*y-n));if(!b)throw Error("bad point: invalid y coordinate");let v=(w&l)===l,E=(128&h)!=0;if(!t&&w===c&&E)throw Error("bad point: x=0 and x_0=1");return E!==v&&(w=g(-w)),x.fromAffine({x:w,y:u})}static fromHex(e,t=!1){return x.fromBytes((0,o.qj)("point",e),t)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return E.createCache(this,e),t||this.multiply(h),this}assertValidity(){v(this)}equals(e){b(e);let{X:t,Y:r,Z:i}=this,{X:n,Y:s,Z:o}=e,a=g(t*o),c=g(n*i),l=g(r*o),h=g(s*i);return a===c&&l===h}is0(){return this.equals(x.ZERO)}negate(){return new x(g(-this.X),this.Y,this.Z,g(-this.T))}double(){let{a:e}=d,{X:t,Y:r,Z:i}=this,n=g(t*t),s=g(r*r),o=g(h*g(i*i)),a=g(e*n),c=t+r,l=g(g(c*c)-n-s),u=a+s,f=u-o,p=a-s,m=g(l*f),y=g(u*p),b=g(l*p);return new x(m,y,g(f*u),b)}add(e){b(e);let{a:t,d:r}=d,{X:i,Y:n,Z:s,T:o}=this,{X:a,Y:c,Z:l,T:h}=e,u=g(i*a),f=g(n*c),p=g(o*r*h),m=g(s*l),y=g((i+n)*(a+c)-u-f),w=m-p,v=m+p,E=g(f-t*u),_=g(y*w),I=g(v*E),A=g(y*E);return new x(_,I,g(w*v),A)}subtract(e){return this.add(e.negate())}multiply(e){if(!a.isValidNot0(e))throw Error("invalid scalar: expected 1 <= sc < curve.n");let{p:t,f:r}=E.cached(this,e,e=>(0,s.Ak)(x,e));return(0,s.Ak)(x,[t,r])[0]}multiplyUnsafe(e,t=x.ZERO){if(!a.isValid(e))throw Error("invalid scalar: expected 0 <= sc < curve.n");return e===c?x.ZERO:this.is0()||e===l?this:E.unsafe(this,e,e=>(0,s.Ak)(x,e),t)}isSmallOrder(){return this.multiplyUnsafe(f).is0()}isTorsionFree(){return E.unsafe(this,d.n).is0()}toAffine(e){return w(this,e)}clearCofactor(){return f===l?this:this.multiplyUnsafe(f)}toBytes(){let{x:e,y:t}=this.toAffine(),r=i.toBytes(t);return r[r.length-1]|=e&l?128:0,r}toHex(){return(0,n.My)(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(e){return(0,s.Ak)(x,e)}static msm(e,t){return(0,s.Xf)(x,a,e,t)}_setWindowSize(e){this.precompute(e)}toRawBytes(){return this.toBytes()}}x.BASE=new x(d.Gx,d.Gy,l,g(d.Gx*d.Gy)),x.ZERO=new x(c,l,l,c),x.Fp=i,x.Fn=a;let E=new s.hT(x,a.BITS);return x.BASE.precompute(8),x}(t,r),i,d),p=f.Point;return Object.assign({},f,{ExtendedPoint:p,CURVE:e,nBitLength:p.Fn.BITS,nByteLength:p.Fn.BYTES})}({...w,Fp:E,hash:i.Zf,adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},uvRatio:x}),A=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),S=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),C=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),N=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),O=e=>x(p,e),P=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),T=e=>I.Point.Fp.create((0,o.lX)(e)&P);function M(e){let{d:t}=w,r=e=>E.create(e),i=r(v*e*e),n=r((i+p)*C),s=BigInt(-1),o=r((s-t*i)*r(i+t)),{isValid:c,value:l}=x(n,o),h=r(l*e);(0,a.dQ)(h,b)||(h=r(-h)),c||(l=h),c||(s=i);let u=r(s*(i-p)*N-o),d=l*l,f=r((l+l)*o),g=r(u*A),m=r(p-d),y=r(p+d);return new I.Point(r(f*y),r(m*g),r(g*y),r(f*m))}class R extends d{constructor(e){super(e)}static fromAffine(e){return new R(I.Point.fromAffine(e))}assertSame(e){if(!(e instanceof R))throw Error("RistrettoPoint expected")}init(e){return new R(e)}static hashToCurve(e){var t=(0,o.qj)("ristrettoHash",e,64);(0,n.DO)(t,64);let r=M(T(t.subarray(0,32))),i=M(T(t.subarray(32,64)));return new R(r.add(i))}static fromBytes(e){(0,n.DO)(e,32);let{a:t,d:r}=w,i=e=>E.create(e),s=T(e);if(!(0,o.ex)(E.toBytes(s),e)||(0,a.dQ)(s,b))throw Error("invalid ristretto255 encoding 1");let c=i(s*s),l=i(p+t*c),h=i(p-t*c),u=i(l*l),d=i(h*h),g=i(t*r*u-d),{isValid:m,value:y}=O(i(g*d)),v=i(y*h),x=i(y*v*g),_=i((s+s)*v);(0,a.dQ)(_,b)&&(_=i(-_));let A=i(l*x),S=i(_*A);if(!m||(0,a.dQ)(S,b)||A===f)throw Error("invalid ristretto255 encoding 2");return new R(new I.Point(_,A,p,S))}static fromHex(e){return R.fromBytes((0,o.qj)("ristrettoHex",e,32))}static msm(e,t){return(0,s.Xf)(R,I.Point.Fn,e,t)}toBytes(){let e,{X:t,Y:r,Z:i,T:n}=this.ep,s=e=>E.create(e),o=s(s(i+r)*s(i-r)),c=s(t*r),l=s(c*c),{value:h}=O(s(o*l)),u=s(h*o),d=s(h*c),f=s(u*d*n);if((0,a.dQ)(n*f,b)){let i=s(r*v),n=s(t*v);t=i,r=n,e=s(u*S)}else e=d;(0,a.dQ)(t*f,b)&&(r=s(-r));let p=s((i-r)*e);return(0,a.dQ)(p,b)&&(p=s(-p)),E.toBytes(p)}
12equals(e){this.assertSame(e);let{X:t,Y:r}=this.ep,{X:i,Y:n}=e.ep,s=e=>E.create(e),o=s(t*n)===s(r*i),a=s(r*n)===s(t*i);return o||a}is0(){return this.equals(R.ZERO)}}R.BASE=new R(I.Point.BASE),R.ZERO=new R(I.Point.ZERO),R.Fp=E,R.Fn=_},32774:(e,t,r)=>{"use strict";r.d(t,{v4:()=>l});var i,n=new Uint8Array(16);let s=/^(?:[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;for(var o=[],a=0;a<256;++a)o.push((a+256).toString(16).substr(1));let c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase();if(!("string"==typeof r&&s.test(r)))throw TypeError("Stringified UUID is invalid");return r},l=function(e,t,r){var s=(e=e||{}).random||(e.rng||function(){if(!i&&!(i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return i(n)})();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t){r=r||0;for(var o=0;o<16;++o)t[r+o]=s[o];return t}return c(s)}},33124:(e,t,r)=>{"use strict";r.d(t,{A:()=>h9});var i=r(16459),n=r.n(i),s=r(67878),o=r(5596),a=r(71018),c=r(60480),l=Object.defineProperty,h=(e,t,r)=>((e,t,r)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class u extends c.H{constructor(e){super(),this.opts=e,h(this,"protocol","wc"),h(this,"version",2)}}var d=Object.defineProperty;class f extends c.H{constructor(e,t){super(),this.core=e,this.logger=t,((e,t,r)=>((e,t,r)=>t in e?d(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r))(this,"records",new Map)}}class p{constructor(e,t){this.logger=e,this.core=t}}class g extends c.H{constructor(e,t){super(),this.relayer=e,this.logger=t}}class m extends c.H{constructor(e){super()}}
12class y{constructor(e,t,r,i){this.core=e,this.logger=t,this.name=r}}class b extends c.H{constructor(e,t){super(),this.relayer=e,this.logger=t}}class w extends c.H{constructor(e,t){super(),this.core=e,this.logger=t}}class v{constructor(e,t,r){this.core=e,this.logger=t,this.store=r}}class x{constructor(e,t){this.projectId=e,this.logger=t}}class E{constructor(e,t,r){this.core=e,this.logger=t,this.telemetryEnabled=r}}var _=Object.defineProperty,I=(e,t,r)=>((e,t,r)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);n();class A{constructor(e){this.opts=e,I(this,"protocol","wc"),I(this,"version",2)}}i.EventEmitter;class S{constructor(e){this.client=e}}var C=r(5566),N=r(25042),O=r(20852),P=r(40800),T=r(26662),M=r(88955),R=r(8444),k=r(58222),D=r(43757),L=r(91074),U=r(87358),B=r(81029).Buffer;let j={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"};function $(){return"u">typeof U&&"u">typeof U.versions&&"u">typeof U.versions.node}function z(){return!(0,T.getDocument)()&&!!(0,T.getNavigator)()&&"ReactNative"===navigator.product}function q(){return!$()&&!!(0,T.getNavigator)()&&!!(0,T.getDocument)()}function H(){return z()?j.reactNative:$()?j.node:q()?j.browser:j.unknown}function F(){var e;try{return z()&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Application)?null==(e=r.g.Application)?void 0:e.applicationId:void 0}catch{return}}function W(e,t,i){let n=function(){if(H()===j.reactNative&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Platform)){let{OS:e,Version:t}=r.g.Platform;return[e,t].join("-")}let e=(0,P.o0)();if(null===e)return"unknown";let t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return"browser"===e.type?[t,e.name,e.version].join("-"):[t,e.version].join("-")}(),s=function(){var e;let t=H();return t===j.browser?[t,(null==(e=(0,T.getLocation)())?void 0:e.host)||"unknown"].join(":"):t}();return[[e,t].join("-"),["js",i].join("-"),n,s].join("/")}function V(e){return Object.fromEntries(e.entries())}function K(e){return new Map(Object.entries(e))}function G(e,t,r){return new Promise(async(i,n)=>{let s=setTimeout(()=>n(Error(r)),t);try{let t=await e;i(t)}catch(e){n(e)}clearTimeout(s)})}function Y(e,t){if("string"==typeof t&&t.startsWith(`${e}:`))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}if("id"===e.toLowerCase()){if("number"!=typeof t)throw Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw Error(`Unknown expirer target type: ${e}`)}function J(e,t){return(0,C.fromMiliseconds)((t||Date.now())+(0,C.toMiliseconds)(e))}function X(e){return Date.now()>=(0,C.toMiliseconds)(e)}function Q(e,t){return`${e}${t?`:${t}`:""}`}function Z(){return"u">typeof crypto&&null!=crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function ee(){return"u">typeof U&&"true"===U.env.IS_VITEST}function et(e){return B.from(e,"base64").toString("utf-8")}function er(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function ei(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function en(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");er(e.outputLen),er(e.blockLen)}function es(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function eo(e,t){ei(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}let ea=BigInt(0x100000000-1),ec=BigInt(32),el="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function eh(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function eu(e,t){return e<<32-t|e>>>t}let ed=68===new Uint8Array(new Uint32Array([0x11223344]).buffer)[0];function ef(e){for(let r=0;r<e.length;r++){var t;e[r]=(t=e[r])<<24&0xff000000|t<<8&0xff0000|t>>>8&65280|t>>>24&255}}function ep(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(e)),ei(e),e}class eg{clone(){return this._cloneInto()}}function em(e){let t=t=>e().update(ep(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function ey(e=32){if(el&&"function"==typeof el.getRandomValues)return el.getRandomValues(new Uint8Array(e));if(el&&"function"==typeof el.randomBytes)return el.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}let eb=[],ew=[],ev=[],ex=BigInt(0),eE=BigInt(1),e_=BigInt(2),eI=BigInt(7),eA=BigInt(256),eS=BigInt(113);
12for(let e=0,t=eE,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],eb.push(2*(5*i+r)),ew.push((e+1)*(e+2)/2%64);let n=ex;for(let e=0;e<7;e++)(t=(t<<eE^(t>>eI)*eS)%eA)&e_&&(n^=eE<<(eE<<BigInt(e))-eE);ev.push(n)}let[eC,eN]=function(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let n=0;n<e.length;n++){let{h:s,l:o}=function(e,t=!1){return t?{h:Number(e&ea),l:Number(e>>ec&ea)}:{h:0|Number(e>>ec&ea),l:0|Number(e&ea)}}(e[n],t);[r[n],i[n]]=[s,o]}return[r,i]}(ev,!0),eO=(e,t,r)=>r>32?((e,t,r)=>t<<r-32|e>>>64-r)(e,t,r):((e,t,r)=>e<<r|t>>>32-r)(e,t,r),eP=(e,t,r)=>r>32?((e,t,r)=>e<<r-32|t>>>64-r)(e,t,r):((e,t,r)=>t<<r|e>>>32-r)(e,t,r);class eT extends eg{constructor(e,t,r,i=!1,n=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,er(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}(this.state)}keccak(){ed||ef(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let i=(t+8)%10,n=(t+2)%10,s=r[n],o=r[n+1],a=eO(s,o,1)^r[i],c=eP(s,o,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],n=e[3];for(let r=0;r<24;r++){let i=ew[r],s=eO(t,n,i),o=eP(t,n,i),a=eb[r];t=e[a],n=e[a+1],e[a]=s,e[a+1]=o}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=eC[i],e[1]^=eN[i]}r.fill(0)}(this.state32,this.rounds),ed||ef(this.state32),this.posOut=0,this.pos=0}update(e){es(this);let{blockLen:t,state:r}=this,i=(e=ep(e)).length;for(let n=0;n<i;){let s=Math.min(t-this.pos,i-n);for(let t=0;t<s;t++)r[this.pos++]^=e[n++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:i}=this;e[r]^=t,(128&t)!=0&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){es(this,!1),ei(e),this.finish();let t=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return er(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(eo(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new eT(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}function eM(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function eR(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function ek(e,...t){if(!eR(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function eD(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function eL(e){if("boolean"!=typeof e)throw Error(`boolean expected, not ${e}`)}em(()=>new eT(136,1,32)),Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;let eU=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));if(68!==new Uint8Array(new Uint32Array([0x11223344]).buffer)[0])throw Error("Non little-endian hardware is not supported");function eB(e){if("string"==typeof e)e=function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}(e);else if(eR(e))e=ez(e);else throw Error("Uint8Array expected, got "+typeof e);return e}function ej(e,t,r=!0){if(void 0===t)return new Uint8Array(e);if(t.length!==e)throw Error("invalid output length, expected "+e+", got: "+t.length);if(r&&t.byteOffset%4!=0)throw Error("invalid output, must be aligned");return t}
12function e$(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(0xffffffff),o=Number(r>>n&s),a=Number(r&s),c=4*!!i,l=4*!i;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)}function ez(e){return Uint8Array.from(e)}function eq(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}let eH=e=>Uint8Array.from(e.split("").map(e=>e.charCodeAt(0))),eF=eH("expand 16-byte k"),eW=eH("expand 32-byte k"),eV=eU(eF),eK=eU(eW);function eG(e,t){return e<<t|e>>>32-t}function eY(e){return e.byteOffset%4==0}let eJ=0x100000000-1,eX=new Uint32Array,eQ=(e,t)=>255&e[t++]|(255&e[t++])<<8;class eZ{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,ek(e=eB(e),32);let t=eQ(e,0),r=eQ(e,2),i=eQ(e,4),n=eQ(e,6),s=eQ(e,8),o=eQ(e,10),a=eQ(e,12),c=eQ(e,14);this.r[0]=8191&t,this.r[1]=(t>>>13|r<<3)&8191,this.r[2]=(r>>>10|i<<6)&7939,this.r[3]=(i>>>7|n<<9)&8191,this.r[4]=(n>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|o<<2)&8191,this.r[7]=(o>>>11|a<<5)&8065,this.r[8]=(a>>>8|c<<8)&8191,this.r[9]=c>>>5&127;for(let t=0;t<8;t++)this.pad[t]=eQ(e,16+2*t)}process(e,t,r=!1){let{h:i,r:n}=this,s=n[0],o=n[1],a=n[2],c=n[3],l=n[4],h=n[5],u=n[6],d=n[7],f=n[8],p=n[9],g=eQ(e,t+0),m=eQ(e,t+2),y=eQ(e,t+4),b=eQ(e,t+6),w=eQ(e,t+8),v=eQ(e,t+10),x=eQ(e,t+12),E=eQ(e,t+14),_=i[0]+(8191&g),I=i[1]+((g>>>13|m<<3)&8191),A=i[2]+((m>>>10|y<<6)&8191),S=i[3]+((y>>>7|b<<9)&8191),C=i[4]+((b>>>4|w<<12)&8191),N=i[5]+(w>>>1&8191),O=i[6]+((w>>>14|v<<2)&8191),P=i[7]+((v>>>11|x<<5)&8191),T=i[8]+((x>>>8|E<<8)&8191),M=i[9]+(E>>>5|2048*!r),R=0,k=0+_*s+5*p*I+5*f*A+5*d*S+5*u*C;R=k>>>13,k&=8191,k+=5*h*N+5*l*O+5*c*P+5*a*T+5*o*M,R+=k>>>13,k&=8191;let D=R+_*o+I*s+5*p*A+5*f*S+5*d*C;R=D>>>13,D&=8191,D+=5*u*N+5*h*O+5*l*P+5*c*T+5*a*M,R+=D>>>13,D&=8191;let L=R+_*a+I*o+A*s+5*p*S+5*f*C;R=L>>>13,L&=8191,L+=5*d*N+5*u*O+5*h*P+5*l*T+5*c*M,R+=L>>>13,L&=8191;let U=R+_*c+I*a+A*o+S*s+5*p*C;R=U>>>13,U&=8191,U+=5*f*N+5*d*O+5*u*P+5*h*T+5*l*M,R+=U>>>13,U&=8191;let B=R+_*l+I*c+A*a+S*o+C*s;R=B>>>13,B&=8191,B+=5*p*N+5*f*O+5*d*P+5*u*T+5*h*M,R+=B>>>13,B&=8191;let j=R+_*h+I*l+A*c+S*a+C*o;R=j>>>13,j&=8191,j+=N*s+5*p*O+5*f*P+5*d*T+5*u*M,R+=j>>>13,j&=8191;let $=R+_*u+I*h+A*l+S*c+C*a;R=$>>>13,$&=8191,$+=N*o+O*s+5*p*P+5*f*T+5*d*M,R+=$>>>13,$&=8191;let z=R+_*d+I*u+A*h+S*l+C*c;R=z>>>13,z&=8191,z+=N*a+O*o+P*s+5*p*T+5*f*M,R+=z>>>13,z&=8191;let q=R+_*f+I*d+A*u+S*h+C*l;R=q>>>13,q&=8191,q+=N*c+O*a+P*o+T*s+5*p*M,R+=q>>>13,q&=8191;let H=R+_*p+I*f+A*d+S*u+C*h;R=H>>>13,H&=8191,H+=N*l+O*c+P*a+T*o+M*s,R+=H>>>13,H&=8191,k=8191&(R=(R=(R<<2)+R|0)+k|0),R>>>=13,D+=R,i[0]=k,i[1]=D,i[2]=L,i[3]=U,i[4]=B,i[5]=j,i[6]=$,i[7]=z,i[8]=q,i[9]=H}finalize(){let{h:e,pad:t}=this,r=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let t=2;t<10;t++)e[t]+=i,i=e[t]>>>13,e[t]&=8191;e[0]+=5*i,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,r[0]=e[0]+5,i=r[0]>>>13,r[0]&=8191;for(let t=1;t<10;t++)r[t]=e[t]+i,i=r[t]>>>13,r[t]&=8191;r[9]-=8192;let n=(1^i)-1;for(let e=0;e<10;e++)r[e]&=n;n=~n;for(let t=0;t<10;t++)e[t]=e[t]&n|r[t];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let s=e[0]+t[0];e[0]=65535&s;for(let r=1;r<8;r++)s=(e[r]+t[r]|0)+(s>>>16)|0,e[r]=65535&s;eq(r)}update(e){eD(this);let{buffer:t,blockLen:r}=this,i=(e=eB(e)).length;for(let n=0;n<i;){let s=Math.min(r-this.pos,i-n);if(s===r){for(;r<=i-n;n+=r)this.process(e,n);continue}t.set(e.subarray(n,n+s),this.pos),this.pos+=s,n+=s,this.pos===r&&(this.process(t,0,!1),this.pos=0)}return this}destroy(){eq(this.h,this.r,this.buffer,this.pad)}digestInto(e){eD(this),function(e,t){ek(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished=!0;let{buffer:t,h:r}=this,{pos:i}=this;if(i){for(t[i++]=1;i<16;i++)t[i]=0;this.process(t,0,!0)}this.finalize();let n=0;for(let t=0;t<8;t++)e[n++]=r[t]>>>0,e[n++]=r[t]>>>8;return e}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}}let e0=function(e){let t=(t,r)=>e(r).update(eB(t)).digest(),r=e(new Uint8Array(32));return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}(e=>
12new eZ(e)),e1=function(e,t){let{allowShortKeys:r,extendNonceFn:i,counterLength:n,counterRight:s,rounds:o}=function(e,t){if(null==t||"object"!=typeof t)throw Error("options must be defined");return Object.assign(e,t)}({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if("function"!=typeof e)throw Error("core must be a function");return eM(n),eM(o),eL(s),eL(r),(t,a,c,l,h=0)=>{ek(t),ek(a),ek(c);let u=c.length;if(void 0===l&&(l=new Uint8Array(u)),ek(l),eM(h),h<0||h>=eJ)throw Error("arx: counter overflow");if(l.length<u)throw Error(`arx: output (${l.length}) is shorter than data (${u})`);let d=[],f=t.length,p,g;if(32===f)d.push(p=ez(t)),g=eK;else if(16===f&&r)(p=new Uint8Array(32)).set(t),p.set(t,16),g=eV,d.push(p);else throw Error(`arx: invalid 32-byte key, got length=${f}`);eY(a)||d.push(a=ez(a));let m=eU(p);if(i){if(24!==a.length)throw Error("arx: extended nonce must be 24 bytes");i(g,m,eU(a.subarray(0,16)),m),a=a.subarray(16)}let y=16-n;if(y!==a.length)throw Error(`arx: nonce must be ${y} or 16 bytes`);if(12!==y){let e=new Uint8Array(12);e.set(a,s?0:12-a.length),a=e,d.push(a)}return function(e,t,r,i,n,s,o,a){let c=n.length,l=new Uint8Array(64),h=eU(l),u=eY(n)&&eY(s),d=u?eU(n):eX,f=u?eU(s):eX;for(let p=0;p<c;o++){if(e(t,r,i,h,o,a),o>=eJ)throw Error("arx: counter overflow");let g=Math.min(64,c-p);if(u&&64===g){let e=p/4;if(p%4!=0)throw Error("arx: invalid block position");for(let t=0,r;t<16;t++)f[r=e+t]=d[r]^h[t];p+=64;continue}for(let e=0,t;e<g;e++)s[t=p+e]=n[t]^l[e];p+=g}}(e,g,m,eU(a),c,l,h,o),eq(...d),l}}(function(e,t,r,i,n,s=20){let o=e[0],a=e[1],c=e[2],l=e[3],h=t[0],u=t[1],d=t[2],f=t[3],p=t[4],g=t[5],m=t[6],y=t[7],b=r[0],w=r[1],v=r[2],x=o,E=a,_=c,I=l,A=h,S=u,C=d,N=f,O=p,P=g,T=m,M=y,R=n,k=b,D=w,L=v;for(let e=0;e<s;e+=2)O=O+(R=eG(R^(x=x+A|0),16))|0,x=x+(A=eG(A^O,12))|0,O=O+(R=eG(R^x,8))|0,A=eG(A^O,7),P=P+(k=eG(k^(E=E+S|0),16))|0,E=E+(S=eG(S^P,12))|0,P=P+(k=eG(k^E,8))|0,S=eG(S^P,7),T=T+(D=eG(D^(_=_+C|0),16))|0,_=_+(C=eG(C^T,12))|0,T=T+(D=eG(D^_,8))|0,C=eG(C^T,7),M=M+(L=eG(L^(I=I+N|0),16))|0,I=I+(N=eG(N^M,12))|0,M=M+(L=eG(L^I,8))|0,N=eG(N^M,7),T=T+(L=eG(L^(x=x+S|0),16))|0,x=x+(S=eG(S^T,12))|0,T=T+(L=eG(L^x,8))|0,S=eG(S^T,7),M=M+(R=eG(R^(E=E+C|0),16))|0,E=E+(C=eG(C^M,12))|0,M=M+(R=eG(R^E,8))|0,C=eG(C^M,7),O=O+(k=eG(k^(_=_+N|0),16))|0,_=_+(N=eG(N^O,12))|0,O=O+(k=eG(k^_,8))|0,N=eG(N^O,7),P=P+(D=eG(D^(I=I+A|0),16))|0,I=I+(A=eG(A^P,12))|0,P=P+(D=eG(D^I,8))|0,A=eG(A^P,7);let U=0;i[U++]=o+x|0,i[U++]=a+E|0,i[U++]=c+_|0,i[U++]=l+I|0,i[U++]=h+A|0,i[U++]=u+S|0,i[U++]=d+C|0,i[U++]=f+N|0,i[U++]=p+O|0,i[U++]=g+P|0,i[U++]=m+T|0,i[U++]=y+M|0,i[U++]=n+R|0,i[U++]=b+k|0,i[U++]=w+D|0,i[U++]=v+L|0},{counterRight:!1,counterLength:4,allowShortKeys:!1}),e2=new Uint8Array(16),e3=(e,t)=>{e.update(t);let r=t.length%16;r&&e.update(e2.subarray(r))},e8=new Uint8Array(32);function e5(e,t,r,i,n){let s=e(t,r,e8),o=e0.create(s);n&&e3(o,n),e3(o,i);let a=new Uint8Array(16),c=new DataView(a.buffer,a.byteOffset,a.byteLength);e$(c,0,BigInt(n?n.length:0),!0),e$(c,8,BigInt(i.length),!0),o.update(a);let l=o.digest();return eq(s,a),l}let e6=((e,t)=>{function r(i,...n){if(ek(i),void 0!==e.nonceLength){let t=n[0];if(!t)throw Error("nonce / iv required");e.varSizeNonce?ek(t):ek(t,e.nonceLength)}let s=e.tagLength;s&&void 0!==n[1]&&ek(n[1]);let o=t(i,...n),a=(e,t)=>{if(void 0!==t){if(2!==e)throw Error("cipher output not supported");ek(t)}},c=!1;return{encrypt(e,t){if(c)throw Error("cannot encrypt() twice with same key + nonce");return c=!0,ek(e),a(o.encrypt.length,t),o.encrypt(e,t)},decrypt(e,t){if(ek(e),s&&e.length<s)throw Error("invalid ciphertext length: smaller than tagLength="+s);return a(o.decrypt.length,t),o.decrypt(e,t)}}}return Object.assign(r,e),r})({blockSize:64,nonceLength:12,tagLength:16},(e=>(t,r,i)=>({encrypt(n,s){let o=n.length;(s=ej(o+16,s,!1)).set(n);let a=s.subarray(0,-16);e(t,r,a,a,1);let c=e5(e,t,r,a,i);return s.set(c,o),eq(c),s},decrypt(n,s){s=ej(n.length-16,s,!1);let o=n.subarray(0,-16),a=n.subarray(-16),c=e5(e,t,r,o,i);if(!function(e,t){if(e.length!==t.length)return!1;let r=0;for(let i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r}(a,c))throw Error("invalid tag");return s.set(n.subarray(0,-16)),e(t,r,s,s,1),eq(c),s}}))(e1));class e4 extends eg{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,en(e);let r=ep(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,n=new Uint8Array(i);n.set(r.length>i?e.create().update(r).digest():r);for(let e=0;e<n.length;e++)n[e]^=54;this.iHash.update(n),this.oHash=e.create();for(let e=0;e<n.length;e++)n[e]^=106;this.oHash.update(n),n.fill(0)}update(e){return es(this),this.iHash.update(e),this}digestInto(e){es(this),ei(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:r,finished:i,destroyed:n,blockLen:s,outputLen:o}=this;return e.finished=i,e.destroyed=n,e.blockLen=s,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let e9=(e,t,r)=>new e4(e,t).update(r).digest();e9.create=(e,t)=>
12new e4(e,t);let e7=new Uint8Array([0]),te=new Uint8Array;class tt extends eg{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=eh(this.buffer)}update(e){es(this);let{view:t,buffer:r,blockLen:i}=this,n=(e=ep(e)).length;for(let s=0;s<n;){let o=Math.min(i-this.pos,n-s);if(o===i){let t=eh(e);for(;i<=n-s;s+=i)this.process(t,s);continue}r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){es(this),eo(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:i,isLE:n}=this,{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(r,0),s=0);for(let e=s;e<i;e++)t[e]=0;(function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(0xffffffff),o=Number(r>>n&s),a=Number(r&s),c=4*!!i,l=4*!i;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)})(r,i-8,BigInt(8*this.length),n),this.process(r,0);let o=eh(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=a/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)o.setUint32(4*e,l[e],n)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:i,finished:n,destroyed:s,pos:o}=this;return e.length=i,e.pos=o,e.finished=n,e.destroyed=s,i%t&&e.buffer.set(r),e}}let tr=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),ti=new Uint32Array([0x6a09e66
127,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),tn=new Uint32Array(64);class ts extends tt{constructor(){super(64,32,8,!1),this.A=0|ti[0],this.B=0|ti[1],this.C=0|ti[2],this.D=0|ti[3],this.E=0|ti[4],this.F=0|ti[5],this.G=0|ti[6],this.H=0|ti[7]}get(){let{A:e,B:t,C:r,D:i,E:n,F:s,G:o,H:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)tn[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=tn[e-15],r=tn[e-2],i=eu(t,7)^eu(t,18)^t>>>3,n=eu(r,17)^eu(r,19)^r>>>10;tn[e]=n+tn[e-7]+i+tn[e-16]|0}let{A:r,B:i,C:n,D:s,E:o,F:a,G:c,H:l}=this;for(let e=0;e<64;e++){var h,u,d,f;let t=l+(eu(o,6)^eu(o,11)^eu(o,25))+((h=o)&a^~h&c)+tr[e]+tn[e]|0,p=(eu(r,2)^eu(r,13)^eu(r,22))+((u=r)&(d=i)^u&(f=n)^d&f)|0;l=c,c=a,a=o,o=s+t|0,s=n,n=i,i=r,r=t+p|0}r=r+this.A|0,i=i+this.B|0,n=n+this.C|0,s=s+this.D|0,o=o+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,i,n,s,o,a,c,l)}roundClean(){tn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let to=em(()=>new ts),ta=BigInt(0);function tc(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function tl(e){if(!tc(e))throw Error("Uint8Array expected")}let th=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),tu={_0:48,_9:57,A:65,F:70,a:97,f:102};function td(e){return e>=tu._0&&e<=tu._9?e-tu._0:e>=tu.A&&e<=tu.F?e-(tu.A-10):e>=tu.a&&e<=tu.f?e-(tu.a-10):void 0}function tf(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let i=new Uint8Array(r);for(let t=0,n=0;t<r;t++,n+=2){let r=td(e.charCodeAt(n)),s=td(e.charCodeAt(n+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[n]+e[n+1])+'" at index '+n);i[t]=16*r+s}return i}function tp(e){return tl(e),function(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?ta:BigInt("0x"+e)}(function(e){tl(e);let t="";for(let r=0;r<e.length;r++)t+=th[e[r]];return t}(Uint8Array.from(e).reverse()))}function tg(e,t,r){let i;if("string"==typeof t)try{i=tf(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if(tc(t))i=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let n=i.length;if("number"==typeof r&&n!==r)throw Error(e+" of length "+r+" expected, got "+n);return i}let tm=e=>"bigint"==typeof e&&ta<=e;function ty(e,t,r,i){if(!(tm(t)&&tm(r)&&tm(i))||!(r<=t)||!(t<i))throw Error("expected valid "+e+": "+r+" <= n < "+i+", got "+t)}let tb={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||tc(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)},tw=BigInt(0),tv=BigInt(1);function tx(e,t){let r=e%t;return r>=tw?r:t+r}function tE(e,t,r){let i=e;for(;t-- >tw;)i*=i,i%=r;return i}BigInt(0),BigInt(1),BigInt(0),BigInt(1),BigInt(2),BigInt(8);let t_=BigInt(0),tI=BigInt(1),tA=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);let tS=BigInt(1),tC=BigInt(2),tN=BigInt(3),tO=BigInt(5);BigInt(8);let tP=function(e){let t=(function(e,t,r={}){let i=(t,r,i)=>{let n=tb[r];if("function"!=typeof n)throw Error("invalid validator function");let s=e[t];if(!(i&&void 0===s)&&!n(s,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))i(e,r,!1);for(let[e,t]of Object.entries(r))i(e,t,!0)}(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})),{P:r}=t,i=e=>tx(e,r),n=t.montgomeryBits,s=Math.ceil(n/8),o=t.nByteLength,a=t.adjustScalarBytes||(e=>e),c=t.powPminus2||(e=>(function(e,t,r){if(t<tw)throw Error("invalid exponent, negatives unsupported");if(r<=tw)throw Error("invalid modulus");if(r===tv)return tw;let i=tv;for(;t>tw;)t&tv&&(i=i*e%r),e=e*e%r,t>>=tv;return i})(e,r-BigInt(2),r));function l(e,t,r){let n=i(e*(t-r));return[t=i(t-n),r=i(r+n)]}let h=(t.a-BigInt(2))/BigInt(4);function u(e){var t;return t=i(e),tf(t.toString(16).padStart(2*s,"0")).reverse()}function d(e,t){let d=function(e,t){ty("u",e,t_,r),ty("scalar",t,t_,r);let s=tI,o=t_,a=e,u=tI,d=t_,f;for(let r=BigInt(n-1);r>=t_;r--){let n=t>>r&tI;d^=n,s=(f=l(d,s,a))[0],a=f[1],o=(f=l(d,o,u))[0],u=f[1],d=n;let c=s+o,p=i(c*c),g=s-o,m=i(g*g),y=p-m,b=a+u,w=i((a-u)*c),v=i(b*g),x=w+v,E=w-v;a=i(x*x),u=i(e*i(E*E)),s=i(p*m),o=i(y*(p+i(h*y)))}return s=(f=l(d,s,a))[0],a=f[1],o=(f=l(d,o,u))[0],u=f[1],i(s*c(o))}(function(e){let t=tg("u coordinate",e,s);return 32===o&&(t[31]&=127),tp(t)}(t),function(e){let t=tg("scalar",e),r=t.length;if(r!==s&&r!==o)throw Error("invalid scalar, expected "+(""+s+" or ")+o+" bytes, got "+r);return tp(a(t))}(e));if(d===t_)throw Error("invalid private or public key received");return u(d)}let f=u(t.Gu);function p(e){return d(e,f)}return{scalarMult:d,scalarMultBase:p,getSharedSecret:(e,t)=>d(e,t),getPublicKey:e=>p(e),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:f}}({P:tA,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{let{pow_p_5_8:t,b2:r}=function(e){let t=BigInt(10),r=BigInt(20),i=BigInt(40),n=BigInt(80),s=e*e%tA*e%tA,o=tE(s,tC,tA)*s%tA,a=tE(o,tS,tA)*e%tA,c=tE(a,tO,tA)*a%tA,l=tE(c,t,tA)*c%tA,h=tE(l,r,tA)*l%tA,u=tE(h,i,tA)*h%tA,d=tE(u,n,tA)*u%tA,f=tE(d,n,tA)*u%tA,p=tE(f,t,tA)*c%tA;return{pow_p_5_8:tE(p,tC,tA)*e%tA,b2:s}}(e);return tx(tE(t,tN,tA)*r,tA)}
12,adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},randomBytes:ey}),tT="base10",tM="base16",tR="base64pad",tk="utf8";function tD(){let e=ey(32);return(0,k.dI)(e,tM)}function tL(e){let t=to((0,k.sH)(e,tk));return(0,k.dI)(t,tM)}function tU(e){return(0,k.sH)(`${e}`,tT)}function tB(e){return Number((0,k.dI)(e,tT))}function tj(e){let{encoding:t=tR}=e;if(2===tB(e.type))return(0,k.dI)((0,k.xW)([e.type,e.sealed]),t);if(1===tB(e.type)){if(typeof e.senderPublicKey>"u")throw Error("Missing sender public key for type 1 envelope");return(0,k.dI)((0,k.xW)([e.type,e.senderPublicKey,e.iv,e.sealed]),t)}return(0,k.dI)((0,k.xW)([e.type,e.iv,e.sealed]),t)}function t$(e){let{encoded:t,encoding:r=tR}=e,i=(0,k.sH)(t,r),n=i.slice(0,1);if(1===tB(n)){let e=i.slice(1,33),t=i.slice(33,45);return{type:n,sealed:i.slice(45),iv:t,senderPublicKey:e}}if(2===tB(n))return{type:n,sealed:i.slice(1),iv:ey(12)};let s=i.slice(1,13);return{type:n,sealed:i.slice(13),iv:s}}function tz(e){let t=e?.type||0;if(1===t){if(typeof e?.senderPublicKey>"u")throw Error("missing sender public key");if(typeof e?.receiverPublicKey>"u")throw Error("missing receiver public key")}return{type:t,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function tq(e){return 1===e.type&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}function tH(e){return e?.relay||{protocol:"irn"}}function tF(e){let t=L.CG[e];if(typeof t>"u")throw Error(`Relay Protocol not supported: ${e}`);return t}function tW(e){var t;if(!e.includes("wc:")){let t=et(e);null!=t&&t.includes("wc:")&&(e=t)}let r=(e=(e=e.includes("wc://")?e.replace("wc://",""):e).includes("wc:")?e.replace("wc:",""):e).indexOf(":"),i=-1!==e.indexOf("?")?e.indexOf("?"):void 0,n=e.substring(0,r),s=e.substring(r+1,i).split("@"),o=new URLSearchParams("u">typeof i?e.substring(i):""),a={};o.forEach((e,t)=>{a[t]=e});let c="string"==typeof a.methods?a.methods.split(","):void 0;return{protocol:n,topic:(t=s[0]).startsWith("//")?t.substring(2):t,version:parseInt(s[1],10),symKey:a.symKey,relay:function(e,t="-"){let r={},i="relay"+t;return Object.keys(e).forEach(t=>{if(t.startsWith(i)){let n=t.replace(i,""),s=e[t];r[n]=s}}),r}(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function tV(e){let t=new URLSearchParams,r=function(e,t="-"){let r={};return Object.keys(e).forEach(i=>{e[i]&&(r["relay"+t+i]=e[i])}),r}(e.relay);Object.keys(r).sort().forEach(e=>{t.set(e,r[e])}),t.set("symKey",e.symKey),e.expiryTimestamp&&t.set("expiryTimestamp",e.expiryTimestamp.toString()),e.methods&&t.set("methods",e.methods.join(","));let i=t.toString();return`${e.protocol}:${e.topic}@${e.version}?${i}`}Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;let tK={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},tG={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function tY(e,t){let{message:r,code:i}=tG[e];return{message:t?`${r} ${t}`:r,code:i}}function tJ(e,t){let{message:r,code:i}=tK[e];return{message:t?`${r} ${t}`:r,code:i}}function tX(e){return typeof e>"u"}function tQ(e,t){return!!(t&&tX(e))||"string"==typeof e&&!!e.trim().length}function tZ(e){return"u">typeof e}function t0(){let e=H();return new Promise(t=>{switch(e){case j.browser:t(q()&&navigator?.onLine);break;case j.reactNative:t(t1());break;case j.node:default:t(!0)}})}async function t1(){if(z()&&"u">typeof r.g&&null!=r.g&&r.g.NetInfo){let e=await (null==r.g?void 0:r.g.NetInfo.fetch());return e?.isConnected}return!0}var t2=r(4871),t3=r(50155),t8=r(11419),t5=r(81029).Buffer;let t6="core",t4=`wc@2:${t6}:`,t9={logger:"error"},t7={database:":memory:"},re="client_ed25519_seed",rt=C.ONE_DAY,rr=C.SIX_HOURS,ri="wss://relay.walletconnect.org",rn={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},rs={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},ro="2.19.1",ra={link_mode:"link_mode",relay:"relay"},rc={inbound:"inbound",outbound:"outbound"},rl="WALLETCONNECT_LINK_MODE_APPS",rh={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},ru=(C.FIVE_SECONDS,{wc_pairingDelete:{req:{ttl:C.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:C.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:C.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:C.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:C.ONE_DAY,prompt:!1,tag:0},res:{ttl:C.ONE_DAY,prompt:!1,tag:0}}}),rd={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},rf={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},rp={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},rg="https://verify.walletconnect.org",rm=`${rg}/v3`,ry=["https://verify.walletconnect.com",rg],rb={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},rw={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},rv={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},rx={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},rE={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"}
12,r_={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"};var rI=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==r[o])throw TypeError(s+" is ambiguous");r[o]=n}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function u(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[0]){for(var i=0,n=0;e[t]===c;)i++,t++;for(var s=(e.length-t)*l+1>>>0,o=new Uint8Array(s);e[t];){var h=r[e.charCodeAt(t)];if(255===h)return;for(var u=0,d=s-1;(0!==h||u<n)&&-1!==d;d--,u++)h+=a*o[d]>>>0,o[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw Error("Non-zero carry");n=u,t++}if(" "!==e[t]){for(var f=s-n;f!==s&&0===o[f];)f++;for(var p=new Uint8Array(i+(s-f)),g=i;f!==s;)p[g++]=o[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*h+1>>>0,l=new Uint8Array(o);n!==s;){for(var u=t[n],d=0,f=o-1;(0!==u||d<i)&&-1!==f;f--,d++)u+=256*l[f]>>>0,l[f]=u%a>>>0,u=u/a>>>0;if(0!==u)throw Error("Non-zero carry");i=d,n++}for(var p=o-i;p!==o&&0===l[p];)p++;for(var g=c.repeat(r);p<o;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:u,decode:function(e){var r=u(e);if(r)return r;throw Error(`Non-${t} character`)}}};let rA=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error("Unknown type, must be binary type")};class rS{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class rC{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return rO(this,e)}}class rN{constructor(e){this.decoders=e}or(e){return rO(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}let rO=(e,t)=>new rN({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});
12class rP{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new rS(e,t,r),this.decoder=new rC(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let rT=({name:e,prefix:t,encode:r,decode:i})=>new rP(e,t,r,i),rM=({prefix:e,name:t,alphabet:r})=>{let{encode:i,decode:n}=rI(r,t);return rT({prefix:e,name:t,encode:i,decode:e=>rA(n(e))})},rR=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>rT({prefix:t,name:e,encode:e=>((e,t,r)=>{let i="="===t[t.length-1],n=(1<<r)-1,s="",o=0,a=0;for(let i=0;i<e.length;++i)for(a=a<<8|e[i],o+=8;o>r;)o-=r,s+=t[n&a>>o];if(o&&(s+=t[n&a<<r-o]),i)for(;s.length*r&7;)s+="=";return s})(e,i,r),decode:t=>((e,t,r,i)=>{let n={};for(let e=0;e<t.length;++e)n[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;let o=new Uint8Array(s*r/8|0),a=0,c=0,l=0;for(let t=0;t<s;++t){let s=n[e[t]];if(void 0===s)throw SyntaxError(`Non-${i} character`);c=c<<r|s,(a+=r)>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw SyntaxError("Unexpected end of data");return o})(t,i,r,e)});var rk=Object.freeze({__proto__:null,identity:rT({prefix:"\0",name:"identity",encode:e=>new TextDecoder().decode(e),decode:e=>new TextEncoder().encode(e)})}),rD=Object.freeze({__proto__:null,base2:rR({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})}),rL=Object.freeze({__proto__:null,base8:rR({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})}),rU=Object.freeze({__proto__:null,base10:rM({prefix:"9",name:"base10",alphabet:"0123456789"})}),rB=Object.freeze({__proto__:null,base16:rR({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper:rR({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});let rj=rR({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),r$=rR({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rz=rR({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rq=rR({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),rH=rR({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),rF=rR({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),rW=rR({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5});var rV=Object.freeze({__proto__:null,base32:rj,base32upper:r$,base32pad:rz,base32padupper:rq,base32hex:rH,base32hexupper:rF,base32hexpad:rW,base32hexpadupper:rR({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z:rR({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}),rK=Object.freeze({__proto__:null,base36:rM({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper:rM({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})}),rG=Object.freeze({__proto__:null,base58btc:rM({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr:rM({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});let rY=rR({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),rJ=rR({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6});var rX=Object.freeze({__proto__:null,base64:rY,base64pad:rJ,base64url:rR({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad:rR({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});let rQ=Array.from("\uD83D\uDE80\uD83E\uDE90â\uD83D\uDEF0\uD83C\uDF0C\uD83C\uDF11\uD83C\uDF12\uD83C\uDF13\uD83C\uDF14\uD83C\uDF15\uD83C\uDF16\uD83C\uDF17\uD83C\uDF18\uD83C\uDF0D\uD83C\uDF0F\uD83C\uDF0E\uD83D\uDC09â\uD83D\uDCBB\uD83D\uDDA5\uD83D\uDCBE\uD83D\uDCBF\uD83D\uDE02â¤\uD83D\uDE0D\uD83E\uDD23\uD83D\uDE0A\uD83D\uDE4F\uD83D\uDC95\uD83D\uDE2D\uD83D\uDE18\uD83D\uDC4D\uD83D\uDE05\uD83D\uDC4F\uD83D\uDE01\uD83D\uDD25\uD83E\uDD70\uD83D\uDC94\uD83D\uDC96\uD83D\uDC99\uD83D\uDE22\uD83E\uDD14\uD83D\uDE06\uD83D\uDE44\uD83D\uDCAA\uD83D\uDE09âº\uD83D\uDC4C\uD83E\uDD17\uD83D\uDC9C\uD83D\uDE14\uD83D\uDE0E\uD83D\uDE07\uD83C\uDF39\uD83E\uDD26\uD83C\uDF89\uD83D\uDC9Eââ¨\uD83E\uDD37\uD83D\uDE31\uD83D\uDE0C\uD83C\uDF38\uD83D\uDE4C\uD83D\uDE0B\uD83D\uDC97\uD83D\uDC9A\uD83D\uDE0F\uD83D\uDC9B\uD83D\uDE42\uD83D\uDC93\uD83E\uDD29\uD83D\uDE04\uD83D\uDE00\uD83D\uDDA4\uD83D\uDE03\uD83D\uDCAF\uD83D\uDE48\uD83D\uDC47\uD83C\uDFB6\uD83D\uDE12\uD83E\uDD2Dâ£\uD83D\uDE1C\uD83D\uDC8B\uD83D\uDC40\uD83D\uDE2A\uD83D\uDE11\uD83D\uDCA5\uD83D\uDE4B\uD83D\uDE1E\uD83D\uDE29\uD83D\uDE21\uD83E\uDD2A\uD83D\uDC4A\uD83E\uDD73\uD83D\uDE25\uD83E\uDD24\uD83D\uDC49\uD83D\uDC83\uD83D\uDE33â\uD83D\uDE1A\uD83D\uDE1D\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE2C\uD83D\uDE43\uD83C\uDF40\uD83C\uDF37\uD83D\uDE3B\uD83D\uDE13ââ
\uD83E\uDD7A\uD83C\uDF08\uD83D\uDE08\uD83E\uDD18\uD83D\uDCA6â\uD83D\uDE23\uD83C\uDFC3\uD83D\uDC90â¹\uD83C\uDF8A\uD83D\uDC98\uD83D\uDE20â\uD83D\uDE15\uD83C\uDF3A\uD83C\uDF82\uD83C\uDF3B\uD83D\uDE10\uD83D\uDD95\uD83D\uDC9D\uD83D\uDE4A\uD83D\uDE39\uD83D\uDDE3\uD83D\uDCAB\uD83D\uDC80\uD83D\uDC51\uD83C\uDFB5\uD83E\uDD1E\uD83D\uDE1B\uD83D\uDD34\uD83D\uDE24\uD83C\uDF3C\uD83D\uDE2Bâ½\uD83E\uDD19â\uD83C\uDFC6\uD83E\uDD2B\uD83D\uDC48\uD83D\uDE2E\uD83D\uDE46\uD83C\uDF7B\uD83C\uDF43\uD83D\uDC36\uD83D\uDC81\uD83D\uDE32\uD83C\uDF3F\uD83E\uDDE1\uD83C\uDF81â¡\uD83C\uDF1E\uD83C\uDF88ââ\uD83D\uDC4B\uD83D\uDE30\uD83E\uDD28\uD83D\uDE36\uD83E\uDD1D\uD83D\uDEB6\uD83D\uDCB0\uD83C\uDF53\uD83D\uDCA2\uD83E\uDD1F\uD83D\uDE41\uD83D\uDEA8\uD83D\uDCA8\uD83E\uDD2Câ\uD83C\uDF80\uD83C\uDF7A\uD83E\uDD13\uD83D\uDE19\uD83D\uDC9F\uD83C\uDF31\uD83D\uDE16\uD83D\uDC76\uD83E\uDD74â¶â¡â\uD83D\uDC8E\uD83D\uDCB8â¬\uD83D\uDE28\uD83C\uDF1A\uD83E\uDD8B\uD83D\uDE37\uD83D\uDD7Aâ \uD83D\uDE45\uD83D\uDE1F\uD83D\uDE35\uD83D\uDC4E\uD83E\uDD32\uD83E\uDD20\uD83E\uDD27\uD83D\uDCCC\uD83D\uDD35\uD83D\uDC85\uD83E\uDDD0\uD83D\uDC3E\uD83C\uDF52\uD83D\uDE17\uD83E\uDD11\uD83C\uDF0A\uD83E\uDD2F\uD83D\uDC37â\uD83D\uDCA7\uD83D\uDE2F\uD83D\uDC86\uD83D\uDC46\uD83C\uDFA4\uD83D\uDE47\uD83C\uDF51â\uD83C\uDF34\uD83D\uDCA3\uD83D\uDC38\uD83D\uDC8C\uD83D\uDCCD\uD83E\uDD40\uD83E\uDD22\uD83D\uDC45\uD83D\uDCA1\uD83D\uDCA9\uD83D\uDC50\uD83D\uDCF8\uD83D\uDC7B\uD83E\uDD10\uD83E\uDD2E\uD83C\uDFBC\uD83E\uDD75\uD83D\uDEA9\uD83C\uDF4E\uD83C\uDF4A\uD83D\uDC7C\uD83D\uDC8D\uD83D\uDCE3\uD83E\uDD42"),rZ=rQ.reduce((e,t,r)=>(e[r]=t,e),[]),r0=rQ.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);var r1=Object.freeze({__proto__:null,base256emoji:rT({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>
12e+=rZ[t],"")},decode:function(e){let t=[];for(let r of e){let e=r0[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}})});function r2(e,t,r){t=t||[],r=r||0;for(var i=r;e>=0x80000000;)t[r++]=255&e|128,e/=128;for(;-128&e;)t[r++]=255&e|128,e>>>=7;return t[r]=0|e,r2.bytes=r-i+1,t}var r3={encode:r2,encodingLength:function(e){return e<128?1:e<16384?2:e<2097152?3:e<0x10000000?4:e<0x800000000?5:e<0x40000000000?6:e<0x2000000000000?7:e<0x100000000000000?8:e<0x8000000000000000?9:10}};let r8=(e,t,r=0)=>(r3.encode(e,t,r),t),r5=e=>r3.encodingLength(e),r6=(e,t)=>{let r=t.byteLength,i=r5(e),n=i+r5(r),s=new Uint8Array(n+r);return r8(e,s,0),r8(r,s,i),s.set(t,n),new r4(e,r,t,s)};class r4{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}let r9=({name:e,code:t,encode:r})=>new r7(e,t,r);class r7{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?r6(this.code,t):t.then(e=>r6(this.code,e))}throw Error("Unknown type, must be binary type")}}let ie=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));var it=Object.freeze({__proto__:null,sha256:r9({name:"sha2-256",code:18,encode:ie("SHA-256")}),sha512:r9({name:"sha2-512",code:19,encode:ie("SHA-512")})}),ir=Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:rA,digest:e=>r6(0,rA(e))}});new TextEncoder,new TextDecoder;let ii={...rk,...rD,...rL,...rU,...rB,...rV,...rK,...rG,...rX,...r1};function is(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}({...it,...ir});let io=is("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),ia=is("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{let t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),ic={utf8:io,"utf-8":io,hex:ii.base16,latin1:ia,ascii:ia,binary:ia,...ii};var il=Object.defineProperty,ih=(e,t,r)=>((e,t,r)=>t in e?il(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class iu{constructor(e,t){this.core=e,this.logger=t,ih(this,"keychain",new Map),ih(this,"name","keychain"),ih(this,"version","0.3"),ih(this,"initialized",!1),ih(this,"storagePrefix",t4),ih(this,"init",async()=>{if(!this.initialized){let e=await this.getKeyChain();"u">typeof e&&(this.keychain=e),this.initialized=!0}}),ih(this,"has",e=>(this.isInitialized(),this.keychain.has(e))),ih(this,"set",async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()}),ih(this,"get",e=>{this.isInitialized();let t=this.keychain.get(e);if(typeof t>"u"){let{message:t}=tY("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}),ih(this,"del",async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()}),this.core=e,this.logger=(0,a.U5)(t,this.name)}get context(){return(0,a.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,V(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?K(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=tY("NOT_INITIALIZED",this.name);throw Error(e)}}}var id=Object.defineProperty,ip=(e,t,r)=>((e,t,r)=>t in e?id(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class ig{constructor(e,t,r){this.core=e,this.logger=t,ip(this,"name","crypto"),ip(this,"keychain"),ip(this,"randomSessionIdentifier",tD()),ip(this,"initialized",!1),ip(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),ip(this,"hasKeys",e=>(this.isInitialized(),this.keychain.has(e))),ip(this,"getClientId",async()=>{this.isInitialized();let e=await this.getClientSeed(),t=O.TZ(e);return O.UF(t.publicKey)}),ip(this,"generateKeyPair",()=>{this.isInitialized();let e=function(){let e=tP.utils.randomPrivateKey(),t=tP.getPublicKey(e);return{privateKey:(0,k.dI)(e,tM),publicKey:(0,k.dI)(t,tM)}}();return this.setPrivateKey(e.publicKey,e.privateKey)}),ip(this,"signJWT",async e=>{this.isInitialized();let t=await this.getClientSeed(),r=O.TZ(t),i=this.randomSessionIdentifier;return await O.FA(i,e,rt,r)}),ip(this,"generateSharedKey",(e,t,r)=>{this.isInitialized();let i=function(e,t){var r;let i,n=tP.getSharedSecret((0,k.sH)(e,tM),(0,k.sH)(t,tM)),s=(i=void 0,function(e,t,r,i=32){if(en(e),er(i),i>255*e.outputLen)throw Error("Length should be <= 255*HashLen");let n=Math.ceil(i/e.outputLen);void 0===r&&(r=te);let s=new Uint8Array(n*e.outputLen),o=e9.create(e,t),a=o._cloneInto(),c=new Uint8Array(o.outputLen);for(let t=0;t<n;t++)e7[0]=t+1,a.update(0===t?te:c).update(r).update(e7).digestInto(c),s.set(c,e.outputLen*t),o._cloneInto(a);return o.destroy(),a.destroy(),c.fill(0),e7.fill(0),s.slice(0,i)}(to,(r=void 0,en(to),void 0===r&&(r=new Uint8Array(to.outputLen)),e9(to,ep(r),ep(n))),i,32));return(0,k.dI)(s,tM)}(this.getPrivateKey(e),t);return this.setSymKey(i,r)}),ip(this,"setSymKey",async(e,t)=>{this.isInitialized();let r=t||function(e){let t=to((0,k.sH)(e,tM));return(0,k.dI)(t,tM)}(e);return await this.keychain.set(r,e),r}),ip(this,"deleteKeyPair",async e=>{this.isInitialized(),await this.keychain.del(e)}),ip(this,"deleteSymKey",async e=>{this.isInitialized(),await this.keychain.del(e)}),ip(this,"encode",async(e,t,r)=>{this.isInitialized();let i=tz(r),n=(0,N.h)(t);if(2===i.type)return function(e,t){let r=tU(2),i=ey(12);return tj({type:r,sealed:(0,k.sH)(e,tk),iv:i,encoding:t})}(n,r?.encoding);
12if(tq(i)){let t=i.senderPublicKey,r=i.receiverPublicKey;e=await this.generateSharedKey(t,r)}let s=this.getSymKey(e),{type:o,senderPublicKey:a}=i;return function(e){let t=tU("u">typeof e.type?e.type:0);if(1===tB(t)&&typeof e.senderPublicKey>"u")throw Error("Missing sender public key for type 1 envelope");let r="u">typeof e.senderPublicKey?(0,k.sH)(e.senderPublicKey,tM):void 0,i="u">typeof e.iv?(0,k.sH)(e.iv,tM):ey(12);return tj({type:t,sealed:e6((0,k.sH)(e.symKey,tM),i).encrypt((0,k.sH)(e.message,tk)),iv:i,senderPublicKey:r,encoding:e.encoding})}({type:o,symKey:s,message:n,senderPublicKey:a,encoding:r?.encoding})}),ip(this,"decode",async(e,t,r)=>{this.isInitialized();let i=function(e,t){let r=t$({encoded:e,encoding:t?.encoding});return tz({type:tB(r.type),senderPublicKey:"u">typeof r.senderPublicKey?(0,k.dI)(r.senderPublicKey,tM):void 0,receiverPublicKey:t?.receiverPublicKey})}(t,r);if(2===i.type){let e=function(e,t){let{sealed:r}=t$({encoded:e,encoding:t});return(0,k.dI)(r,tk)}(t,r?.encoding);return(0,N.j)(e)}if(tq(i)){let t=i.receiverPublicKey,r=i.senderPublicKey;e=await this.generateSharedKey(t,r)}try{let i=this.getSymKey(e),n=function(e){let t=(0,k.sH)(e.symKey,tM),{sealed:r,iv:i}=t$(e),n=e6(t,i).decrypt(r);if(null===n)throw Error("Failed to decrypt");return(0,k.dI)(n,tk)}({symKey:i,encoded:t,encoding:r?.encoding});return(0,N.j)(n)}catch(t){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(t)}}),ip(this,"getPayloadType",(e,t=tR)=>tB(t$({encoded:e,encoding:t}).type)),ip(this,"getPayloadSenderPublicKey",(e,t=tR)=>{let r=t$({encoded:e,encoding:t});return r.senderPublicKey?(0,k.dI)(r.senderPublicKey,tM):void 0}),this.core=e,this.logger=(0,a.U5)(t,this.name),this.keychain=r||new iu(this.core,this.logger)}get context(){return(0,a.oI)(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(re)}catch{e=tD(),await this.keychain.set(re,e)}return function(e,t="utf8"){let r=ic[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?globalThis.Buffer.from(e,"utf8"):r.decoder.decode(`${r.prefix}${e}`)}(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=tY("NOT_INITIALIZED",this.name);throw Error(e)}}}var im=Object.defineProperty,iy=Object.defineProperties,ib=Object.getOwnPropertyDescriptors,iw=Object.getOwnPropertySymbols,iv=Object.prototype.hasOwnProperty,ix=Object.prototype.propertyIsEnumerable,iE=(e,t,r)=>t in e?im(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i_=(e,t,r)=>iE(e,"symbol"!=typeof t?t+"":t,r);class iI extends p{constructor(e,t){super(e,t),this.logger=e,this.core=t,i_(this,"messages",new Map),i_(this,"messagesWithoutClientAck",new Map),i_(this,"name","messages"),i_(this,"version","0.3"),i_(this,"initialized",!1),i_(this,"storagePrefix",t4),i_(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let e=await this.getRelayerMessages();"u">typeof e&&(this.messages=e);let t=await this.getRelayerMessagesWithoutClientAck();"u">typeof t&&(this.messagesWithoutClientAck=t),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}finally{this.initialized=!0}}}),i_(this,"set",async(e,t,r)=>{this.isInitialized();let i=tL(t),n=this.messages.get(e);if(typeof n>"u"&&(n={}),"u">typeof n[i])return i;if(n[i]=t,this.messages.set(e,n),r===rc.inbound){let r=this.messagesWithoutClientAck.get(e)||{};this.messagesWithoutClientAck.set(e,iy(((e,t)=>{for(var r in t||(t={}))iv.call(t,r)&&iE(e,r,t[r]);if(iw)for(var r of iw(t))ix.call(t,r)&&iE(e,r,t[r]);return e})({},r),ib({[i]:t})))}return await this.persist(),i}),i_(this,"get",e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t}),i_(this,"getWithoutAck",e=>{this.isInitialized();let t={};for(let r of e){let e=this.messagesWithoutClientAck.get(r)||{};t[r]=Object.values(e)}return t}),i_(this,"has",(e,t)=>(this.isInitialized(),"u">typeof this.get(e)[tL(t)])),i_(this,"ack",async(e,t)=>{this.isInitialized();let r=this.messagesWithoutClientAck.get(e);if(typeof r>"u")return;let i=tL(t);delete r[i],0===Object.keys(r).length?this.messagesWithoutClientAck.delete(e):this.messagesWithoutClientAck.set(e,r),await this.persist()}),i_(this,"del",async e=>{this.isInitialized(),this.messages.delete(e),this.messagesWithoutClientAck.delete(e),await this.persist()}),this.logger=(0,a.U5)(e,this.name),this.core=t}
12get context(){return(0,a.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,V(e))}async setRelayerMessagesWithoutClientAck(e){await this.core.storage.setItem(this.storageKeyWithoutClientAck,V(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?K(e):void 0}async getRelayerMessagesWithoutClientAck(){let e=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return"u">typeof e?K(e):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){let{message:e}=tY("NOT_INITIALIZED",this.name);throw Error(e)}}}var iA=Object.defineProperty,iS=Object.defineProperties,iC=Object.getOwnPropertyDescriptors,iN=Object.getOwnPropertySymbols,iO=Object.prototype.hasOwnProperty,iP=Object.prototype.propertyIsEnumerable,iT=(e,t,r)=>t in e?iA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,iM=(e,t)=>{for(var r in t||(t={}))iO.call(t,r)&&iT(e,r,t[r]);if(iN)for(var r of iN(t))iP.call(t,r)&&iT(e,r,t[r]);return e},iR=(e,t)=>iS(e,iC(t)),ik=(e,t,r)=>iT(e,"symbol"!=typeof t?t+"":t,r);class iD extends g{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,ik(this,"events",new i.EventEmitter),ik(this,"name","publisher"),ik(this,"queue",new Map),ik(this,"publishTimeout",(0,C.toMiliseconds)(C.ONE_MINUTE)),ik(this,"initialPublishTimeout",(0,C.toMiliseconds)(15*C.ONE_SECOND)),ik(this,"needsTransportRestart",!1),ik(this,"publish",async(e,t,r)=>{var i;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}});let n=r?.ttl||rr,s=tH(r),o=r?.prompt||!1,a=r?.tag||0,c=r?.id||(0,t3.getBigIntRpcId)().toString(),l={topic:e,message:t,opts:{ttl:n,relay:s,prompt:o,tag:a,id:c,attestation:r?.attestation,tvf:r?.tvf}},h=`Failed to publish payload, please try again. id:${c} tag:${a}`;try{let i=new Promise(async i=>{let s=({id:e})=>{l.opts.id===e&&(this.removeRequestFromQueue(e),this.relayer.events.removeListener(rn.publish,s),i(l))};this.relayer.events.on(rn.publish,s);let h=G(new Promise((i,s)=>{this.rpcPublish({topic:e,message:t,ttl:n,prompt:o,tag:a,id:c,attestation:r?.attestation,tvf:r?.tvf}).then(i).catch(e=>{this.logger.warn(e,e?.message),s(e)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${c} tag:${a}`);try{await h,this.events.removeListener(rn.publish,s)}catch(e){this.queue.set(c,iR(iM({},l),{attempt:1})),this.logger.warn(e,e?.message)}});this.logger.trace({type:"method",method:"publish",params:{id:c,topic:e,message:t,opts:r}}),await G(i,this.publishTimeout,h)}catch(e){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(e),null!=(i=r?.internal)&&i.throwOnFailedPublish)throw e}finally{this.queue.delete(c)}}),ik(this,"on",(e,t)=>{this.events.on(e,t)}),ik(this,"once",(e,t)=>{this.events.once(e,t)}),ik(this,"off",(e,t)=>{this.events.off(e,t)}),ik(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),this.relayer=e,this.logger=(0,a.U5)(t,this.name),this.registerEventListeners()}get context(){return(0,a.oI)(this.logger)}async rpcPublish(e){var t,r,i,n;let{topic:s,message:o,ttl:a=rr,prompt:c,tag:l,id:h,attestation:u,tvf:d}=e,f={method:tF(tH().protocol).publish,params:iM({topic:s,message:o,ttl:a,prompt:c,tag:l,attestation:u},d),id:h};tX(null==(t=f.params)?void 0:t.prompt)&&(null==(r=f.params)||delete r.prompt),tX(null==(i=f.params)?void 0:i.tag)&&(null==(n=f.params)||delete n.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:f});let p=await this.relayer.request(f);return this.relayer.events.emit(rn.publish,e),this.logger.debug("Successfully Published Payload"),p}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,t)=>{let r=e.attempt+1;this.queue.set(t,iR(iM({},e),{attempt:r}));let{topic:i,message:n,opts:s,attestation:o}=e;this.logger.warn({},`Publisher: queue->publishing: ${e.opts.id}, tag: ${e.opts.tag}, attempt: ${r}`),await this.rpcPublish(iR(iM({},e),{topic:i,message:n,ttl:s.ttl,prompt:s.prompt,tag:s.tag,id:s.id,attestation:o,tvf:s.tvf})),this.logger.warn({},`Publisher: queue->published: ${e.opts.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(s.li.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(rn.connection_stalled);return}this.checkQueue()}),this.relayer.on(rn.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}var iL=Object.defineProperty,iU=(e,t,r)=>((e,t,r)=>t in e?iL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class iB{constructor(){iU(this,"map",new Map),iU(this,"set",(e,t)=>{let r=this.get(e);this.exists(e,t)||this.map.set(e,[...r,t])}),iU(this,"get",e=>this.map.get(e)||[]),iU(this,"exists",(e,t)=>this.get(e).includes(t)),iU(this,"delete",(e,t)=>{if(typeof t>"u")return void this.map.delete(e);
12if(!this.map.has(e))return;let r=this.get(e);if(!this.exists(e,t))return;let i=r.filter(e=>e!==t);if(!i.length)return void this.map.delete(e);this.map.set(e,i)}),iU(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var ij=Object.defineProperty,i$=Object.defineProperties,iz=Object.getOwnPropertyDescriptors,iq=Object.getOwnPropertySymbols,iH=Object.prototype.hasOwnProperty,iF=Object.prototype.propertyIsEnumerable,iW=(e,t,r)=>t in e?ij(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,iV=(e,t)=>{for(var r in t||(t={}))iH.call(t,r)&&iW(e,r,t[r]);if(iq)for(var r of iq(t))iF.call(t,r)&&iW(e,r,t[r]);return e},iK=(e,t)=>i$(e,iz(t)),iG=(e,t,r)=>iW(e,"symbol"!=typeof t?t+"":t,r);class iY extends b{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,iG(this,"subscriptions",new Map),iG(this,"topicMap",new iB),iG(this,"events",new i.EventEmitter),iG(this,"name","subscription"),iG(this,"version","0.3"),iG(this,"pending",new Map),iG(this,"cached",[]),iG(this,"initialized",!1),iG(this,"storagePrefix",t4),iG(this,"subscribeTimeout",(0,C.toMiliseconds)(C.ONE_MINUTE)),iG(this,"initialSubscribeTimeout",(0,C.toMiliseconds)(15*C.ONE_SECOND)),iG(this,"clientId"),iG(this,"batchSubscribeTopicsLimit",500),iG(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),iG(this,"subscribe",async(e,t)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{let r=tH(t),i={topic:e,relay:r,transportType:t?.transportType};this.pending.set(e,i);let n=await this.rpcSubscribe(e,r,t);return"string"==typeof n&&(this.onSubscribe(n,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}})),n}catch(e){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(e),e}}),iG(this,"unsubscribe",async(e,t)=>{this.isInitialized(),"u">typeof t?.id?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)}),iG(this,"isSubscribed",e=>new Promise(t=>{t(this.topicMap.topics.includes(e))})),iG(this,"isKnownTopic",e=>new Promise(t=>{t(this.topicMap.topics.includes(e)||this.pending.has(e)||this.cached.some(t=>t.topic===e))})),iG(this,"on",(e,t)=>{this.events.on(e,t)}),iG(this,"once",(e,t)=>{this.events.once(e,t)}),iG(this,"off",(e,t)=>{this.events.off(e,t)}),iG(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),iG(this,"start",async()=>{await this.onConnect()}),iG(this,"stop",async()=>{await this.onDisconnect()}),iG(this,"restart",async()=>{await this.restore(),await this.onRestart()}),iG(this,"checkPending",async()=>{if(0===this.pending.size&&(!this.initialized||!this.relayer.connected))return;let e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e)}),iG(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(s.li.pulse,async()=>{await this.checkPending()}),this.events.on(rh.created,async e=>{let t=rh.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(rh.deleted,async e=>{let t=rh.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}),this.relayer=e,this.logger=(0,a.U5)(t,this.name),this.clientId=""}get context(){return(0,a.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(e,t){let r=!1;try{r=this.getSubscription(e).topic===t}catch{}return r}reset(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){let r=this.topicMap.get(e);await Promise.all(r.map(async r=>await this.unsubscribeById(e,r,t)))}async unsubscribeById(e,t,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}});try{let i=tH(r);await this.restartToComplete({topic:e,id:t,relay:i}),await this.rpcUnsubscribe(e,t,i);let n=tJ("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,n),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}})}catch(e){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(e),e}}async rpcSubscribe(e,t,r){var i;r&&r?.transportType!==ra.relay||await this.restartToComplete({topic:e,id:e,relay:t});let n={method:tF(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let s=null==(i=r?.internal)?void 0:i.throwOnFailedPublish;
12try{let t=await this.getSubscriptionId(e);if(r?.transportType===ra.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(n).catch(e=>this.logger.warn(e))},(0,C.toMiliseconds)(C.ONE_SECOND)),t;let i=new Promise(async t=>{let r=i=>{i.topic===e&&(this.events.removeListener(rh.created,r),t(i.id))};this.events.on(rh.created,r);try{let i=await G(new Promise((e,t)=>{this.relayer.request(n).catch(e=>{this.logger.warn(e,e?.message),t(e)}).then(e)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(rh.created,r),t(i)}catch{}}),o=await G(i,this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!o&&s)throw Error(`Subscribing to ${e} failed, please try again`);return o?t:null}catch(e){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(rn.connection_stalled),s)throw e}return null}async rpcBatchSubscribe(e){if(!e.length)return;let t={method:tF(e[0].relay.protocol).batchSubscribe,params:{topics:e.map(e=>e.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{await await G(new Promise(e=>{this.relayer.request(t).catch(e=>this.logger.warn(e)).then(e)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(rn.connection_stalled)}}async rpcBatchFetchMessages(e){let t;if(!e.length)return;let r={method:tF(e[0].relay.protocol).batchFetchMessages,params:{topics:e.map(e=>e.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{t=await await G(new Promise((e,t)=>{this.relayer.request(r).catch(e=>{this.logger.warn(e),t(e)}).then(e)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(rn.connection_stalled)}return t}rpcUnsubscribe(e,t,r){let i={method:tF(r.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,t){this.setSubscription(e,iK(iV({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(e=>{this.setSubscription(e.id,iV({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(e,t,r){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,r),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,iV({},t)),this.topicMap.set(t.topic,e),this.events.emit(rh.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let t=this.subscriptions.get(e);if(!t){let{message:t}=tY("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});let r=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(r.topic,e),this.events.emit(rh.deleted,iK(iV({},r),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(rh.sync)}async onRestart(){if(this.cached.length){let e=[...this.cached],t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<t;r++){let t=e.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(t)}}this.events.emit(rh.resubscribed)}async restore(){try{let e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){let{message:e}=tY("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){e.length&&(await this.rpcBatchSubscribe(e),this.onBatchSubscribe(await Promise.all(e.map(async e=>iK(iV({}
12,e),{id:await this.getSubscriptionId(e.topic)})))))}async batchFetchMessages(e){var t;if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);let r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(await (t=(0,C.toMiliseconds)(C.ONE_SECOND),new Promise(e=>setTimeout(e,t))),await this.relayer.handleBatchMessageEvents(r.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){let{message:e}=tY("NOT_INITIALIZED",this.name);throw Error(e)}}async restartToComplete(e){this.relayer.connected||this.relayer.connecting||(this.cached.push(e),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(e){return tL(e+await this.getClientId())}}var iJ=Object.defineProperty,iX=Object.getOwnPropertySymbols,iQ=Object.prototype.hasOwnProperty,iZ=Object.prototype.propertyIsEnumerable,i0=(e,t,r)=>t in e?iJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i1=(e,t)=>{for(var r in t||(t={}))iQ.call(t,r)&&i0(e,r,t[r]);if(iX)for(var r of iX(t))iZ.call(t,r)&&i0(e,r,t[r]);return e},i2=(e,t,r)=>i0(e,"symbol"!=typeof t?t+"":t,r);class i3 extends m{constructor(e){super(e),i2(this,"protocol","wc"),i2(this,"version",2),i2(this,"core"),i2(this,"logger"),i2(this,"events",new i.EventEmitter),i2(this,"provider"),i2(this,"messages"),i2(this,"subscriber"),i2(this,"publisher"),i2(this,"name","relayer"),i2(this,"transportExplicitlyClosed",!1),i2(this,"initialized",!1),i2(this,"connectionAttemptInProgress",!1),i2(this,"relayUrl"),i2(this,"projectId"),i2(this,"packageName"),i2(this,"bundleId"),i2(this,"hasExperiencedNetworkDisruption",!1),i2(this,"pingTimeout"),i2(this,"heartBeatTimeout",(0,C.toMiliseconds)(C.THIRTY_SECONDS+C.FIVE_SECONDS)),i2(this,"reconnectTimeout"),i2(this,"connectPromise"),i2(this,"reconnectInProgress",!1),i2(this,"requestsInFlight",[]),i2(this,"connectTimeout",(0,C.toMiliseconds)(15*C.ONE_SECOND)),i2(this,"request",async e=>{var t,r;this.logger.debug("Publishing Request Payload");let i=e.id||(0,t3.getBigIntRpcId)().toString();await this.toEstablishConnection();try{this.logger.trace({id:i,method:e.method,topic:null==(t=e.params)?void 0:t.topic},"relayer.request - publishing...");let n=`${i}:${(null==(r=e.params)?void 0:r.tag)||""}`;this.requestsInFlight.push(n);let s=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(e=>e!==n),s}catch(e){throw this.logger.debug(`Failed to Publish Request: ${i}`),e}}),i2(this,"resetPingTimeout",()=>{$()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,t,r,i;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),null==(i=null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.terminate)||i.call(r)}catch(e){this.logger.warn(e,e?.message)}},this.heartBeatTimeout))}),i2(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),i2(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected \uD83D\uDEDC"),this.startPingTimeout(),this.events.emit(rn.connect)}),i2(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected \uD83D\uDED1"),this.requestsInFlight=[],this.onProviderDisconnect()}),i2(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(rn.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),i2(this,"registerProviderListeners",()=>{this.provider.on(rs.payload,this.onPayloadHandler),this.provider.on(rs.connect,this.onConnectHandler),this.provider.on(rs.disconnect,this.onDisconnectHandler),this.provider.on(rs.error,this.onProviderErrorHandler)}),this.core=e.core,this.logger="u">typeof e.logger&&"string"!=typeof e.logger?(0,a.U5)(e.logger,this.name):(0,a.h6)((0,a.iP)({level:e.logger||"error"})),this.messages=new iI(this.logger,e.core),this.subscriber=new iY(this,this.logger),this.publisher=new iD(this,this.logger),this.relayUrl=e?.relayUrl||ri,this.projectId=e.projectId,z()&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Platform)&&(null==r.g?void 0:r.g.Platform.OS)==="android"?this.packageName=F():z()&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Platform)&&(null==r.g?void 0:r.g.Platform.OS)==="ios"&&(this.bundleId=F()),this.provider={}}
12async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.hasAnyTopics)try{await this.transportOpen()}catch(e){this.logger.warn(e,e?.message)}}get context(){return(0,a.oI)(this.logger)}get connected(){var e,t,r;return(null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.readyState)===1}get connecting(){var e,t,r;return(null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.readyState)===0||void 0!==this.connectPromise}async publish(e,t,r){this.isInitialized(),await this.publisher.publish(e,t,r),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:ra.relay},rc.outbound)}async subscribe(e,t){var r,i,n;this.isInitialized(),null!=t&&t.transportType&&t?.transportType!=="relay"||await this.toEstablishConnection();let s=typeof(null==(r=t?.internal)?void 0:r.throwOnFailedPublish)>"u"||(null==(i=t?.internal)?void 0:i.throwOnFailedPublish),o=(null==(n=this.subscriber.topicMap.get(e))?void 0:n[0])||"",a,c=t=>{t.topic===e&&(this.subscriber.off(rh.created,c),a())};return await Promise.all([new Promise(e=>{a=e,this.subscriber.on(rh.created,c)}),new Promise(async(r,i)=>{o=await this.subscriber.subscribe(e,i1({internal:{throwOnFailedPublish:s}},t)).catch(e=>{s&&i(e)})||o,r()})]),o}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(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await G(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){if(!this.subscriber.hasAnyTopics)return void this.logger.warn("Starting WS connection skipped because the client has no topics to work with.");if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(t,r)=>{await this.connect(e).then(t).catch(r).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(e){this.logger.debug({},"Restarting transport..."),this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await t0())throw Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0)return void this.logger.trace("Batch message events is empty. Ignoring...");let t=e.sort((e,t)=>e.publishedAt-t.publishedAt);for(let e of(this.logger.debug(`Batch of ${t.length} message events sorted`),t))try{await this.onMessageEvent(e)}catch(e){this.logger.warn(e,"Error while processing batch message event: "+e?.message)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){let{topic:r}=e;if(!t.sessionExists){let e=J(C.FIVE_MINUTES);await this.core.pairing.pairings.set(r,{topic:r,expiry:e,relay:{protocol:"irn"},active:!1})}this.events.emit(rn.message,e),await this.recordMessageEvent(e,rc.inbound)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let t=1;for(;t<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${t}...`),await this.createProvider(),await new Promise(async(e,t)=>{let r=()=>{t(Error("Connection interrupted while trying to subscribe"))};this.provider.once(rs.disconnect,r),await G(new Promise((e,t)=>
12{this.provider.connect().then(e).catch(t)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(e=>{t(e)}).finally(()=>{this.provider.off(rs.disconnect,r),clearTimeout(this.reconnectTimeout)}),await new Promise(async(e,t)=>{let r=()=>{t(Error("Connection interrupted while trying to subscribe"))};this.provider.once(rs.disconnect,r),await this.subscriber.start().then(e).catch(t).finally(()=>{this.provider.off(rs.disconnect,r)})}),this.hasExperiencedNetworkDisruption=!1,e()})}catch(e){await this.subscriber.stop(),this.logger.warn({},e.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${t}`);break}await new Promise(e=>setTimeout(e,(0,C.toMiliseconds)(+t))),t++}}startPingTimeout(){var e,t,r,i,n;if($())try{null!=(t=null==(e=this.provider)?void 0:e.connection)&&t.socket&&(null==(n=null==(i=null==(r=this.provider)?void 0:r.connection)?void 0:i.socket)||n.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(e){this.logger.warn(e,e?.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new t2.F(new t8.A(function({protocol:e,version:t,relayUrl:r,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:o,bundleId:a,packageName:c}){let l=r.split("?"),h=W(e,t,i),u=function(e,t){let r=new URLSearchParams(e);for(let e of Object.keys(t).sort())if(t.hasOwnProperty(e)){let i=t[e];void 0!==i&&r.set(e,i)}return r.toString()}(l[1]||"",{auth:n,ua:h,projectId:s,useOnCloseEvent:o||void 0,packageName:c||void 0,bundleId:a||void 0});return l[0]+"?"+u}({sdkVersion:ro,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(e,t){let{topic:r,message:i}=e;await this.messages.set(r,i,t)}async shouldIgnoreMessageEvent(e){let{topic:t,message:r}=e;if(!r||0===r.length)return this.logger.warn(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isKnownTopic(t))return this.logger.warn(`Ignoring message for unknown topic ${t}`),!0;let i=this.messages.has(t,r);return i&&this.logger.warn(`Ignoring duplicate message: ${r}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),(0,t3.isJsonRpcRequest)(e)){if(!e.method.endsWith("_subscription"))return;let t=e.params,{topic:r,message:i,publishedAt:n,attestation:s}=t.data,o={topic:r,message:i,publishedAt:n,transportType:ra.relay,attestation:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(i1({type:"event",event:t.id},o)),this.events.emit(t.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else(0,t3.isJsonRpcResponse)(e)&&this.events.emit(rn.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(await this.recordMessageEvent(e,rc.inbound),this.events.emit(rn.message,e))}async acknowledgePayload(e){let t=(0,t3.formatJsonRpcResult)(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(rs.payload,this.onPayloadHandler),this.provider.off(rs.connect,this.onConnectHandler),this.provider.off(rs.disconnect,this.onDisconnectHandler),this.provider.off(rs.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await t0();var t,i,n=async t=>{e!==t&&(e=t,t?await this.transportOpen().catch(e=>this.logger.error(e,e?.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))};switch(H()){case j.browser:t=n,!z()&&q()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)));break;case j.reactNative:i=n,z()&&"u">typeof r.g&&null!=r.g&&r.g.NetInfo&&r.g?.NetInfo.addEventListener(e=>i(e?.isConnected));case j.node:}}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(rn.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e,e?.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},(0,C.toMiliseconds)(.1)))))}isInitialized(){if(!this.initialized){let{message:e}=tY("NOT_INITIALIZED",this.name);throw Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),this.connected||await this.connect()}}function i8(){}function i5(e){if(!e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&"[object Object]"===Object.prototype.toString.call(e)}function i6(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}
12function i4(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}let i9="[object Arguments]",i7="[object Object]";var ne=Object.defineProperty,nt=Object.getOwnPropertySymbols,nr=Object.prototype.hasOwnProperty,ni=Object.prototype.propertyIsEnumerable,nn=(e,t,r)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ns=(e,t)=>{for(var r in t||(t={}))nr.call(t,r)&&nn(e,r,t[r]);if(nt)for(var r of nt(t))ni.call(t,r)&&nn(e,r,t[r]);return e},no=(e,t,r)=>nn(e,"symbol"!=typeof t?t+"":t,r);class na extends y{constructor(e,t,r,i=t4,n){super(e,t,r,i),this.core=e,this.logger=t,this.name=r,no(this,"map",new Map),no(this,"version","0.3"),no(this,"cached",[]),no(this,"initialized",!1),no(this,"getKey"),no(this,"storagePrefix",t4),no(this,"recentlyDeleted",[]),no(this,"recentlyDeletedLimit",200),no(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>{this.getKey&&null!==e&&!tX(e)?this.map.set(this.getKey(e),e):function(e){var t;return null==(t=e?.proposer)?void 0:t.publicKey}(e)?this.map.set(e.id,e):e?.topic&&this.map.set(e.topic,e)}),this.cached=[],this.initialized=!0)}),no(this,"set",async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),await this.persist())}),no(this,"get",e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e))),no(this,"getAll",e=>(this.isInitialized(),e?this.values.filter(t=>Object.keys(e).every(r=>{var i;return i=t[r],function e(t,r,i,n,s,o,a){let c=a(t,r,i,n,s,o);if(void 0!==c)return c;if(typeof t==typeof r)switch(typeof t){case"bigint":case"string":case"boolean":case"symbol":case"undefined":case"function":return t===r;case"number":return t===r||Object.is(t,r)}return function t(r,i,n,s){if(Object.is(r,i))return!0;let o=i4(r),a=i4(i);if(o===i9&&(o=i7),a===i9&&(a=i7),o!==a)return!1;switch(o){case"[object String]":return r.toString()===i.toString();case"[object Number]":{let e=r.valueOf(),t=i.valueOf();return e===t||Number.isNaN(e)&&Number.isNaN(t)}case"[object Boolean]":case"[object Date]":case"[object Symbol]":return Object.is(r.valueOf(),i.valueOf());case"[object RegExp]":return r.source===i.source&&r.flags===i.flags;case"[object Function]":return r===i}let c=(n=n??new Map).get(r),l=n.get(i);if(null!=c&&null!=l)return c===i;n.set(r,i),n.set(i,r);try{switch(o){case"[object Map]":if(r.size!==i.size)return!1;for(let[t,o]of r.entries())if(!i.has(t)||!e(o,i.get(t),t,r,i,n,s))return!1;return!0;case"[object Set]":{if(r.size!==i.size)return!1;let t=Array.from(r.values()),o=Array.from(i.values());for(let a=0;a<t.length;a++){let c=t[a],l=o.findIndex(t=>e(c,t,void 0,r,i,n,s));if(-1===l)return!1;o.splice(l,1)}return!0}case"[object Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":case"[object BigUint64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object BigInt64Array]":case"[object Float32Array]":case"[object Float64Array]":if("u">typeof t5&&t5.isBuffer(r)!==t5.isBuffer(i)||r.length!==i.length)return!1;for(let t=0;t<r.length;t++)if(!e(r[t],i[t],t,r,i,n,s))return!1;return!0;case"[object ArrayBuffer]":return r.byteLength===i.byteLength&&t(new Uint8Array(r),new Uint8Array(i),n,s);case"[object DataView]":return r.byteLength===i.byteLength&&r.byteOffset===i.byteOffset&&t(new Uint8Array(r),new Uint8Array(i),n,s);case"[object Error]":return r.name===i.name&&r.message===i.message;case i7:{if(!(t(r.constructor,i.constructor,n,s)||i5(r)&&i5(i)))return!1;let o=[...Object.keys(r),...i6(r)],a=[...Object.keys(i),...i6(i)];if(o.length!==a.length)return!1;for(let t=0;t<o.length;t++){let a=o[t],c=r[a];if(!Object.hasOwn(i,a))return!1;let l=i[a];if(!e(c,l,a,r,i,n,s))return!1}return!0}default:return!1}}finally{n.delete(r),n.delete(i)}}(t,r,o,a)}(i,e[r],void 0,void 0,void 0,void 0,i8)})):this.values)),no(this,"update",async(e,t)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});let r=ns(ns({},this.getData(e)),t);this.map.set(e,r),await this.persist()}),no(this,"delete",async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",ke
12y:e,reason:t}),this.map.delete(e),this.addToRecentlyDeleted(e),await this.persist())}),this.logger=(0,a.U5)(t,this.name),this.storagePrefix=i,this.getKey=n}get context(){return(0,a.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){let{message:t}=tY("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(t),Error(t)}let{message:t}=tY("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),Error(t)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:e}=tY("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=tY("NOT_INITIALIZED",this.name);throw Error(e)}}}var nc=Object.defineProperty,nl=(e,t,r)=>((e,t,r)=>t in e?nc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class nh{constructor(e,t){this.core=e,this.logger=t,nl(this,"name","pairing"),nl(this,"version","0.3"),nl(this,"events",new(n())),nl(this,"pairings"),nl(this,"initialized",!1),nl(this,"storagePrefix",t4),nl(this,"ignoredPayloadTypes",[1]),nl(this,"registeredMethods",[]),nl(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),nl(this,"register",({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]}),nl(this,"create",async e=>{this.isInitialized();let t=tD(),r=await this.core.crypto.setSymKey(t),i=J(C.FIVE_MINUTES),n={protocol:"irn"},s={topic:r,expiry:i,relay:n,active:!1,methods:e?.methods},o=tV({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:t,relay:n,expiryTimestamp:i,methods:e?.methods});return this.events.emit(rd.create,s),this.core.expirer.set(r,i),await this.pairings.set(r,s),await this.core.relayer.subscribe(r,{transportType:e?.transportType}),{topic:r,uri:o}}),nl(this,"pair",async e=>{let t;this.isInitialized();let r=this.core.eventClient.createEvent({properties:{topic:e?.uri,trace:[rb.pairing_started]}});this.isValidPair(e,r);let{topic:i,symKey:n,relay:s,expiryTimestamp:o,methods:a}=tW(e.uri);if(r.props.properties.topic=i,r.addTrace(rb.pairing_uri_validation_success),r.addTrace(rb.pairing_uri_not_expired),this.pairings.keys.includes(i)){if(t=this.pairings.get(i),r.addTrace(rb.existing_pairing),t.active)throw r.setError(rw.active_pairing_already_exists),Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);r.addTrace(rb.pairing_not_expired)}let c=o||J(C.FIVE_MINUTES),l={topic:i,relay:s,expiry:c,active:!1,methods:a};this.core.expirer.set(i,c),await this.pairings.set(i,l),r.addTrace(rb.store_new_pairing),e.activatePairing&&await this.activate({topic:i}),this.events.emit(rd.create,l),r.addTrace(rb.emit_inactive_pairing),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(n,i),r.addTrace(rb.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{r.setError(rw.no_internet_connection)}try{await this.core.relayer.subscribe(i,{relay:s})}catch(e){throw r.setError(rw.subscribe_pairing_topic_failure),e}return r.addTrace(rb.subscribe_pairing_topic_success),l}),nl(this,"activate",async({topic:e})=>{this.isInitialized();let t=J(C.FIVE_MINUTES);this.core.expirer.set(e,t),await this.pairings.update(e,{active:!0,expiry:t})}),nl(this,"ping",async e=>{this.isInitialized(),await this.isValidPing(e),this.logger.warn("ping() is deprecated and will be removed in the next major release.");let{topic:t}=e;if(this.pairings.keys.includes(t)){let e=await this.sendRequest(t,"wc_pairingPing",{}),{done:r,resolve:i,reject:n}=function(e=C.FIVE_MINUTES,t){let r,i,n,s,o=(0,C.toMiliseconds)(e||C.FIVE_MINUTES);return{resolve:e=>{n&&r&&(clearTimeout(n),r(e),s=Promise.resolve(e))},reject:e=>{n&&i&&(clearTimeout(n),i(e))},done:()=>new Promise((e,t)=>
12{if(s)return e(s);n=setTimeout(()=>{let e=Error(void 0);s=Promise.reject(e),t(e)},o),r=e,i=t})}}();this.events.once(Q("pairing_ping",e),({error:e})=>{e?n(e):i()}),await r()}}),nl(this,"updateExpiry",async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})}),nl(this,"updateMetadata",async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})}),nl(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),nl(this,"disconnect",async e=>{this.isInitialized(),await this.isValidDisconnect(e);let{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,"wc_pairingDelete",tJ("USER_DISCONNECTED")),await this.deletePairing(t))}),nl(this,"formatUriFromPairing",e=>{this.isInitialized();let{topic:t,relay:r,expiry:i,methods:n}=e,s=this.core.crypto.keychain.get(t);return tV({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:s,relay:r,expiryTimestamp:i,methods:n})}),nl(this,"sendRequest",async(e,t,r)=>{let i=(0,t3.formatJsonRpcRequest)(t,r),n=await this.core.crypto.encode(e,i),s=ru[t].req;return this.core.history.set(e,i),this.core.relayer.publish(e,n,s),i.id}),nl(this,"sendResult",async(e,t,r)=>{let i=(0,t3.formatJsonRpcResult)(e,r),n=await this.core.crypto.encode(t,i),s=ru[(await this.core.history.get(t,e)).request.method].res;await this.core.relayer.publish(t,n,s),await this.core.history.resolve(i)}),nl(this,"sendError",async(e,t,r)=>{let i=(0,t3.formatJsonRpcError)(e,r),n=await this.core.crypto.encode(t,i),s=(await this.core.history.get(t,e)).request.method,o=ru[s]?ru[s].res:ru.unregistered_method.res;await this.core.relayer.publish(t,n,o),await this.core.history.resolve(i)}),nl(this,"deletePairing",async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,tJ("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])}),nl(this,"cleanup",async()=>{let e=this.pairings.getAll().filter(e=>X(e.expiry));await Promise.all(e.map(e=>this.deletePairing(e.topic)))}),nl(this,"onRelayEventRequest",async e=>{let{topic:t,payload:r}=e;switch(r.method){case"wc_pairingPing":return await this.onPairingPingRequest(t,r);case"wc_pairingDelete":return await this.onPairingDeleteRequest(t,r);default:return await this.onUnknownRpcMethodRequest(t,r)}}),nl(this,"onRelayEventResponse",async e=>{let{topic:t,payload:r}=e,i=(await this.core.history.get(t,r.id)).request.method;return"wc_pairingPing"===i?this.onPairingPingResponse(t,r):this.onUnknownRpcMethodResponse(i)}),nl(this,"onPairingPingRequest",async(e,t)=>{let{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult(r,e,!0),this.events.emit(rd.ping,{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}}),nl(this,"onPairingPingResponse",(e,t)=>{let{id:r}=t;setTimeout(()=>{(0,t3.isJsonRpcResult)(t)?this.events.emit(Q("pairing_ping",r),{}):(0,t3.isJsonRpcError)(t)&&this.events.emit(Q("pairing_ping",r),{error:t.error})},500)}),nl(this,"onPairingDeleteRequest",async(e,t)=>{let{id:r}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit(rd.delete,{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}}),nl(this,"onUnknownRpcMethodRequest",async(e,t)=>{let{id:r,method:i}=t;try{if(this.registeredMethods.includes(i))return;let t=tJ("WC_METHOD_UNSUPPORTED",i);await this.sendError(r,e,t),this.logger.error(t)}catch(t){await this.sendError(r,e,t),this.logger.error(t)}}),nl(this,"onUnknownRpcMethodResponse",e=>{this.registeredMethods.includes(e)||this.logger.error(tJ("WC_METHOD_UNSUPPORTED",e))}),nl(this,"isValidPair",(e,t)=>{var r;if(!tZ(e)){let{message:r}=tY("MISSING_OR_INVALID",`pair() params: ${e}`);throw t.setError(rw.malformed_pairing_uri),Error(r)}if(!function(e){function t(e){try{return"u">typeof new URL(e)}catch{return!1}}try{if(tQ(e,!1)){if(t(e))return!0;let r=et(e);return t(r)}}catch{}return!1}(e.uri)){let{message:r}=tY("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw t.setError(rw.malformed_pairing_uri),Error(r)}let i=tW(e?.uri);if(!(null!=(r=i?.relay)&&r.protocol)){let{message:e}=tY("MISSING_OR_INVALID","pair() uri#relay-protocol");throw t.setError(rw.malformed_pairing_uri),Error(e)}if(!(null!=i&&i.symKey)){let{message:e}=tY("MISSING_OR_INVALID","pair() uri#symKey");throw t.setError(rw.malformed_pairing_uri),Error(e)}if(null!=i&&i.expiryTimestamp&&(0,C.toMiliseconds)(i?.expiryTimestamp)<Date.now()){t.setError(rw.pairing_expired);let{message:e}=tY("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw Error(e)}}),nl(this,"isValidPing",async e=>{if(!tZ(e)){let{message:t}=tY("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)}),nl(this,"isValidDisconnect",async e=>{if(!tZ(e)){let{message:t}=tY("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)}),nl(this,"isValidPairingTopic",async e=>{if(!tQ(e,!1)){let{message:t}=tY("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.pairings.keys.includes(e)){let{message:t}=tY("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if(X(this.pairings.get(e).expiry)){await this.deletePairing(e);let{message:t}=tY("EXPIRED",`pairing topic: ${e}`);throw Error(t)}}),this.core=e,this.logger=(0,a.U5)(t,this.name),this.pairings=new na(this.core,this.logger,this.name,this.storagePrefix)}get context(){return(0,a.oI)(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=tY("NOT_INITIALIZED",this.name);throw Error(e)}}registerRelayerEvents(){this.core.relayer.on(rn.message,async e=>{let{topic:t,message:r,transportType:i}=e;if(this.pairings.keys.includes(t)&&i!==ra.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))try{let e=await this.core.crypto.decode(t,r);(0,t3.isJsonRpcRequest)(e)?(this.core.history.set(t,e),await this.onRelayEventRequest({topic:t,payload:e})):(0,t3.isJsonRpcResponse)(e)&&(await this.core.history.resolve(e),await this.onRelayEventResponse({topic:t,payload:e}),this.core.history.delete(t,e.id)),await this.core.relayer.messages.ack(t,r)}catch(e){this.logger.error(e)}})}registerExpirerEvents(){this.core.expirer.on(rp.expired,async e=>{let{topic:t}=function(e){let[t,r]=e.split(":"),i={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof r)i.topic=r;else if("id"===t&&Number.isInteger(Number(r)))i.id=Number(r);else throw Error(`Invalid target, expected id:number or topic:string, got ${t}:${r}`);return i}(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(rd.expire,{topic:t}))})}}var nu=Object.defineProperty,nd=(e,t,r)=>((e,t,r)=>t in e?nu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class nf extends f{constructor(e,t){super(e,t),this.core=e,this.logger=t,nd(this,"records",new Map),nd(this,"events",new i.EventEmitter),nd(this,"name","history"),nd(this,"version","0.3"),nd(this,"cac
12hed",[]),nd(this,"initialized",!1),nd(this,"storagePrefix",t4),nd(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>this.records.set(e.id,e)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),nd(this,"set",(e,t,r)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:r}),this.records.has(t.id))return;let i={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:r,expiry:J(C.THIRTY_DAYS)};this.records.set(i.id,i),this.persist(),this.events.emit(rf.created,i)}),nd(this,"resolve",async e=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;let t=await this.getRecord(e.id);typeof t.response>"u"&&(t.response=(0,t3.isJsonRpcError)(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.persist(),this.events.emit(rf.updated,t))}),nd(this,"get",async(e,t)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),await this.getRecord(t))),nd(this,"delete",(e,t)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach(r=>{r.topic===e&&("u">typeof t&&r.id!==t||(this.records.delete(r.id),this.events.emit(rf.deleted,r)))}),this.persist()}),nd(this,"exists",async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e)),nd(this,"on",(e,t)=>{this.events.on(e,t)}),nd(this,"once",(e,t)=>{this.events.once(e,t)}),nd(this,"off",(e,t)=>{this.events.off(e,t)}),nd(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),this.logger=(0,a.U5)(t,this.name)}get context(){return(0,a.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(t=>{if("u">typeof t.response)return;let r={topic:t.topic,request:(0,t3.formatJsonRpcRequest)(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(r)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let t=this.records.get(e);if(!t){let{message:t}=tY("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(rf.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:e}=tY("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(rf.created,e=>{let t=rf.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(rf.updated,e=>{let t=rf.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(rf.deleted,e=>{let t=rf.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(s.li.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{(0,C.toMiliseconds)(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(rf.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=tY("NOT_INITIALIZED",this.name);throw Error(e)}}}var np=Object.defineProperty,ng=(e,t,r)=>((e,t,r)=>t in e?np(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class nm extends w{constructor(e,t){super(e,t),this.core=e,this.logger=t,ng(this,"expirations",new Map),ng(this,"events",new i.EventEmitter),ng(this,"name","expirer"),ng(this,"version","0.3"),ng(this,"cac
12hed",[]),ng(this,"initialized",!1),ng(this,"storagePrefix",t4),ng(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>this.expirations.set(e.target,e)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),ng(this,"has",e=>{try{let t=this.formatTarget(e);return"u">typeof this.getExpiration(t)}catch{return!1}}),ng(this,"set",(e,t)=>{this.isInitialized();let r=this.formatTarget(e),i={target:r,expiry:t};this.expirations.set(r,i),this.checkExpiry(r,i),this.events.emit(rp.created,{target:r,expiration:i})}),ng(this,"get",e=>{this.isInitialized();let t=this.formatTarget(e);return this.getExpiration(t)}),ng(this,"del",e=>{if(this.isInitialized(),this.has(e)){let t=this.formatTarget(e),r=this.getExpiration(t);this.expirations.delete(t),this.events.emit(rp.deleted,{target:t,expiration:r})}}),ng(this,"on",(e,t)=>{this.events.on(e,t)}),ng(this,"once",(e,t)=>{this.events.once(e,t)}),ng(this,"off",(e,t)=>{this.events.off(e,t)}),ng(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),this.logger=(0,a.U5)(t,this.name)}get context(){return(0,a.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if("string"==typeof e)return Y("topic",e);if("number"==typeof e)return Y("id",e);let{message:t}=tY("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(rp.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:e}=tY("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let t=this.expirations.get(e);if(!t){let{message:t}=tY("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(t),Error(t)}return t}checkExpiry(e,t){let{expiry:r}=t;(0,C.toMiliseconds)(r)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(rp.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(s.li.pulse,()=>this.checkExpirations()),this.events.on(rp.created,e=>{let t=rp.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(rp.expired,e=>{let t=rp.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(rp.deleted,e=>{let t=rp.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=tY("NOT_INITIALIZED",this.name);throw Error(e)}}}var ny=Object.defineProperty,nb=(e,t,r)=>((e,t,r)=>t in e?ny(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class nw extends v{constructor(e,t,r){super(e,t,r),this.core=e,this.logger=t,this.store=r,nb(this,"name","verify-api"),nb(this,"abortController"),nb(this,"isDevEnv"),nb(this,"verifyUrlV3",rm),nb(this,"storagePrefix",t4),nb(this,"version",2),nb(this,"publicKey"),nb(this,"fetchPromise"),nb(this,"init",async()=>{var e;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&(0,C.toMiliseconds)(null==(e=this.publicKey)?void 0:e.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),nb(this,"register",async e=>{if(!q()||this.isDevEnv)return;let t=window.location.origin,{id:r,decryptedId:i}=e,n=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${t}&id=${r}&decryptedId=${i}`;try{let e=(0,T.getDocument)(),t=this.startAbortTimer(5*C.ONE_SECOND),i=await new Promise((i,s)=>{let o=()=>{window.removeEventListener("message",c),e.body.removeChild(a),s("attestation aborted")};this.abortController.signal.addEventListener("abort",o);let a=e.createElement("iframe");a.src=n,a.style.display="none",a.addEventListener("error",o,{signal:this.abortController.signal});let c=n=>{if(n.data&&"string"==typeof n.data)try{let s=JSON.parse(n.data);if("verify_attestation"===s.type){if((0,O.Cq)(s.attestation).payload.id!==r)return;clearInterval(t),e.body.removeChild(a),this.abortController.signal.removeEventListener("abort",o),window.removeEventListener("message",c),i(null===s.attestation?"":s.attestation)}}catch(e){this.logger.warn(e)}};e.body.appendChild(a),window.addEventListener("message",c,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",i),i}catch(e){this.logger.warn(e)}return""}),nb(this,"resolve",async e=>{if(this.isDevEnv)return"";let{attestationId:t,hash:r,encryptedId:i}=e;if(""===t)return void this.logger.debug("resolve: attestationId is empty, skipping");if(t){if((0,O.Cq)(t).payload.id!==i)return;let e=await this.isValidJwtAttestation(t);
12if(e)return e.isVerified?e:void this.logger.warn("resolve: jwt attestation: origin url not verified")}if(!r)return;let n=this.getVerifyUrl(e?.verifyUrl);return this.fetchAttestation(r,n)}),nb(this,"fetchAttestation",async(e,t)=>{this.logger.debug(`resolving attestation: ${e} from url: ${t}`);let r=this.startAbortTimer(5*C.ONE_SECOND),i=await fetch(`${t}/attestation/${e}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(r),200===i.status?await i.json():void 0}),nb(this,"getVerifyUrl",e=>{let t=e||rg;return ry.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: ${rg}`),t=rg),t}),nb(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);let e=this.startAbortTimer(C.FIVE_SECONDS),t=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(e),await t.json()}catch(e){this.logger.warn(e)}}),nb(this,"persistPublicKey",async e=>{this.logger.debug("persisting public key to local storage",e),await this.store.setItem(this.storeKey,e),this.publicKey=e}),nb(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),nb(this,"isValidJwtAttestation",async e=>{let t=await this.getPublicKey();try{if(t)return this.validateAttestation(e,t)}catch(e){this.logger.error(e),this.logger.warn("error validating attestation")}let r=await this.fetchAndPersistPublicKey();try{if(r)return this.validateAttestation(e,r)}catch(e){this.logger.error(e),this.logger.warn("error validating attestation")}}),nb(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),nb(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async e=>{let t=await this.fetchPublicKey();t&&(await this.persistPublicKey(t),e(t))});let e=await this.fetchPromise;return this.fetchPromise=void 0,e}),nb(this,"validateAttestation",(e,t)=>{let r=function(e,t){let[r,i,n]=e.split("."),s=B.from(function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4;return r>0&&(t+="=".repeat(4-r)),t}(n),"base64");if(64!==s.length)throw Error("Invalid signature length");let o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),c=to(`${r}.${i}`),l=new D.ec("p256").keyFromPublic({x:B.from(t.x,"base64").toString("hex"),y:B.from(t.y,"base64").toString("hex")},"hex"),h=(0,k.dI)(c,tM);if(!l.verify(h,{r:o,s:a}))throw Error("Invalid signature");return(0,O.Cq)(e).payload}(e,t.publicKey),i={hasExpired:(0,C.toMiliseconds)(r.exp)<Date.now(),payload:r};if(i.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),Error("JWT attestation expired");return{origin:i.payload.origin,isScam:i.payload.isScam,isVerified:i.payload.isVerified}}),this.logger=(0,a.U5)(t,this.name),this.abortController=new AbortController,this.isDevEnv=ee(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return(0,a.oI)(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),(0,C.toMiliseconds)(e))}}var nv=Object.defineProperty,nx=(e,t,r)=>((e,t,r)=>t in e?nv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class nE extends x{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,nx(this,"context","echo"),nx(this,"registerDeviceToken",async e=>{let{clientId:t,token:r,notificationType:i,enableEncrypted:n=!1}=e,s=`https://echo.walletconnect.com/${this.projectId}/clients`;await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:t,type:i,token:r,always_raw:n})})}),this.logger=(0,a.U5)(t,this.context)}}var n_=Object.defineProperty,nI=Object.getOwnPropertySymbols,nA=Object.prototype.hasOwnProperty,nS=Object.prototype.propertyIsEnumerable,nC=(e,t,r)=>t in e?n_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nN=(e,t)=>{for(var r in t||(t={}))nA.call(t,r)&&nC(e,r,t[r]);if(nI)for(var r of nI(t))nS.call(t,r)&&nC(e,r,t[r]);return e},nO=(e,t,r)=>nC(e,"symbol"!=typeof t?t+"":t,r);
12class nP extends E{constructor(e,t,r=!0){super(e,t,r),this.core=e,this.logger=t,nO(this,"context","event-client"),nO(this,"storagePrefix",t4),nO(this,"storageVersion",.1),nO(this,"events",new Map),nO(this,"shouldPersist",!1),nO(this,"init",async()=>{if(!ee())try{let e={eventId:Z(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:W(this.core.relayer.protocol,this.core.relayer.version,ro)}}};await this.sendEvent([e])}catch(e){this.logger.warn(e)}}),nO(this,"createEvent",e=>{let{event:t="ERROR",type:r="",properties:{topic:i,trace:n}}=e,s=Z(),o=this.core.projectId||"",a=nN({eventId:s,timestamp:Date.now(),props:{event:t,type:r,properties:{topic:i,trace:n}},bundleId:o,domain:this.getAppDomain()},this.setMethods(s));return this.telemetryEnabled&&(this.events.set(s,a),this.shouldPersist=!0),a}),nO(this,"getEvent",e=>{let{eventId:t,topic:r}=e;if(t)return this.events.get(t);let i=Array.from(this.events.values()).find(e=>e.props.properties.topic===r);if(i)return nN(nN({},i),this.setMethods(i.eventId))}),nO(this,"deleteEvent",e=>{let{eventId:t}=e;this.events.delete(t),this.shouldPersist=!0}),nO(this,"setEventListeners",()=>{this.core.heartbeat.on(s.li.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(e=>{(0,C.fromMiliseconds)(Date.now())-(0,C.fromMiliseconds)(e.timestamp)>86400&&(this.events.delete(e.eventId),this.shouldPersist=!0)})})}),nO(this,"setMethods",e=>({addTrace:t=>this.addTrace(e,t),setError:t=>this.setError(e,t)})),nO(this,"addTrace",(e,t)=>{let r=this.events.get(e);r&&(r.props.properties.trace.push(t),this.events.set(e,r),this.shouldPersist=!0)}),nO(this,"setError",(e,t)=>{let r=this.events.get(e);r&&(r.props.type=t,r.timestamp=Date.now(),this.events.set(e,r),this.shouldPersist=!0)}),nO(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),nO(this,"restore",async()=>{try{let e=await this.core.storage.getItem(this.storageKey)||[];if(!e.length)return;e.forEach(e=>{this.events.set(e.eventId,nN(nN({},e),this.setMethods(e.eventId)))})}catch(e){this.logger.warn(e)}}),nO(this,"submit",async()=>{if(!this.telemetryEnabled||0===this.events.size)return;let e=[];for(let[t,r]of this.events)r.props.type&&e.push(r);if(0!==e.length)try{if((await this.sendEvent(e)).ok)for(let t of e)this.events.delete(t.eventId),this.shouldPersist=!0}catch(e){this.logger.warn(e)}}),nO(this,"sendEvent",async e=>{let t=this.getAppDomain()?"":"&sp=desktop";return await fetch(`https://pulse.walletconnect.org/batch?projectId=${this.core.projectId}&st=events_sdk&sv=js-${ro}${t}`,{method:"POST",body:JSON.stringify(e)})}),nO(this,"getAppDomain",()=>((0,M.g)()||{name:"",description:"",url:"",icons:[""]}).url),this.logger=(0,a.U5)(t,this.context),this.telemetryEnabled=r,r?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var nT=Object.defineProperty,nM=Object.getOwnPropertySymbols,nR=Object.prototype.hasOwnProperty,nk=Object.prototype.propertyIsEnumerable,nD=(e,t,r)=>t in e?nT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nL=(e,t)=>{for(var r in t||(t={}))nR.call(t,r)&&nD(e,r,t[r]);if(nM)for(var r of nM(t))nk.call(t,r)&&nD(e,r,t[r]);return e},nU=(e,t,r)=>nD(e,"symbol"!=typeof t?t+"":t,r);class nB extends u{constructor(e){var t;super(e),nU(this,"protocol","wc"),nU(this,"version",2),nU(this,"name",t6),nU(this,"relayUrl"),nU(this,"projectId"),nU(this,"customStoragePrefix"),nU(this,"events",new i.EventEmitter),nU(this,"logger"),nU(this,"heartbeat"),nU(this,"relayer"),nU(this,"crypto"),nU(this,"storage"),nU(this,"history"),nU(this,"expirer"),nU(this,"pairing"),nU(this,"verify"),nU(this,"echoClient"),nU(this,"linkModeSupportedApps"),nU(this,"eventClient"),nU(this,"initialized",!1),nU(this,"logChunkController"),nU(this,"on",(e,t)=>this.events.on(e,t)),nU(this,"once",(e,t)=>this.events.once(e,t)),nU(this,"off",(e,t)=>this.events.off(e,t)),nU(this,"removeListener",(e,t)=>this.events.removeListener(e,t)),nU(this,"dispatchEnvelope",({topic:e,message:t,sessionExists:r})=>{if(!e||!t)return;let i={topic:e,message:t,publishedAt:Date.now(),transportType:ra.link_mode};this.relayer.onLinkMessageEvent(i,{sessionExists:r})}),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||ri,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let r=(0,a.iP)({level:"string"==typeof e?.logger&&e.logger?e.logger:t9.logger,name:t6}),{logger:n,chunkLoggerController:c}=(0,a.D5)({opts:r,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=c,null!=(t=this.logChunkController)&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var e,t;null!=(e=this.logChunkController)&&e.downloadLogsBlobInBrowser&&(null==(t=this.logChunkController)||t.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=(0,a.U5)(n,this.name),this.heartbeat=new s.VH,this.crypto=new ig(this,this.logger,e?.keychain),this.history=new nf(this,this.logger),this.expirer=new nm(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new o.A(nL(nL({},t7),e?.storageOptions)),this.relayer=new i3({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new nh(this,this.logger),this.verify=new nw(this,this.logger,this.storage),this.echoClient=new nE(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new nP(this,this.logger,e?.telemetryEnabled)}static async init(e){let t=new nB(e);await t.initialize();let r=await t.crypto.getClientId();return await t.storage.setItem("WALLETCONNECT_CLIENT_ID",r),t}get context(){return(0,a.oI)(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return null==(e=this.logChunkController)?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(rl,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(
12),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(rl)||[],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}}}let nj="2.23.2",n$={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${nj}`};class nz extends Error{constructor(e,t={}){let r=t.cause instanceof nz?t.cause.details:t.cause?.message?t.cause.message:t.details,i=t.cause instanceof nz&&t.cause.docsPath||t.docsPath,n=n$.getDocsUrl?.({...t,docsPath:i});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: ${n}`]:[],...r?[`Details: ${r}`]:[],...n$.version?[`Version: ${n$.version}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=i,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=nj}walk(e){return function e(t,r){return r?.(t)?t:t&&"object"==typeof t&&"cause"in t&&void 0!==t.cause?e(t.cause,r):r?null:t}(this,e)}}function nq(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}class nH extends nz{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function nF(e,{dir:t,size:r=32}={}){return"string"==typeof e?function(e,{dir:t,size:r=32}={}){if(null===r)return e;let i=e.replace("0x","");if(i.length>2*r)throw new nH({size:Math.ceil(i.length/2),targetSize:r,type:"hex"});return`0x${i["right"===t?"padEnd":"padStart"](2*r,"0")}`}(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new nH({size:e.length,targetSize:r,type:"bytes"});let i=new Uint8Array(r);for(let n=0;n<r;n++){let s="right"===t;i[s?n:r-n-1]=e[s?n:e.length-n-1]}return i}(e,{dir:t,size:r})}class nW extends nz{constructor({max:e,min:t,signed:r,size:i,value:n}){super(`Number "${n}" is not in safe ${i?`${8*i}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class nV extends nz{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function nK(e){return nq(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function nG(e,{size:t}){if(nK(e)>t)throw new nV({givenSize:nK(e),maxSize:t})}function nY(e,t={}){let{signed:r}=t;t.size&&nG(e,{size:t.size});let i=BigInt(e);if(!r)return i;let n=(e.length-2)/2;return i<=(1n<<8n*BigInt(n)-1n)-1n?i:i-BigInt(`0x${"f".padStart(2*n,"f")}`)-1n}let nJ=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function nX(e,t={}){return"number"==typeof e||"bigint"==typeof e?nZ(e,t):"string"==typeof e?function(e,t={}){return nQ(n0.encode(e),t)}(e,t):"boolean"==typeof e?function(e,t={}){let r=`0x${Number(e)}`;return"number"==typeof t.size?(nG(r,{size:t.size}),nF(r,{size:t.size})):r}(e,t):nQ(e,t)}function nQ(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=nJ[e[t]];let i=`0x${r}`;return"number"==typeof t.size?(nG(i,{size:t.size}),nF(i,{dir:"right",size:t.size})):i}function nZ(e,t={}){let r,{signed:i,size:n}=t,s=BigInt(e);n?r=i?(1n<<8n*BigInt(n)-1n)-1n:2n**(8n*BigInt(n))-1n:"number"==typeof e&&(r=BigInt(Number.MAX_SAFE_INTEGER));let o="bigint"==typeof r&&i?-r-1n:0;if(r&&s>r||s<o){let t="bigint"==typeof e?"n":"";throw new nW({max:r?`${r}${t}`:void 0,min:`${o}${t}`,signed:i,size:n,value:`${e}${t}`})}let a=`0x${(i&&s<0?(1n<<BigInt(8*n))+BigInt(s):s).toString(16)}`;return n?nF(a,{size:n}):a}let n0=new TextEncoder,n1=new TextEncoder,n2={zero:48,nine:57,A:65,F:70,a:97,f:102};function n3(e){return e>=n2.zero&&e<=n2.nine?e-n2.zero:e>=n2.A&&e<=n2.F?e-(n2.A-10):e>=n2.a&&e<=n2.f?e-(n2.a-10):void 0}function n8(e,t={}){let r=e;t.size&&(nG(r,{size:t.size}),r=nF(r,{dir:"right",size:t.size}));let i=r.slice(2);i.length%2&&(i=`0${i}`);let n=i.length/2,s=new Uint8Array(n);for(let e=0,t=0;e<n;e++){let r=n3(i.charCodeAt(t++)),n=n3(i.charCodeAt(t++));if(void 0===r||void 0===n)throw new nz(`Invalid byte sequence ("${i[t-2]}${i[t-1]}" in "${i}").`);s[e]=16*r+n}return s}function n5(e,t={}){let r=n1.encode(e);return"number"==typeof t.size?(nG(r,{size:t.size}),nF(r,{dir:"right",size:t.size})):r}var n6=r(81480);let n4=BigInt(0x100000000-1),n9=BigInt(32);var n7=r(60036);let se=[],st=[],sr=[],si=BigInt(0),sn=BigInt(1),ss=BigInt(2),so=BigInt(7),sa=BigInt(256),sc=BigInt(113);for(let e=0,t=sn,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],se.push(2*(5*i+r)),st.push((e+1)*(e+2)/2%64);let n=si;for(let e=0;e<7;e++)(t=(t<<sn^(t>>so)*sc)%sa)&ss&&(n^=sn<<(sn<<BigInt(e))-sn);sr.push(n)}let[sl,sh]=function(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let n=0;n<e.length;n++){let{h:s,l:o}=function(e,t=!1){return t?{h:Number(e&n4),l:Number(e>>n9&n4)}:{h:0|Number(e>>n9&n4),l:0|Number(e&n4)}}(e[n],t);[r[n],i[n]]=[s,o]}return[r,i]}(sr,!0),su=(e,t,r)=>r>32?((e,t,r)=>t<<r-32|e>>>64-r)(e,t,r):((e,t,r)=>e<<r|t>>>32-r)(e,t,r),sd=(e,t,r)=>r>32?((e,t,r)=>e<<r-32|t>>>64-r)(e,t,r):((e,t,r)=>t<<r|e>>>32-r)(e,t,r);class sf extends n7.Vw{constructor(e,t,r,i=!1,n=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,n6.Fe)(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,n7.DH)(this.state)}keccak(){n7.qv||(0,n7.Fc)(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let i=(t+8)%10,n=(t+2)%10,s=r[n],o=r[n+1],a=su(s,o,1)^r[i],c=sd(s,o,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],n=e[3];for(let r=0;r<24;r++){let i=st[r],s=su(t,n,i),o=sd(t,n,i),a=se[r];t=e[a],n=e[a+1],e[a]=s,e[a+1]=o}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=sl[i],e[1]^=sh[i]}r.fill(0)}(this.state32,this.rounds),n7.qv||(0,n7.Fc)(this.state32),this.posOut=0,this.pos=0}update(e){(0,n6.CC)(this);let{blockLen:t,state:r}=this,i=(e=(0,n7.ZJ)(e)).length;for(let n=0;n<i;){let s=Math.min(t-this.pos,i-n);for(let t=0;t<s;t++)r[this.pos++]^=e[n++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:i}=this;e[r]^=t,(128&t)!=0&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){(0,n6.CC)(this,!1),(0,n6.DO)(e),this.finish();let t=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,n6.Fe)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,n6.Ht)(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new sf(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}let sp=(0,n7.ld)(()=>new sf(136,1,32));function sg(e,t){let r=sp(nq(e,{strict:!1})?function(e,t={}){return"number"==typeof e||"bigint"==typeof e?n8(nZ(e,t)):"boolean"==typeof e?function(e,t={}){let r=new Uint8Array(1);return(r[0]=Number(e),"number"==typeof t.size)?(nG(r,{size:t.size}),nF(r,{size:t.size})):r}(e,t):nq(e)?n8(e,t):n5(e,t)}(e):e);return"bytes"===(t||"hex")?r:nX(r)}class sm extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=this.keys().next().value;e&&this.delete(e)}return this}}let sy=new sm(8192);
12async function sb({hash:e,signature:t}){let i=nq(e)?e:nX(e),{secp256k1:n}=await r.e(2128).then(r.bind(r,12128)),s=(()=>{if("object"==typeof t&&"r"in t&&"s"in t){let{r:e,s:r,v:i,yParity:s}=t,o=sw(Number(s??i));return new n.Signature(nY(e),nY(r)).addRecoveryBit(o)}let e=nq(t)?t:nX(t),r=sw(function(e,t={}){return Number(nY(e,t))}(`0x${e.slice(130)}`));return n.Signature.fromCompact(e.substring(2,130)).addRecoveryBit(r)})().recoverPublicKey(i.substring(2)).toHex(!1);return`0x${s}`}function sw(e){if(0===e||1===e)return e;if(27===e)return 0;if(28===e)return 1;throw Error("Invalid yParityOrV value")}async function sv({hash:e,signature:t}){var r=await sb({hash:e,signature:t});let i=sg(`0x${r.substring(4)}`).substring(26);return function(e,t){if(sy.has(`${e}.undefined`))return sy.get(`${e}.${void 0}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),i=sg(n5(r),"bytes"),n=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)i[e>>1]>>4>=8&&n[e]&&(n[e]=n[e].toUpperCase()),(15&i[e>>1])>=8&&n[e+1]&&(n[e+1]=n[e+1].toUpperCase());let s=`0x${n.join("")}`;return sy.set(`${e}.${t}`,s),s}(`0x${i}`)}var sx=r(87358),sE=r(81029).Buffer;function s_(e){let[t,r]=e.split(":");return{namespace:t,reference:r}}function sI(e,t){return e.includes(":")?[e]:t.chains||[]}let sA={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"};function sS(){return"u">typeof sx&&"u">typeof sx.versions&&"u">typeof sx.versions.node}function sC(){return!(0,T.getDocument)()&&!!(0,T.getNavigator)()&&"ReactNative"===navigator.product}function sN(){return!sS()&&!!(0,T.getNavigator)()&&!!(0,T.getDocument)()}function sO(e,t){return e.filter(e=>t.includes(e)).length===e.length}function sP(e=C.FIVE_MINUTES,t){let r,i,n,s,o=(0,C.toMiliseconds)(e||C.FIVE_MINUTES);return{resolve:e=>{n&&r&&(clearTimeout(n),r(e),s=Promise.resolve(e))},reject:e=>{n&&i&&(clearTimeout(n),i(e))},done:()=>new Promise((e,a)=>{if(s)return e(s);n=setTimeout(()=>{let e=Error(t);s=Promise.reject(e),a(e)},o),r=e,i=a})}}function sT(e,t){return(0,C.fromMiliseconds)((t||Date.now())+(0,C.toMiliseconds)(e))}function sM(e){return Date.now()>=(0,C.toMiliseconds)(e)}function sR(e,t){return`${e}${t?`:${t}`:""}`}async function sk({id:e,topic:t,wcDeepLink:i}){var n,s;try{if(!i)return;let o="string"==typeof i?JSON.parse(i):i,a=o?.href;if("string"!=typeof a)return;let c=function(e,t,r){let i=`requestId=${t}&sessionTopic=${r}`;e.endsWith("/")&&(e=e.slice(0,-1));let n=`${e}`;if(e.startsWith("https://t.me")){let t=e.includes("?")?"&startapp=":"?startapp=";n=`${n}${t}${function(e,t=!1){let r=sE.from(e).toString("base64");return t?r.replace(/[=]/g,""):r}(i,!0)}`}else n=`${n}/wc?${i}`;return n}(a,e,t),l=sC()?sA.reactNative:sS()?sA.node:sN()?sA.browser:sA.unknown;if(l===sA.browser){let e;if(!(null!=(n=(0,T.getDocument)())&&n.hasFocus()))return void console.warn("Document does not have focus, skipping deeplink.");s=c,e="_self",!function(){try{return window.self!==window.top}catch{return!1}}()?("u">typeof window&&(window.TelegramWebviewProxy||window.Telegram||window.TelegramWebviewProxyProto)||s.startsWith("https://")||s.startsWith("http://"))&&(e="_blank"):e="_top",window.open(s,e,"noreferrer noopener")}else l===sA.reactNative&&"u">typeof(null==r.g?void 0:r.g.Linking)&&await r.g.Linking.openURL(c)}catch(e){console.error(e)}}async function sD(e,t){let r="";try{if(sN()&&(r=localStorage.getItem(t)))return r;r=await e.getItem(t)}catch(e){console.error(e)}return r}function sL(e,t){if(!e.includes(t))return null;let r=e.split(/([&,?,=])/),i=r.indexOf(t);return r[i+2]}function sU(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function sB(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function sj(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function s$(e,t){sB(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}let sz=BigInt(0x100000000-1),sq=BigInt(32),sH="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function sF(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function sW(e,t){return e<<32-t|e>>>t}let sV=68===new Uint8Array(new Uint32Array([0x11223344]).buffer)[0];function sK(e){for(let r=0;r<e.length;r++){var t;e[r]=(t=e[r])<<24&0xff000000|t<<8&0xff0000|t>>>8&65280|t>>>24&255}}function sG(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(e)),sB(e),e}class sY{clone(){return this._cloneInto()}}function sJ(e){let t=t=>e().update(sG(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}let sX=[],sQ=[],sZ=[],s0=BigInt(0),s1=BigInt(1),s2=BigInt(2),s3=BigInt(7),s8=BigInt(256),s5=BigInt(113);for(let e=0,t=s1,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],sX.push(2*(5*i+r)),sQ.push((e+1)*(e+2)/2%64);let n=s0;for(let e=0;e<7;e++)(t=(t<<s1^(t>>s3)*s5)%s8)&s2&&(n^=s1<<(s1<<BigInt(e))-s1);sZ.push(n)}let[s6,s4]=function(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let n=0;n<e.length;n++){let{h:s,l:o}=function(e,t=!1){return t?{h:Number(e&sz),l:Number(e>>sq&sz)}:{h:0|Number(e>>sq&sz),l:0|Number(e&sz)}}(e[n],t);[r[n],i[n]]=[s,o]}return[r,i]}(sZ,!0),s9=(e,t,r)=>r>32?((e,t,r)=>t<<r-32|e>>>64-r)(e,t,r):((e,t,r)=>e<<r|t>>>32-r)(e,t,r),s7=(e,t,r)=>r>32?((e,t,r)=>e<<r-32|t>>>64-r)(e,t,r):((e,t,r)=>t<<r|e>>>32-r)(e,t,r);class oe extends sY{constructor(e,t,r,i=!1,n=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,sU(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}(this.state)}keccak(){sV||sK(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let i=(t+8)%10,n=(t+2)%10,s=r[n],o=r[n+1],a=s9(s,o,1)^r[i],c=s7(s,o,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],n=e[3];for(let r=0;r<24;r++){let i=sQ[r],s=s9(t,n,i),o=s7(t,n,i),a=sX[r];t=e[a],n=e[a+1],e[a]=s,e[a+1]=o}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=s6[i],e[1]^=s4[i]}r.fill(0)}(this.state32,this.rounds),sV||sK(this.state32),this.posOut=0,this.pos=0}update(e){sj(this);let{blockLen:t,state:r}=this,i=(e=sG(e)).length;for(let n=0;n<i;){let s=Math.min(t-this.pos,i-n);for(let t=0;t<s;t++)r[this.pos++]^=e[n++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:i}=this;e[r]^=t,(128&t)!=0&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){sj(this,!1),sB(e),this.finish();let t=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return sU(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(s$(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new oe(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}let ot=sJ(()=>new oe(136,1,32));function or(e){let t=`�Ethereum Signed Message: 13${e.length}`,r=new TextEncoder().encode(t+e);return"0x"+sE.from(ot(r)).toString("hex")}async function oi(e,t,r,i,n,s){switch(r.t){case"eip191":return await on(e,t,r.s);case"eip1271":return await os(e,t,r.s,i,n,s);default:throw Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}async function on(e,t,r){return(await sv({hash:or(t),signature:r})).toLowerCase()===e.toLowerCase()}async function os(e,t,r,i,n,s){let o=s_(i);if(!o.namespace||!o.reference)throw Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${i}`);try{let o="0x1626ba7e",a=r.substring(2),c=or(t).substring(2),l=o+c+"00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000041"+a,h=await fetch(`${s||"https://rpc.walletconnect.org/v1"}/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:Date.now()+Math.floor(1e3*Math.random()),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:l},"latest"]})}),{result:u}=await h.json();return!!u&&u.slice(0,o.length).toLowerCase()===o.toLowerCase()}catch(e){return console.error("isValidEip1271Signature: ",e),!1}}var oo=Object.defineProperty,oa=Object.defineProperties,oc=Object.getOwnPropertyDescriptors,ol=Object.getOwnPropertySymbols,oh=Object.prototype.hasOwnProperty,ou=Object.prototype.propertyIsEnumerable,od=(e,t,r)=>t in e?oo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;let of=e=>e?.split(":"),op=e=>{let t=e&&of(e);if(t)return t[2]+":"+t[3]},og=e=>{let t=e&&of(e);if(t)return t.pop()};async function om(e){let{cacao:t,projectId:r}=e,{s:i,p:n}=t,s=oy(n,n.iss),o=og(n.iss);return await oi(o,s,i,op(n.iss),r)}let oy=(e,t)=>{let r=`${e.domain} wants you to sign in with your Ethereum account:`,i=og(t);if(!e.aud&&!e.uri)throw Error("Either `aud` or `uri` is required to construct the message");let n=e.statement||void 0,s=`URI: ${e.aud||e.uri}
13`,o=`Version: ${e.version}`,a=`Chain ID: ${(e=>{let t=e&&of(e);if(t)return e.includes("did:pkh:")?t[3]:t[1]})(t)}`,c=`Nonce: ${e.nonce}`,l=`Issued At: ${e.iat}`,h=e.exp?`Expiration Time: ${e.exp}`:void 0,u=e.nbf?`Not Before: ${e.nbf}`:void 0,d=e.requestId?`Request ID: ${e.requestId}`:void 0,f=e.resources?`Resources:${e.resources.map(e=>` 14- ${e}`).join("")}`:void 0,p=o_(e.resources);return p&&(n=function(e="",t){ob(t);let r="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(r))return e;let i=[],n=0;Object.keys(t.att).forEach(e=>{let r=Object.keys(t.att[e]).map(e=>({ability:e.split("/")[0],action:e.split("/")[1]}));r.sort((e,t)=>e.action.localeCompare(t.action));let s={};r.forEach(e=>{s[e.ability]||(s[e.ability]=[]),s[e.ability].push(e.action)});let o=Object.keys(s).map(t=>(n++,`(${n}) '${t}': '${s[t].join("', '")}' for '${e}'.`));i.push(o.join(", ").replace(".,","."))});let s=i.join(" "),o=`${r}${s}`;return`${e?e+" ":""}${o}`}(n,ov(p))),[r,i,"",n,"",s,o,a,c,l,h,u,d,f].filter(e=>null!=e).join(` 15`)};function ob(e){if(!e)throw Error("No recap provided, value is undefined");if(!e.att)throw Error("No `att` property found");let t=Object.keys(e.att);if(!(null!=t&&t.length))throw Error("No resources found in `att` property");t.forEach(t=>{let r=e.att[t];if(Array.isArray(r)||"object"!=typeof r)throw Error(`Resource must be an object: ${t}`);if(!Object.keys(r).length)throw Error(`Resource object is empty: ${t}`);Object.keys(r).forEach(e=>{let t=r[e];if(!Array.isArray(t))throw Error(`Ability limits ${e} must be an array of objects, found: ${t}`);if(!t.length)throw Error(`Value of ${e} is empty array, must be an array with objects`);t.forEach(t=>{if("object"!=typeof t)throw Error(`Ability limits (${e}) must be an array of objects, found: ${t}`)})})})}function ow(e){return ob(e),`urn:recap:${sE.from(JSON.stringify(e)).toString("base64").replace(/=/g,"")}`}function ov(e){var t;let r=(t=e.replace("urn:recap:",""),JSON.parse(sE.from(t,"base64").toString("utf-8")));return ob(r),r}function ox(e){var t;let r=ov(e);ob(r);let i=null==(t=r.att)?void 0:t.eip155;return i?Object.keys(i).map(e=>e.split("/")[1]):[]}function oE(e){let t=ov(e);ob(t);let r=[];return Object.values(t.att).forEach(e=>{Object.values(e).forEach(e=>{var t;null!=(t=e?.[0])&&t.chains&&r.push(e[0].chains)})}),[...new Set(r.flat())]}function o_(e){if(!e)return;let t=e?.[e.length-1];return t&&t.includes("urn:recap:")?t:void 0}function oI(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function oA(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function oS(e,...t){if(!oA(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function oC(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function oN(e){if("boolean"!=typeof e)throw Error(`boolean expected, not ${e}`)}let oO=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));if(68!==new Uint8Array(new Uint32Array([0x11223344]).buffer)[0])throw Error("Non little-endian hardware is not supported");function oP(e){if("string"==typeof e)e=function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}(e);else if(oA(e))e=oR(e);else throw Error("Uint8Array expected, got "+typeof e);return e}function oT(e,t,r=!0){if(void 0===t)return new Uint8Array(e);if(t.length!==e)throw Error("invalid output length, expected "+e+", got: "+t.length);if(r&&t.byteOffset%4!=0)throw Error("invalid output, must be aligned");return t}function oM(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(0xffffffff),o=Number(r>>n&s),a=Number(r&s),c=4*!!i,l=4*!i;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)}function oR(e){return Uint8Array.from(e)}function ok(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}let oD=e=>Uint8Array.from(e.split("").map(e=>e.charCodeAt(0))),oL=oD("expand 16-byte k"),oU=oD("expand 32-byte k"),oB=oO(oL),oj=oO(oU);function o$(e,t){return e<<t|e>>>32-t}function oz(e){return e.byteOffset%4==0}let oq=0x100000000-1,oH=new Uint32Array,oF=(e,t)=>255&e[t++]|(255&e[t++])<<8;class oW{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,oS(e=oP(e),32);
15let t=oF(e,0),r=oF(e,2),i=oF(e,4),n=oF(e,6),s=oF(e,8),o=oF(e,10),a=oF(e,12),c=oF(e,14);this.r[0]=8191&t,this.r[1]=(t>>>13|r<<3)&8191,this.r[2]=(r>>>10|i<<6)&7939,this.r[3]=(i>>>7|n<<9)&8191,this.r[4]=(n>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|o<<2)&8191,this.r[7]=(o>>>11|a<<5)&8065,this.r[8]=(a>>>8|c<<8)&8191,this.r[9]=c>>>5&127;for(let t=0;t<8;t++)this.pad[t]=oF(e,16+2*t)}process(e,t,r=!1){let{h:i,r:n}=this,s=n[0],o=n[1],a=n[2],c=n[3],l=n[4],h=n[5],u=n[6],d=n[7],f=n[8],p=n[9],g=oF(e,t+0),m=oF(e,t+2),y=oF(e,t+4),b=oF(e,t+6),w=oF(e,t+8),v=oF(e,t+10),x=oF(e,t+12),E=oF(e,t+14),_=i[0]+(8191&g),I=i[1]+((g>>>13|m<<3)&8191),A=i[2]+((m>>>10|y<<6)&8191),S=i[3]+((y>>>7|b<<9)&8191),C=i[4]+((b>>>4|w<<12)&8191),N=i[5]+(w>>>1&8191),O=i[6]+((w>>>14|v<<2)&8191),P=i[7]+((v>>>11|x<<5)&8191),T=i[8]+((x>>>8|E<<8)&8191),M=i[9]+(E>>>5|2048*!r),R=0,k=0+_*s+5*p*I+5*f*A+5*d*S+5*u*C;R=k>>>13,k&=8191,k+=5*h*N+5*l*O+5*c*P+5*a*T+5*o*M,R+=k>>>13,k&=8191;let D=R+_*o+I*s+5*p*A+5*f*S+5*d*C;R=D>>>13,D&=8191,D+=5*u*N+5*h*O+5*l*P+5*c*T+5*a*M,R+=D>>>13,D&=8191;let L=R+_*a+I*o+A*s+5*p*S+5*f*C;R=L>>>13,L&=8191,L+=5*d*N+5*u*O+5*h*P+5*l*T+5*c*M,R+=L>>>13,L&=8191;let U=R+_*c+I*a+A*o+S*s+5*p*C;R=U>>>13,U&=8191,U+=5*f*N+5*d*O+5*u*P+5*h*T+5*l*M,R+=U>>>13,U&=8191;let B=R+_*l+I*c+A*a+S*o+C*s;R=B>>>13,B&=8191,B+=5*p*N+5*f*O+5*d*P+5*u*T+5*h*M,R+=B>>>13,B&=8191;let j=R+_*h+I*l+A*c+S*a+C*o;R=j>>>13,j&=8191,j+=N*s+5*p*O+5*f*P+5*d*T+5*u*M,R+=j>>>13,j&=8191;let $=R+_*u+I*h+A*l+S*c+C*a;R=$>>>13,$&=8191,$+=N*o+O*s+5*p*P+5*f*T+5*d*M,R+=$>>>13,$&=8191;let z=R+_*d+I*u+A*h+S*l+C*c;R=z>>>13,z&=8191,z+=N*a+O*o+P*s+5*p*T+5*f*M,R+=z>>>13,z&=8191;let q=R+_*f+I*d+A*u+S*h+C*l;R=q>>>13,q&=8191,q+=N*c+O*a+P*o+T*s+5*p*M,R+=q>>>13,q&=8191;let H=R+_*p+I*f+A*d+S*u+C*h;R=H>>>13,H&=8191,H+=N*l+O*c+P*a+T*o+M*s,R+=H>>>13,H&=8191,k=8191&(R=(R=(R<<2)+R|0)+k|0),R>>>=13,D+=R,i[0]=k,i[1]=D,i[2]=L,i[3]=U,i[4]=B,i[5]=j,i[6]=$,i[7]=z,i[8]=q,i[9]=H}finalize(){let{h:e,pad:t}=this,r=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let t=2;t<10;t++)e[t]+=i,i=e[t]>>>13,e[t]&=8191;e[0]+=5*i,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,r[0]=e[0]+5,i=r[0]>>>13,r[0]&=8191;for(let t=1;t<10;t++)r[t]=e[t]+i,i=r[t]>>>13,r[t]&=8191;r[9]-=8192;let n=(1^i)-1;for(let e=0;e<10;e++)r[e]&=n;n=~n;for(let t=0;t<10;t++)e[t]=e[t]&n|r[t];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let s=e[0]+t[0];e[0]=65535&s;for(let r=1;r<8;r++)s=(e[r]+t[r]|0)+(s>>>16)|0,e[r]=65535&s;ok(r)}update(e){oC(this);let{buffer:t,blockLen:r}=this,i=(e=oP(e)).length;for(let n=0;n<i;){let s=Math.min(r-this.pos,i-n);if(s===r){for(;r<=i-n;n+=r)this.process(e,n);continue}t.set(e.subarray(n,n+s),this.pos),this.pos+=s,n+=s,this.pos===r&&(this.process(t,0,!1),this.pos=0)}return this}destroy(){ok(this.h,this.r,this.buffer,this.pad)}digestInto(e){oC(this),function(e,t){oS(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished=!0;let{buffer:t,h:r}=this,{pos:i}=this;if(i){for(t[i++]=1;i<16;i++)t[i]=0;this.process(t,0,!0)}this.finalize();let n=0;for(let t=0;t<8;t++)e[n++]=r[t]>>>0,e[n++]=r[t]>>>8;return e}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}}let oV=function(e){let t=(t,r)=>e(r).update(oP(t)).digest(),r=e(new Uint8Array(32));return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}(e=>new oW(e)),oK=function(e,t){let{allowShortKeys:r,extendNonceFn:i,counterLength:n,counterRight:s,rounds:o}=function(e,t){if(null==t||"object"!=typeof t)throw Error("options must be defined");return Object.assign(e,t)}({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if("function"!=typeof e)throw Error("core must be a function");return oI(n),oI(o),oN(s),oN(r),(t,a,c,l,h=0)=>{oS(t),oS(a),oS(c);let u=c.length;if(void 0===l&&(l=new Uint8Array(u)),oS(l),oI(h),h<0||h>=oq)throw Error("arx: counter overflow");if(l.length<u)throw Error(`arx: output (${l.length}) is shorter than data (${u})`);let d=[],f=t.length,p,g;if(32===f)d.push(p=oR(t)),g=oj;else if(16===f&&r)(p=new Uint8Array(32)).set(t),p.set(t,16),g=oB,d.push(p);
15else throw Error(`arx: invalid 32-byte key, got length=${f}`);oz(a)||d.push(a=oR(a));let m=oO(p);if(i){if(24!==a.length)throw Error("arx: extended nonce must be 24 bytes");i(g,m,oO(a.subarray(0,16)),m),a=a.subarray(16)}let y=16-n;if(y!==a.length)throw Error(`arx: nonce must be ${y} or 16 bytes`);if(12!==y){let e=new Uint8Array(12);e.set(a,s?0:12-a.length),a=e,d.push(a)}return function(e,t,r,i,n,s,o,a){let c=n.length,l=new Uint8Array(64),h=oO(l),u=oz(n)&&oz(s),d=u?oO(n):oH,f=u?oO(s):oH;for(let p=0;p<c;o++){if(e(t,r,i,h,o,a),o>=oq)throw Error("arx: counter overflow");let g=Math.min(64,c-p);if(u&&64===g){let e=p/4;if(p%4!=0)throw Error("arx: invalid block position");for(let t=0,r;t<16;t++)f[r=e+t]=d[r]^h[t];p+=64;continue}for(let e=0,t;e<g;e++)s[t=p+e]=n[t]^l[e];p+=g}}(e,g,m,oO(a),c,l,h,o),ok(...d),l}}(function(e,t,r,i,n,s=20){let o=e[0],a=e[1],c=e[2],l=e[3],h=t[0],u=t[1],d=t[2],f=t[3],p=t[4],g=t[5],m=t[6],y=t[7],b=r[0],w=r[1],v=r[2],x=o,E=a,_=c,I=l,A=h,S=u,C=d,N=f,O=p,P=g,T=m,M=y,R=n,k=b,D=w,L=v;for(let e=0;e<s;e+=2)O=O+(R=o$(R^(x=x+A|0),16))|0,x=x+(A=o$(A^O,12))|0,O=O+(R=o$(R^x,8))|0,A=o$(A^O,7),P=P+(k=o$(k^(E=E+S|0),16))|0,E=E+(S=o$(S^P,12))|0,P=P+(k=o$(k^E,8))|0,S=o$(S^P,7),T=T+(D=o$(D^(_=_+C|0),16))|0,_=_+(C=o$(C^T,12))|0,T=T+(D=o$(D^_,8))|0,C=o$(C^T,7),M=M+(L=o$(L^(I=I+N|0),16))|0,I=I+(N=o$(N^M,12))|0,M=M+(L=o$(L^I,8))|0,N=o$(N^M,7),T=T+(L=o$(L^(x=x+S|0),16))|0,x=x+(S=o$(S^T,12))|0,T=T+(L=o$(L^x,8))|0,S=o$(S^T,7),M=M+(R=o$(R^(E=E+C|0),16))|0,E=E+(C=o$(C^M,12))|0,M=M+(R=o$(R^E,8))|0,C=o$(C^M,7),O=O+(k=o$(k^(_=_+N|0),16))|0,_=_+(N=o$(N^O,12))|0,O=O+(k=o$(k^_,8))|0,N=o$(N^O,7),P=P+(D=o$(D^(I=I+A|0),16))|0,I=I+(A=o$(A^P,12))|0,P=P+(D=o$(D^I,8))|0,A=o$(A^P,7);let U=0;i[U++]=o+x|0,i[U++]=a+E|0,i[U++]=c+_|0,i[U++]=l+I|0,i[U++]=h+A|0,i[U++]=u+S|0,i[U++]=d+C|0,i[U++]=f+N|0,i[U++]=p+O|0,i[U++]=g+P|0,i[U++]=m+T|0,i[U++]=y+M|0,i[U++]=n+R|0,i[U++]=b+k|0,i[U++]=w+D|0,i[U++]=v+L|0},{counterRight:!1,counterLength:4,allowShortKeys:!1}),oG=new Uint8Array(16),oY=(e,t)=>{e.update(t);let r=t.length%16;r&&e.update(oG.subarray(r))}
15,oJ=new Uint8Array(32);function oX(e,t,r,i,n){let s=e(t,r,oJ),o=oV.create(s);n&&oY(o,n),oY(o,i);let a=new Uint8Array(16),c=new DataView(a.buffer,a.byteOffset,a.byteLength);oM(c,0,BigInt(n?n.length:0),!0),oM(c,8,BigInt(i.length),!0),o.update(a);let l=o.digest();return ok(s,a),l}((e,t)=>Object.assign(function(r,...i){if(oS(r),void 0!==e.nonceLength){let t=i[0];if(!t)throw Error("nonce / iv required");e.varSizeNonce?oS(t):oS(t,e.nonceLength)}let n=e.tagLength;n&&void 0!==i[1]&&oS(i[1]);let s=t(r,...i),o=(e,t)=>{if(void 0!==t){if(2!==e)throw Error("cipher output not supported");oS(t)}},a=!1;return{encrypt(e,t){if(a)throw Error("cannot encrypt() twice with same key + nonce");return a=!0,oS(e),o(s.encrypt.length,t),s.encrypt(e,t)},decrypt(e,t){if(oS(e),n&&e.length<n)throw Error("invalid ciphertext length: smaller than tagLength="+n);return o(s.decrypt.length,t),s.decrypt(e,t)}}},e))({blockSize:64,nonceLength:12,tagLength:16},(e=>(t,r,i)=>({encrypt(n,s){let o=n.length;(s=oT(o+16,s,!1)).set(n);let a=s.subarray(0,-16);e(t,r,a,a,1);let c=oX(e,t,r,a,i);return s.set(c,o),ok(c),s},decrypt(n,s){s=oT(n.length-16,s,!1);let o=n.subarray(0,-16),a=n.subarray(-16),c=oX(e,t,r,o,i);if(!function(e,t){if(e.length!==t.length)return!1;let r=0;for(let i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r}(a,c))throw Error("invalid tag");return s.set(n.subarray(0,-16)),e(t,r,s,s,1),ok(c),s}}))(oK));new Uint8Array([0]),new Uint8Array;
15class oQ extends sY{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=sF(this.buffer)}update(e){sj(this);let{view:t,buffer:r,blockLen:i}=this,n=(e=sG(e)).length;for(let s=0;s<n;){let o=Math.min(i-this.pos,n-s);if(o===i){let t=sF(e);for(;i<=n-s;s+=i)this.process(t,s);continue}r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){sj(this),s$(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:i,isLE:n}=this,{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(r,0),s=0);for(let e=s;e<i;e++)t[e]=0;(function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(0xffffffff),o=Number(r>>n&s),a=Number(r&s),c=4*!!i,l=4*!i;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)})(r,i-8,BigInt(8*this.length),n),this.process(r,0);let o=sF(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=a/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)o.setUint32(4*e,l[e],n)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:i,finished:n,destroyed:s,pos:o}=this;return e.length=i,e.pos=o,e.finished=n,e.destroyed=s,i%t&&e.buffer.set(r),e}}let oZ=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),o0=new Uint32Array([0x6a09e66
157,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),o1=new Uint32Array(64);class o2 extends oQ{constructor(){super(64,32,8,!1),this.A=0|o0[0],this.B=0|o0[1],this.C=0|o0[2],this.D=0|o0[3],this.E=0|o0[4],this.F=0|o0[5],this.G=0|o0[6],this.H=0|o0[7]}get(){let{A:e,B:t,C:r,D:i,E:n,F:s,G:o,H:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)o1[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=o1[e-15],r=o1[e-2],i=sW(t,7)^sW(t,18)^t>>>3,n=sW(r,17)^sW(r,19)^r>>>10;o1[e]=n+o1[e-7]+i+o1[e-16]|0}let{A:r,B:i,C:n,D:s,E:o,F:a,G:c,H:l}=this;for(let e=0;e<64;e++){var h,u,d,f;let t=l+(sW(o,6)^sW(o,11)^sW(o,25))+((h=o)&a^~h&c)+oZ[e]+o1[e]|0,p=(sW(r,2)^sW(r,13)^sW(r,22))+((u=r)&(d=i)^u&(f=n)^d&f)|0;l=c,c=a,a=o,o=s+t|0,s=n,n=i,i=r,r=t+p|0}r=r+this.A|0,i=i+this.B|0,n=n+this.C|0,s=s+this.D|0,o=o+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,i,n,s,o,a,c,l)}roundClean(){o1.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let o3=sJ(()=>new o2),o8=BigInt(0);function o5(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}let o6=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),o4={_0:48,_9:57,A:65,F:70,a:97,f:102};function o9(e){return e>=o4._0&&e<=o4._9?e-o4._0:e>=o4.A&&e<=o4.F?e-(o4.A-10):e>=o4.a&&e<=o4.f?e-(o4.a-10):void 0}function o7(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let i=new Uint8Array(r);for(let t=0,n=0;t<r;t++,n+=2){let r=o9(e.charCodeAt(n)),s=o9(e.charCodeAt(n+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[n]+e[n+1])+'" at index '+n);i[t]=16*r+s}return i}let ae={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||o5(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)},at=BigInt(0),ar=BigInt(1);function ai(e,t){let r=e%t;return r>=at?r:t+r}function an(e,t,r){let i=e;for(;t-- >at;)i*=i,i%=r;return i}BigInt(0),BigInt(1),BigInt(0),BigInt(1),BigInt(2),BigInt(8);let as=BigInt(0),ao=BigInt(1),aa=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);let ac=BigInt(1),al=BigInt(2),ah=BigInt(3),au=BigInt(5);BigInt(8),!function(e){let t=(function(e,t,r={}){let i=(t,r,i)=>{let n=ae[r];if("function"!=typeof n)throw Error("invalid validator function");let s=e[t];if(!(i&&void 0===s)&&!n(s,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))i(e,r,!1);for(let[e,t]of Object.entries(r))i(e,t,!0)}(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})),{P:r}=t,i=e=>ai(e,r),n=t.montgomeryBits,s=Math.ceil(n/8),o=t.nByteLength,a=t.adjustScalarBytes||(e=>e),c=t.powPminus2||(e=>(function(e,t,r){if(t<at)throw Error("invalid exponent, negatives unsupported");if(r<=at)throw Error("invalid modulus");if(r===ar)return at;let i=ar;for(;t>at;)t&ar&&(i=i*e%r),e=e*e%r,t>>=ar;return i})(e,r-BigInt(2),r));(t.a-BigInt(2))/BigInt(4);function l(e){var t;return t=i(e),o7(t.toString(16).padStart(2*s,"0")).reverse()}l(t.Gu)}({P:aa,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{let{pow_p_5_8:t,b2:r}=function(e){let t=BigInt(10),r=BigInt(20),i=BigInt(40),n=BigInt(80),s=e*e%aa*e%aa,o=an(s,al,aa)*s%aa,a=an(o,ac,aa)*e%aa,c=an(a,au,aa)*a%aa,l=an(c,t,aa)*c%aa,h=an(l,r,aa)*l%aa,u=an(h,i,aa)*h%aa,d=an(u,n,aa)*u%aa,f=an(d,n,aa)*u%aa,p=an(f,t,aa)*c%aa;return{pow_p_5_8:an(p,al,aa)*e%aa,b2:s}}(e);return ai(an(t,ah,aa)*r,aa)},adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},randomBytes:function(e=32){if(sH&&"function"==typeof sH.getRandomValues)return sH.getRandomValues(new Uint8Array(e));if(sH&&"function"==typeof sH.randomBytes)return sH.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}});let ad="base16",af="base64pad",ap="base64url";function ag(e){let t=o3((0,k.sH)(e,ad));return(0,k.dI)(t,ad)}function am(e){let t=o3((0,k.sH)(e,"utf8"));return(0,k.dI)(t,ad)}function ay(e,t,r){return`${e}?wc_ev=${r}&topic=${t}`}function ab(e){let t=[];
15return e.forEach(e=>{let[r,i]=e.split(":");t.push(`${r}:${i}`)}),t}function aw(e,t){let r=function(e){let t={};return e?.forEach(e=>{var r;let[i,n]=e.split(":");t[i]||(t[i]={accounts:[],chains:[],events:[],methods:[]}),t[i].accounts.push(e),null==(r=t[i].chains)||r.push(`${i}:${n}`)}),t}(t=t.map(e=>e.replace("did:pkh:","")));for(let[t,i]of Object.entries(r))i.methods?i.methods=function(e=[],t=[]){return[...new Set([...e,...t])]}(i.methods,e):i.methods=e,i.events=["chainChanged","accountsChanged"];return r}Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;let av={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},ax={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function aE(e,t){let{message:r,code:i}=ax[e];return{message:t?`${r} ${t}`:r,code:i}}function a_(e,t){let{message:r,code:i}=av[e];return{message:t?`${r} ${t}`:r,code:i}}function aI(e,t){return!!Array.isArray(e)&&(!("u">typeof t)||!e.length||e.every(t))}function aA(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function aS(e){return typeof e>"u"}function aC(e,t){return!!(t&&aS(e))||"string"==typeof e&&!!e.trim().length}function aN(e,t){return!!(t&&aS(e))||"number"==typeof e&&!isNaN(e)}function aO(e){return!!(aC(e,!1)&&e.includes(":"))&&2===e.split(":").length}function aP(e){let t=!0;return aI(e)?e.length&&(t=e.every(e=>aC(e,!1))):t=!1,t}function aT(e,t){let r=null;return Object.values(e).forEach(e=>{var i;let n;if(r)return;let s=(i=`${t}, namespace`,n=null,aP(e?.methods)?aP(e?.events)||(n=a_("UNSUPPORTED_EVENTS",`${i}, events should be an array of strings or empty array for no events`)):n=a_("UNSUPPORTED_METHODS",`${i}, methods should be an array of strings or empty array for no methods`),n);s&&(r=s)}),r}function aM(e,t){let r=null;if(e&&aA(e)){let i,n=aT(e,t);n&&(r=n);let s=(i=null,Object.values(e).forEach(e=>{var r,n;let s;if(i)return;let o=(r=e?.accounts,n=`${t} namespace`,s=null,aI(r)?r.forEach(e=>{s||function(e){if(aC(e,!1)&&e.includes(":")){let t=e.split(":");if(3===t.length){let e=t[0]+":"+t[1];return!!t[2]&&aO(e)}}return!1}(e)||(s=a_("UNSUPPORTED_ACCOUNTS",`${n}, account ${e} should be a string and conform to "namespace:chainId:address" format`))}):s=a_("UNSUPPORTED_ACCOUNTS",`${n}
15, accounts should be an array of strings conforming to "namespace:chainId:address" format`),s);o&&(i=o)}),i);s&&(r=s)}else r=aE("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return r}function aR(e){return aC(e.protocol,!0)}function ak(e){return"u">typeof e}function aD(e,t){return!(!aO(t)||!(function(e){let t=[];return Object.values(e).forEach(e=>{t.push(...ab(e.accounts))}),t})(e).includes(t))}function aL(e,t,r){let i=null,n=function(e){let t={};return Object.keys(e).forEach(r=>{var i;r.includes(":")?t[r]=e[r]:null==(i=e[r].chains)||i.forEach(i=>{t[i]={methods:e[r].methods,events:e[r].events}})}),t}(e),s=function(e){let t={};return Object.keys(e).forEach(r=>{if(r.includes(":"))t[r]=e[r];else{let i=ab(e[r].accounts);i?.forEach(i=>{t[i]={accounts:e[r].accounts.filter(e=>e.includes(`${i}:`)),methods:e[r].methods,events:e[r].events}})}}),t}(t),o=Object.keys(n),a=Object.keys(s),c=aU(Object.keys(e)),l=aU(Object.keys(t)),h=c.filter(e=>!l.includes(e));return h.length&&(i=aE("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. 16 Required: ${h.toString()} 17 Received: ${Object.keys(t).toString()}`)),sO(o,a)||(i=aE("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. 18 Required: ${o.toString()} 19 Approved: ${a.toString()}`)),Object.keys(t).forEach(e=>{if(!e.includes(":")||i)return;let n=ab(t[e].accounts);n.includes(e)||(i=aE("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${e} 20 Required: ${e} 21 Approved: ${n.toString()}`))}),o.forEach(e=>{i||(sO(n[e].methods,s[e].methods)?sO(n[e].events,s[e].events)||(i=aE("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${e}`)):i=aE("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${e}`))}),i}function aU(e){return[...new Set(e.map(e=>e.includes(":")?e.split(":")[0]:e))]}let aB={};class aj{static get(e){return aB[e]}static set(e,t){aB[e]=t}static delete(e){delete aB[e]}}let a$="client",az=`wc@2:${a$}:`,aq={name:a$,logger:"error"},aH="WALLETCONNECT_DEEPLINK_CHOICE",aF="Proposal expired",aW=C.SEVEN_DAYS,aV={wc_sessionPropose:{req:{ttl:C.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:C.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:C.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:C.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:C.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:C.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:C.ONE_DAY,prompt:!1,tag:1104},res:{ttl:C.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:C.ONE_DAY,prompt:!1,tag:1106},res:{ttl:C.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:C.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:C.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:C.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:C.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:C.ONE_DAY,prompt:!1,tag:1112},res:{ttl:C.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:C.ONE_DAY,prompt:!1,tag:1114},res:{ttl:C.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:C.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:C.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:C.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:C.FIVE_MINUTES,prompt:!1,tag:1119}}},aK={min:C.FIVE_MINUTES,max:C.SEVEN_DAYS},aG={idle:"IDLE",active:"ACTIVE"},aY={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"}},aJ=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],aX="[email protected]:auth:",aQ=`${aX}:PUB_KEY`;var aZ=Object.defineProperty,a0=Object.defineProperties,a1=Object.getOwnPropertyDescriptors,a2=Object.getOwnPropertySymbols,a3=Object.prototype.hasOwnProperty,a8=Object.prototype.propertyIsEnumerable,a5=(e,t,r)=>t in e?aZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,a6=(e,t)=>{for(var r in t||(t={}))a3.call(t,r)&&a5(e,r,t[r]);if(a2)for(var r of a2(t))a8.call(t,r)&&a5(e,r,t[r]);return e},a4=(e,t)=>
21a0(e,a1(t)),a9=(e,t,r)=>a5(e,"symbol"!=typeof t?t+"":t,r);class a7 extends S{constructor(e){super(e),a9(this,"name","engine"),a9(this,"events",new(n())),a9(this,"initialized",!1),a9(this,"requestQueue",{state:aG.idle,queue:[]}),a9(this,"sessionRequestQueue",{state:aG.idle,queue:[]}),a9(this,"requestQueueDelay",C.ONE_SECOND),a9(this,"expectedPairingMethodMap",new Map),a9(this,"recentlyDeletedMap",new Map),a9(this,"recentlyDeletedLimit",200),a9(this,"relayMessageCache",[]),a9(this,"pendingSessions",new Map),a9(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(aV)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},(0,C.toMiliseconds)(this.requestQueueDelay)))}),a9(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();let t=a4(a6({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);let{pairingTopic:r,requiredNamespaces:i,optionalNamespaces:n,sessionProperties:s,scopedProperties:o,relays:a}=t,c=r,l,h=!1;try{if(c){let e=this.client.core.pairing.pairings.get(c);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),h=e.active}}catch(e){throw this.client.logger.error(`connect() -> pairing.get(${c}) failed`),e}if(!c||!h){let{topic:e,uri:t}=await this.client.core.pairing.create();c=e,l=t}if(!c){let{message:e}=aE("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw Error(e)}let u=await this.client.core.crypto.generateKeyPair(),d=aV.wc_sessionPropose.req.ttl||C.FIVE_MINUTES,f=sT(d),p=a4(a6(a6({requiredNamespaces:i,optionalNamespaces:n,relays:a??[{protocol:"irn"}],proposer:{publicKey:u,metadata:this.client.metadata},expiryTimestamp:f,pairingTopic:c},s&&{sessionProperties:s}),o&&{scopedProperties:o}),{id:(0,t3.payloadId)()}),g=sR("session_connect",p.id),{reject:m,resolve:y,done:b}=sP(d,aF),w=({id:e})=>{e===p.id&&(this.client.events.off("proposal_expire",w),this.pendingSessions.delete(p.id),this.events.emit(g,{error:{message:aF,code:0}}))};return this.client.events.on("proposal_expire",w),this.events.once(g,({error:e,session:t})=>{this.client.events.off("proposal_expire",w),e?m(e):t&&y(t)}),await this.sendRequest({topic:c,method:"wc_sessionPropose",params:p,throwOnFailedPublish:!0,clientRpcId:p.id}),await this.setProposal(p.id,p),{uri:l,approval:b}}),a9(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(e){throw this.client.logger.error("pair() failed"),e}}),a9(this,"approve",async e=>{var t,r,i;let n=this.client.core.eventClient.createEvent({properties:{topic:null==(t=e?.id)?void 0:t.toString(),trace:[rv.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(e){throw n.setError(rx.no_internet_connection),e}try{await this.isValidProposalId(e?.id)}catch(t){throw this.client.logger.error(`approve() -> proposal.get(${e?.id}) failed`),n.setError(rx.proposal_not_found),t}try{await this.isValidApprove(e)}catch(e){throw this.client.logger.error("approve() -> isValidApprove() failed"),n.setError(rx.session_approve_namespace_validation_failure),e}let{id:s,relayProtocol:o,namespaces:a,sessionProperties:c,scopedProperties:l,sessionConfig:h}=e,u=this.client.proposal.get(s);this.client.core.eventClient.deleteEvent({eventId:n.eventId});let{pairingTopic:d,proposer:f,requiredNamespaces:p,optionalNamespaces:g}=u,m=null==(r=this.client.core.eventClient)?void 0:r.getEvent({topic:d});m||(m=null==(i=this.client.core.eventClient)?void 0:i.createEvent({type:rv.session_approve_started,properties:{topic:d,trace:[rv.session_approve_started,rv.session_namespaces_validation_success]}}));let y=await this.client.core.crypto.generateKeyPair(),b=f.publicKey,w=await this.client.core.crypto.generateSharedKey(y,b),v=a6(a6(a6({relay:{protocol:o??"irn"},namespaces:a,controller:{publicKey:y,metadata:this.client.metadata},expiry:sT(aW)},c&&{sessionProperties:c}),l&&{scopedProperties:l}),h&&{sessionConfig:h}),x=ra.relay;m.addTrace(rv.subscribing_session_topic);try{await this.client.core.relayer.subscribe(w,{transportType:x})}catch(e){throw m.setError(rx.subscribe_session_topic_failure),e}m.addTrace(rv.subscribe_session_topic_success);let E=a4(a6({},v),{topic:w,requiredNamespaces:p,optionalNamespaces:g,pairingTopic:d,acknowledged:!1,self:v.controller,peer:{publicKey:f.publicKey,metadata:f.metadata},controller:y,transportType:ra.relay});await this.client.session.set(w,E),m.addTrace(rv.store_session);try{m.addTrace(rv.publishing_session_settle),await this.sendRequest({topic:w,method:"wc_sessionSettle",params:v,throwOnFailedPublish:!0}).catch(e=>{throw m?.setError(rx.session_settle_publish_failure),e}),m.addTrace(rv.session_settle_publish_success),m.addTrace(rv.publishing_session_approve),await this.sendResult({id:s,topic:d,result:{relay:{protocol:o??"irn"},responderPublicKey:y},throwOnFailedPublish:!0}).catch(e=>{throw m?.setError(rx.session_approve_publish_failure),e}),m.addTrace(rv.session_approve_publish_success)}catch(e){throw this.client.logger.error(e),this.client.session.delete(w,a_("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(w),e}return this.client.core.eventClient.deleteEvent({eventId:m.eventId}),await this.client.core.pairing.updateMetadata({topic:d,metadata:f.metadata}),await this.client.proposal.delete(s,a_("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:d}),await this.setExpiry(w,sT(aW)),{topic:w,acknowledged:()=>Promise.resolve(this.client.session.get(w))}}),a9(this,"reject",async e=>{let t;this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(e){throw this.client.logger.error("reject() -> isValidReject() failed"),e}let{id:r,reason:i}=e;try{t=this.client.proposal.get(r).pairingTopic}catch(e){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),e}
21t&&(await this.sendError({id:r,topic:t,error:i,rpcOpts:aV.wc_sessionPropose.reject}),await this.client.proposal.delete(r,a_("USER_DISCONNECTED")))}),a9(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(e){throw this.client.logger.error("update() -> isValidUpdate() failed"),e}let{topic:t,namespaces:r}=e,{done:i,resolve:n,reject:s}=sP(),o=(0,t3.payloadId)(),a=(0,t3.getBigIntRpcId)().toString(),c=this.client.session.get(t).namespaces;return this.events.once(sR("session_update",o),({error:e})=>{e?s(e):n()}),await this.client.session.update(t,{namespaces:r}),await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:r},throwOnFailedPublish:!0,clientRpcId:o,relayRpcId:a}).catch(e=>{this.client.logger.error(e),this.client.session.update(t,{namespaces:c}),s(e)}),{acknowledged:i}}),a9(this,"extend",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(e){throw this.client.logger.error("extend() -> isValidExtend() failed"),e}let{topic:t}=e,r=(0,t3.payloadId)(),{done:i,resolve:n,reject:s}=sP();return this.events.once(sR("session_extend",r),({error:e})=>{e?s(e):n()}),await this.setExpiry(t,sT(aW)),this.sendRequest({topic:t,method:"wc_sessionExtend",params:{},clientRpcId:r,throwOnFailedPublish:!0}).catch(e=>{s(e)}),{acknowledged:i}}),a9(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(e){throw this.client.logger.error("request() -> isValidRequest() failed"),e}let{chainId:t,request:r,topic:i,expiry:n=aV.wc_sessionRequest.req.ttl}=e,s=this.client.session.get(i);s?.transportType===ra.relay&&await this.confirmOnlineStateOrThrow();let o=(0,t3.payloadId)(),a=(0,t3.getBigIntRpcId)().toString(),{done:c,resolve:l,reject:h}=sP(n,"Request expired. Please try again.");this.events.once(sR("session_request",o),({error:e,result:t})=>{e?h(e):l(t)});let u="wc_sessionRequest",d=this.getAppLinkIfEnabled(s.peer.metadata,s.transportType);if(d)return await this.sendRequest({clientRpcId:o,relayRpcId:a,topic:i,method:u,params:{request:a4(a6({},r),{expiryTimestamp:sT(n)}),chainId:t},expiry:n,throwOnFailedPublish:!0,appLink:d}).catch(e=>h(e)),this.client.events.emit("session_request_sent",{topic:i,request:r,chainId:t,id:o}),await c();let f={request:a4(a6({},r),{expiryTimestamp:sT(n)}),chainId:t},p=this.shouldSetTVF(u,f);return await Promise.all([new Promise(async e=>{await this.sendRequest(a6({clientRpcId:o,relayRpcId:a,topic:i,method:u,params:f,expiry:n,throwOnFailedPublish:!0},p&&{tvf:this.getTVFParams(o,f)})).catch(e=>h(e)),this.client.events.emit("session_request_sent",{topic:i,request:r,chainId:t,id:o}),e()}),new Promise(async e=>{var t;if(!(null!=(t=s.sessionConfig)&&t.disableDeepLink)){let e=await sD(this.client.core.storage,aH);await sk({id:o,topic:i,wcDeepLink:e})}e()}),c()]).then(e=>e[2])}),a9(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);let{topic:t,response:r}=e,{id:i}=r,n=this.client.session.get(t);n.transportType===ra.relay&&await this.confirmOnlineStateOrThrow();let s=this.getAppLinkIfEnabled(n.peer.metadata,n.transportType);(0,t3.isJsonRpcResult)(r)?await this.sendResult({id:i,topic:t,result:r.result,throwOnFailedPublish:!0,appLink:s}):(0,t3.isJsonRpcError)(r)&&await this.sendError({id:i,topic:t,error:r.error,appLink:s}),this.cleanupAfterResponse(e)}),a9(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(e){throw this.client.logger.error("ping() -> isValidPing() failed"),e}let{topic:t}=e;if(this.client.session.keys.includes(t)){let e=(0,t3.payloadId)(),r=(0,t3.getBigIntRpcId)().toString(),{done:i,resolve:n,reject:s}=sP();this.events.once(sR("session_ping",e),({error:e})=>{e?s(e):n()}),await Promise.all([this.sendRequest({topic:t,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:e,relayRpcId:r}),i()])}else this.client.core.pairing.pairings.keys.includes(t)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:t}))}),a9(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);let{topic:t,event:r,chainId:i}=e,n=(0,t3.getBigIntRpcId)().toString(),s=(0,t3.payloadId)();await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:r,chainId:i},throwOnFailedPublish:!0,relayRpcId:n,clientRpcId:s})}),a9(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);let{topic:t}=e;if(this.client.session.keys.includes(t))await this.sendRequest({topic:t,method:"wc_sessionDelete",params:a_("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:t,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(t))await this.client.core.pairing.disconnect({topic:t});else{let{message:e}=aE("MISMATCHED_TOPIC",`Session or pairing topic not found: ${t}`);throw Error(e)}}),a9(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(t=>(function(e,t){let{requiredNamespaces:r}=t,i=Object.keys(e.namespaces),n=Object.keys(r),s=!0;return!!sO(n,i)&&(i.forEach(t=>{let{accounts:i,methods:n,events:o}=e.namespaces[t],a=ab(i),c=r[t];sO(sI(t,c),a)&&sO(c.methods,n)&&sO(c.events,o)||(s=!1)}),s)})(t,e)))),a9(this,"getPendingSessionRequests",()=>
21this.client.pendingRequest.getAll()),a9(this,"authenticate",async(e,t)=>{var r,i,n;let s;this.isInitialized(),this.isValidAuthenticate(e);let o=t&&this.client.core.linkModeSupportedApps.includes(t)&&(null==(r=this.client.metadata.redirect)?void 0:r.linkMode),a=o?ra.link_mode:ra.relay;a===ra.relay&&await this.confirmOnlineStateOrThrow();let{chains:c,statement:l="",uri:h,domain:u,nonce:d,type:f,exp:p,nbf:g,methods:m=[],expiry:y}=e,b=[...e.resources||[]],{topic:w,uri:v}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:a});this.client.logger.info({message:"Generated new pairing",pairing:{topic:w,uri:v}});let x=await this.client.core.crypto.generateKeyPair(),E=ag(x);if(await Promise.all([this.client.auth.authKeys.set(aQ,{responseTopic:E,publicKey:x}),this.client.auth.pairingTopics.set(E,{topic:E,pairingTopic:w})]),await this.client.core.relayer.subscribe(E,{transportType:a}),this.client.logger.info(`sending request to new pairing topic: ${w}`),m.length>0){let{namespace:e}=s_(c[0]),t=ow(function(e,t,r,i={}){return r?.sort((e,t)=>e.localeCompare(t)),{att:{[e]:function(e,t,r={}){return Object.assign({},...(t=t?.sort((e,t)=>e.localeCompare(t))).map(t=>({[`${e}/${t}`]:[r]})))}(t,r,i)}}}(e,"request",m));o_(b)&&(i=t,n=b.pop(),t=ow(function(e,t){ob(e),ob(t);let r=Object.keys(e.att).concat(Object.keys(t.att)).sort((e,t)=>e.localeCompare(t)),i={att:{}};return r.forEach(r=>{var n,s;Object.keys((null==(n=e.att)?void 0:n[r])||{}).concat(Object.keys((null==(s=t.att)?void 0:s[r])||{})).sort((e,t)=>e.localeCompare(t)).forEach(n=>{var s,o;i.att[r]=oa(((e,t)=>{for(var r in t||(t={}))oh.call(t,r)&&od(e,r,t[r]);if(ol)for(var r of ol(t))ou.call(t,r)&&od(e,r,t[r]);return e})({},i.att[r]),oc({[n]:(null==(s=e.att[r])?void 0:s[n])||(null==(o=t.att[r])?void 0:o[n])}))})}),i}(ov(i),ov(n)))),b.push(t)}let _=y&&y>aV.wc_sessionAuthenticate.req.ttl?y:aV.wc_sessionAuthenticate.req.ttl,I={authPayload:{type:f??"caip122",chains:c,statement:l,aud:h,domain:u,version:"1",nonce:d,iat:new Date().toISOString(),exp:p,nbf:g,resources:b},requester:{publicKey:x,metadata:this.client.metadata},expiryTimestamp:sT(_)},A={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:c,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},relays:[{protocol:"irn"}],pairingTopic:w,proposer:{publicKey:x,metadata:this.client.metadata},expiryTimestamp:sT(aV.wc_sessionPropose.req.ttl),id:(0,t3.payloadId)()},{done:S,resolve:C,reject:N}=sP(_,"Request expired"),O=(0,t3.payloadId)(),P=sR("session_connect",A.id),T=sR("session_request",O),M=async({error:e,session:t})=>{this.events.off(T,R),e?N(e):t&&C({session:t})},R=async e=>{var r,i,n;let s;if(await this.deletePendingAuthRequest(O,{message:"fulfilled",code:0}),e.error){let t=a_("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return e.error.code===t.code?void 0:(this.events.off(P,M),N(e.error.message))}await this.deleteProposal(A.id),this.events.off(P,M);let{cacaos:o,responder:c}=e.result,l=[],h=[];for(let e of o){await om({cacao:e,projectId:this.client.core.projectId})||(this.client.logger.error(e,"Signature verification failed"),N(a_("SESSION_SETTLEMENT_FAILED","Signature verification failed")));let{p:t}=e,r=o_(t.resources),i=[op(t.iss)],n=og(t.iss);if(r){let e=ox(r),t=oE(r);l.push(...e),i.push(...t)}for(let e of i)h.push(`${e}:${n}`)}let u=await this.client.core.crypto.generateSharedKey(x,c.publicKey);l.length>0&&(s={topic:u,acknowledged:!0,self:{publicKey:x,metadata:this.client.metadata},peer:c,controller:c.publicKey,expiry:sT(aW),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:w,namespaces:aw([...new Set(l)],[...new Set(h)]),transportType:a},await this.client.core.relayer.subscribe(u,{transportType:a}),await this.client.session.set(u,s),w&&await this.client.core.pairing.updateMetadata({topic:w,metadata:c.metadata}),s=this.client.session.get(u)),null!=(r=this.client.metadata.redirect)&&r.linkMode&&null!=(i=c.metadata.redirect)&&i.linkMode&&null!=(n=c.metadata.redirect)&&n.universal&&t&&(this.client.core.addLinkModeSupportedApp(c.metadata.redirect.universal),this.client.session.update(u,{transportType:ra.link_mode})),C({auths:o,session:s})};this.events.once(P,M),this.events.once(T,R);try{if(o){let e=(0,t3.formatJsonRpcRequest)("wc_sessionAuthenticate",I,O);this.client.core.history.set(w,e);let r=await this.client.core.crypto.encode("",e,{type:2,encoding:ap});s=ay(t,w,r)}else await Promise.all([this.sendRequest({topic:w,method:"wc_sessionAuthenticate",params:I,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:O}),this.sendRequest({topic:w,method:"wc_sessionPropose",params:A,expiry:aV.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:A.id})])}catch(e){throw this.events.off(P,M),this.events.off(T,R),e}return await this.setProposal(A.id,A),await this.setAuthRequest(O,{request:a4(a6({},I),{verifyContext:{}}),pairingTopic:w,transportType:a}),{uri:s??v,response:S}}),a9(this,"approveSessionAuthenticate",async e=>{let t,{id:r,auths:i}=e,n=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[rE.authenticated_session_approve_started]}});try{this.isInitialized()}catch(e){throw n.setError(r_.no_internet_connection),e}let s=this.getPendingAuthRequest(r);if(!s)throw n.setError(r_.authenticated_session_pending_request_not_found),Error(`Could not find pending auth request with id ${r}`);let o=s.transportType||ra.relay;o===ra.relay&&await this.confirmOnlineStateOrThrow();let a=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=ag(a),h={type:1,receiverPublicKey:a,senderPublicKey:c},u=[],d=[];for(let e of i){if(!await om({cacao:e,projectId:this.client.core.projectId}
21)){n.setError(r_.invalid_cacao);let e=a_("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:r,topic:l,error:e,encodeOpts:h}),Error(e.message)}n.addTrace(rE.cacaos_verified);let{p:t}=e,i=o_(t.resources),s=[op(t.iss)],o=og(t.iss);if(i){let e=ox(i),t=oE(i);u.push(...e),s.push(...t)}for(let e of s)d.push(`${e}:${o}`)}let f=await this.client.core.crypto.generateSharedKey(c,a);if(n.addTrace(rE.create_authenticated_session_topic),u?.length>0){t={topic:f,acknowledged:!0,self:{publicKey:c,metadata:this.client.metadata},peer:{publicKey:a,metadata:s.requester.metadata},controller:a,expiry:sT(aW),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:s.pairingTopic,namespaces:aw([...new Set(u)],[...new Set(d)]),transportType:o},n.addTrace(rE.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:o})}catch(e){throw n.setError(r_.subscribe_authenticated_session_topic_failure),e}n.addTrace(rE.subscribe_authenticated_session_topic_success),await this.client.session.set(f,t),n.addTrace(rE.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:s.pairingTopic,metadata:s.requester.metadata})}n.addTrace(rE.publishing_authenticated_session_approve);try{await this.sendResult({topic:l,id:r,result:{cacaos:i,responder:{publicKey:c,metadata:this.client.metadata}},encodeOpts:h,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(s.requester.metadata,o)})}catch(e){throw n.setError(r_.authenticated_session_approve_publish_failure),e}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:s.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:n.eventId}),{session:t}}),a9(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();let{id:t,reason:r}=e,i=this.getPendingAuthRequest(t);if(!i)throw Error(`Could not find pending auth request with id ${t}`);i.transportType===ra.relay&&await this.confirmOnlineStateOrThrow();let n=i.requester.publicKey,s=await this.client.core.crypto.generateKeyPair(),o=ag(n);await this.sendError({id:t,topic:o,error:r,encodeOpts:{type:1,receiverPublicKey:n,senderPublicKey:s},rpcOpts:aV.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(i.requester.metadata,i.transportType)}),await this.client.auth.requests.delete(t,{message:"rejected",code:0}),await this.client.proposal.delete(t,a_("USER_DISCONNECTED"))}),a9(this,"formatAuthMessage",e=>{this.isInitialized();let{request:t,iss:r}=e;return oy(t,r)}),a9(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(0!==this.relayMessageCache.length)for(;this.relayMessageCache.length>0;)try{let e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)}),a9(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{let t=this.client.core.pairing.pairings.get(e.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter(r=>{var i,n;return(null==(i=r.peerMetadata)?void 0:i.url)&&(null==(n=r.peerMetadata)?void 0:n.url)===e.peer.metadata.url&&r.topic&&r.topic!==t.topic});if(0===r.length)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map(e=>this.client.core.pairing.disconnect({topic:e.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(e){this.client.logger.error(e)}}),a9(this,"deleteSession",async e=>{var t;let{topic:r,expirerHasDeleted:i=!1,emitEvent:n=!0,id:s=0}=e,{self:o}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await this.client.session.delete(r,a_("USER_DISCONNECTED")),this.addToRecentlyDeleted(r,"session"),this.client.core.crypto.keychain.has(o.publicKey)&&await this.client.core.crypto.deleteKeyPair(o.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),i||this.client.core.expirer.del(r),this.client.core.storage.removeItem(aH).catch(e=>this.client.logger.warn(e)),this.getPendingSessionRequests().forEach(e=>{e.topic===r&&this.deletePendingSessionRequest(e.id,a_("USER_DISCONNECTED"))}),r===(null==(t=this.sessionRequestQueue.queue[0])?void 0:t.topic)&&(this.sessionRequestQueue.state=aG.idle),n&&this.client.events.emit("session_delete",{id:s,topic:r})}),a9(this,"deleteProposal",async(e,t)=>{if(t)try{let t=this.client.proposal.get(e),r=this.client.core.eventClient.getEvent({topic:t.pairingTopic});r?.setError(rx.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,a_("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),a9(this,"deletePendingSessionRequest",async(e,t,r=!1)=>
21{await Promise.all([this.client.pendingRequest.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(t=>t.id!==e),r&&(this.sessionRequestQueue.state=aG.idle,this.client.events.emit("session_request_expire",{id:e}))}),a9(this,"deletePendingAuthRequest",async(e,t,r=!1)=>{await Promise.all([this.client.auth.requests.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)])}),a9(this,"setExpiry",async(e,t)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,t),await this.client.session.update(e,{expiry:t}))}),a9(this,"setProposal",async(e,t)=>{this.client.core.expirer.set(e,sT(aV.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,t)}),a9(this,"setAuthRequest",async(e,t)=>{let{request:r,pairingTopic:i,transportType:n=ra.relay}=t;this.client.core.expirer.set(e,r.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:r.authPayload,requester:r.requester,expiryTimestamp:r.expiryTimestamp,id:e,pairingTopic:i,verifyContext:r.verifyContext,transportType:n})}),a9(this,"setPendingSessionRequest",async e=>{let{id:t,topic:r,params:i,verifyContext:n}=e,s=i.request.expiryTimestamp||sT(aV.wc_sessionRequest.req.ttl);this.client.core.expirer.set(t,s),await this.client.pendingRequest.set(t,{id:t,topic:r,params:i,verifyContext:n})}),a9(this,"sendRequest",async e=>{let t,i,{topic:n,method:s,params:o,expiry:a,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:h,appLink:u,tvf:d}=e,f=(0,t3.formatJsonRpcRequest)(s,o,l),p=!!u;try{let e=p?ap:af;t=await this.client.core.crypto.encode(n,f,{encoding:e})}catch(e){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),e}if(aJ.includes(s)){let e=am(JSON.stringify(f)),r=am(t);i=await this.client.core.verify.register({id:r,decryptedId:e})}let g=aV[s].req;if(g.attestation=i,a&&(g.ttl=a),c&&(g.id=c),this.client.core.history.set(n,f),p){let e=ay(u,n,t);await r.g.Linking.openURL(e,this.client.name)}else{let e=aV[s].req;a&&(e.ttl=a),c&&(e.id=c),e.tvf=a4(a6({},d),{correlationId:f.id}),h?(e.internal=a4(a6({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,t,e)):this.client.core.relayer.publish(n,t,e).catch(e=>this.client.logger.error(e))}return f.id}),a9(this,"sendResult",async e=>{let t,i,n,{id:s,topic:o,result:a,throwOnFailedPublish:c,encodeOpts:l,appLink:h}=e,u=(0,t3.formatJsonRpcResult)(s,a),d=h&&"u">typeof(null==r.g?void 0:r.g.Linking);try{let e=d?ap:af;t=await this.client.core.crypto.encode(o,u,a4(a6({},l||{}),{encoding:e}))}catch(e){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${o} failed`),e}try{let e=(i=await this.client.core.history.get(o,s)).request;try{this.shouldSetTVF(e.method,e.params)&&(n=this.getTVFParams(s,e.params,a))}catch(e){this.client.logger.warn("sendResult() -> getTVFParams() failed",e)}}catch(e){throw this.client.logger.error(`sendResult() -> history.get(${o}, ${s}) failed`),e}if(d){let e=ay(h,o,t);await r.g.Linking.openURL(e,this.client.name)}else{let e=aV[i.request.method].res;e.tvf=a4(a6({},n),{correlationId:s}),c?(e.internal=a4(a6({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(o,t,e)):this.client.core.relayer.publish(o,t,e).catch(e=>this.client.logger.error(e))}await this.client.core.history.resolve(u)}),a9(this,"sendError",async e=>{let t,i,{id:n,topic:s,error:o,encodeOpts:a,rpcOpts:c,appLink:l}=e,h=(0,t3.formatJsonRpcError)(n,o),u=l&&"u">typeof(null==r.g?void 0:r.g.Linking);try{let e=u?ap:af;t=await this.client.core.crypto.encode(s,h,a4(a6({},a||{}),{encoding:e}))}catch(e){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),e}try{i=await this.client.core.history.get(s,n)}catch(e){throw this.client.logger.error(`sendError() -> history.get(${s}, ${n}) failed`),e}if(u){let e=ay(l,s,t);await r.g.Linking.openURL(e,this.client.name)}else{let e=i.request.method,r=c||aV[e].res;this.client.core.relayer.publish(s,t,r)}await this.client.core.history.resolve(h)}),a9(this,"cleanup",async()=>{let e=[],t=[];
21this.client.session.getAll().forEach(t=>{let r=!1;sM(t.expiry)&&(r=!0),this.client.core.crypto.keychain.has(t.topic)||(r=!0),r&&e.push(t.topic)}),this.client.proposal.getAll().forEach(e=>{sM(e.expiryTimestamp)&&t.push(e.id)}),await Promise.all([...e.map(e=>this.deleteSession({topic:e})),...t.map(e=>this.deleteProposal(e))])}),a9(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),a9(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),a9(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===aG.active)return void this.client.logger.info("Request queue already active, skipping...");for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=aG.active;let e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(e){this.client.logger.warn(e)}}this.requestQueue.state=aG.idle}),a9(this,"processRequest",async e=>{let{topic:t,payload:r,attestation:i,transportType:n,encryptedId:s}=e,o=r.method;if(!this.shouldIgnorePairingRequest({topic:t,requestMethod:o}))switch(o){case"wc_sessionPropose":return await this.onSessionProposeRequest
21({topic:t,payload:r,attestation:i,encryptedId:s});case"wc_sessionSettle":return await this.onSessionSettleRequest(t,r);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(t,r);case"wc_sessionExtend":return await this.onSessionExtendRequest(t,r);case"wc_sessionPing":return await this.onSessionPingRequest(t,r);case"wc_sessionDelete":return await this.onSessionDeleteRequest(t,r);case"wc_sessionRequest":return await this.onSessionRequest({topic:t,payload:r,attestation:i,encryptedId:s,transportType:n});case"wc_sessionEvent":return await this.onSessionEventRequest(t,r);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:t,payload:r,attestation:i,encryptedId:s,transportType:n});default:return this.client.logger.info(`Unsupported request method ${o}`)}}),a9(this,"onRelayEventResponse",async e=>{let{topic:t,payload:r,transportType:i}=e,n=(await this.client.core.history.get(t,r.id)).request.method;switch(n){case"wc_sessionPropose":return this.onSessionProposeResponse(t,r,i);case"wc_sessionSettle":return this.onSessionSettleResponse(t,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,r);case"wc_sessionExtend":return this.onSessionExtendResponse(t,r);case"wc_sessionPing":return this.onSessionPingResponse(t,r);case"wc_sessionRequest":return this.onSessionRequestResponse(t,r);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(t,r);default:return this.client.logger.info(`Unsupported response method ${n}`)}}),a9(this,"onRelayEventUnknownPayload",e=>{let{topic:t}=e,{message:r}=aE("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw Error(r)}),a9(this,"shouldIgnorePairingRequest",e=>{let{topic:t,requestMethod:r}=e,i=this.expectedPairingMethodMap.get(t);return!(!i||i.includes(r))&&!!(i.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),a9(this,"onSessionProposeRequest",async e=>{let{topic:t,payload:r,attestation:i,encryptedId:n}=e,{params:s,id:o}=r;try{let e=this.client.core.eventClient.getEvent({topic:t});0===this.client.events.listenerCount("session_proposal")&&(console.warn("No listener for session_proposal event"),e?.setError(rw.proposal_listener_not_found)),this.isValidConnect(a6({},r.params));let a=s.expiryTimestamp||sT(aV.wc_sessionPropose.req.ttl),c=a6({id:o,pairingTopic:t,expiryTimestamp:a},s);await this.setProposal(o,c);let l=await this.getVerifyContext({attestationId:i,hash:am(JSON.stringify(r)),encryptedId:n,metadata:c.proposer.metadata});e?.addTrace(rb.emit_session_proposal),this.client.events.emit("session_proposal",{id:o,params:c,verifyContext:l})}catch(e){await this.sendError({id:o,topic:t,error:e,rpcOpts:aV.wc_sessionPropose.autoReject}),this.client.logger.error(e)}}),a9(this,"onSessionProposeResponse",async(e,t,r)=>{let{id:i}=t;if((0,t3.isJsonRpcResult)(t)){let{result:n}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:n});let s=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:s});let o=s.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:o});let a=n.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:a});let c=await this.client.core.crypto.generateSharedKey(o,a);this.pendingSessions.set(i,{sessionTopic:c,pairingTopic:e,proposalId:i,publicKey:o});let l=await this.client.core.relayer.subscribe(c,{transportType:r});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:l}),await this.client.core.pairing.activate({topic:e})}else if((0,t3.isJsonRpcError)(t)){await this.client.proposal.delete(i,a_("USER_DISCONNECTED"));let e=sR("session_connect",i);if(0===this.events.listenerCount(e))throw Error(`emitting ${e} without any listeners, 954`);this.events.emit(e,{error:t.error})}}),a9(this,"onSessionSettleRequest",async(e,t)=>{let{id:r,params:i}=t;try{this.isValidSessionSettleRequest(i);let{relay:r,controller:n,expiry:s,namespaces:o,sessionProperties:a,scopedProperties:c,sessionConfig:l}=t.params,h=[...this.pendingSessions.values()].find(t=>t.sessionTopic===e);if(!h)return this.client.logger.error(`Pending session not found for topic ${e}`);let u=this.client.proposal.get(h.proposalId),d=a4(a6(a6(a6({topic:e,relay:r,expiry:s,namespaces:o,acknowledged:!0,pairingTopic:h.pairingTopic,requiredNamespaces:u.requiredNamespaces,optionalNamespaces:u.optionalNamespaces,controller:n.publicKey,self:{publicKey:h.publicKey,metadata:this.client.metadata},peer:{publicKey:n.publicKey,metadata:n.metadata}},a&&{sessionProperties:a}),c&&{scopedProperties:c}),l&&{sessionConfig:l}),{transportType:ra.relay});await this.client.session.set(d.topic,d),await this.setExpiry(d.topic,d.expiry),await this.client.core.pairing.updateMetadata({topic:h.pairingTopic,metadata:d.peer.metadata}),this.client.events.emit("session_connect",{session:d}),this.events.emit(sR("session_connect",h.proposalId),{session:d}),this.pendingSessions.delete(h.proposalId),this.deleteProposal(h.proposalId,!1),this.cleanupDupl
21icatePairings(d),await this.sendResult({id:t.id,topic:e,result:!0,throwOnFailedPublish:!0})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),a9(this,"onSessionSettleResponse",async(e,t)=>{let{id:r}=t;(0,t3.isJsonRpcResult)(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(sR("session_approve",r),{})):(0,t3.isJsonRpcError)(t)&&(await this.client.session.delete(e,a_("USER_DISCONNECTED")),this.events.emit(sR("session_approve",r),{error:t.error}))}),a9(this,"onSessionUpdateRequest",async(e,t)=>{let{params:r,id:i}=t;try{let t=`${e}_session_update`,n=aj.get(t);if(n&&this.isRequestOutOfSync(n,i)){this.client.logger.warn(`Discarding out of sync request - ${i}`),this.sendError({id:i,topic:e,error:a_("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(a6({topic:e},r));try{aj.set(t,i),await this.client.session.update(e,{namespaces:r.namespaces}),await this.sendResult({id:i,topic:e,result:!0,throwOnFailedPublish:!0})}catch(e){throw aj.delete(t),e}this.client.events.emit("session_update",{id:i,topic:e,params:r})}catch(t){await this.sendError({id:i,topic:e,error:t}),this.client.logger.error(t)}}),a9(this,"isRequestOutOfSync",(e,t)=>t.toString().slice(0,-3)<e.toString().slice(0,-3)),a9(this,"onSessionUpdateResponse",(e,t)=>{let{id:r}=t,i=sR("session_update",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);(0,t3.isJsonRpcResult)(t)?this.events.emit(sR("session_update",r),{}):(0,t3.isJsonRpcError)(t)&&this.events.emit(sR("session_update",r),{error:t.error})}),a9(this,"onSessionExtendRequest",async(e,t)=>{let{id:r}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,sT(aW)),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:r,topic:e})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),a9(this,"onSessionExtendResponse",(e,t)=>{let{id:r}=t,i=sR("session_extend",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);(0,t3.isJsonRpcResult)(t)?this.events.emit(sR("session_extend",r),{}):(0,t3.isJsonRpcError)(t)&&this.events.emit(sR("session_extend",r),{error:t.error})}),a9(this,"onSessionPingRequest",async(e,t)=>{let{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:r,topic:e})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),a9(this,"onSessionPingResponse",(e,t)=>{let{id:r}=t,i=sR("session_ping",r);setTimeout(()=>{if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners 2176`);(0,t3.isJsonRpcResult)(t)?this.events.emit(sR("session_ping",r),{}):(0,t3.isJsonRpcError)(t)&&this.events.emit(sR("session_ping",r),{error:t.error})},500)}),a9(this,"onSessionDeleteRequest",async(e,t)=>{let{id:r}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),Promise.all([new Promise(t=>{this.client.core.relayer.once(rn.publish,async()=>{t(await this.deleteSession({topic:e,id:r}))})}),this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:a_("USER_DISCONNECTED")})]).catch(e=>this.client.logger.error(e))}catch(e){this.client.logger.error(e)}}),a9(this,"onSessionRequest",async e=>{var t,r,i;let{topic:n,payload:s,attestation:o,encryptedId:a,transportType:c}=e,{id:l,params:h}=s;try{await this.isValidRequest(a6({topic:n},h));let e=this.client.session.get(n),s=await this.getVerifyContext({attestationId:o,hash:am(JSON.stringify((0,t3.formatJsonRpcRequest)("wc_sessionRequest",h,l))),encryptedId:a,metadata:e.peer.metadata,transportType:c}),u={id:l,topic:n,params:h,verifyContext:s};await this.setPendingSessionRequest(u),c===ra.link_mode&&null!=(t=e.peer.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(null==(r=e.peer.metadata.redirect)?void 0:r.universal),null!=(i=this.client.signConfig)&&i.disableRequestQueue?this.emitSessionRequest(u):(this.addSessionRequestToSessionRequestQueue(u),this.processSessionRequestQueue())}
21catch(e){await this.sendError({id:l,topic:n,error:e}),this.client.logger.error(e)}}),a9(this,"onSessionRequestResponse",(e,t)=>{let{id:r}=t,i=sR("session_request",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);(0,t3.isJsonRpcResult)(t)?this.events.emit(sR("session_request",r),{result:t.result}):(0,t3.isJsonRpcError)(t)&&this.events.emit(sR("session_request",r),{error:t.error})}),a9(this,"onSessionEventRequest",async(e,t)=>{let{id:r,params:i}=t;try{let t=`${e}_session_event_${i.event.name}`,n=aj.get(t);if(n&&this.isRequestOutOfSync(n,r))return void this.client.logger.info(`Discarding out of sync request - ${r}`);this.isValidEmit(a6({topic:e},i)),this.client.events.emit("session_event",{id:r,topic:e,params:i}),aj.set(t,r)}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),a9(this,"onSessionAuthenticateResponse",(e,t)=>{let{id:r}=t;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:t}),(0,t3.isJsonRpcResult)(t)?this.events.emit(sR("session_request",r),{result:t.result}):(0,t3.isJsonRpcError)(t)&&this.events.emit(sR("session_request",r),{error:t.error})}),a9(this,"onSessionAuthenticateRequest",async e=>{var t;let{topic:r,payload:i,attestation:n,encryptedId:s,transportType:o}=e;try{let{requester:e,authPayload:a,expiryTimestamp:c}=i.params,l=await this.getVerifyContext({attestationId:n,hash:am(JSON.stringify(i)),encryptedId:s,metadata:e.metadata,transportType:o}),h={requester:e,pairingTopic:r,id:i.id,authPayload:a,verifyContext:l,expiryTimestamp:c};await this.setAuthRequest(i.id,{request:h,pairingTopic:r,transportType:o}),o===ra.link_mode&&null!=(t=e.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(e.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:r,params:i.params,id:i.id,verifyContext:l})}catch(s){this.client.logger.error(s);let e=i.params.requester.publicKey,t=await this.client.core.crypto.generateKeyPair(),n=this.getAppLinkIfEnabled(i.params.requester.metadata,o);await this.sendError({id:i.id,topic:r,error:s,encodeOpts:{type:1,receiverPublicKey:e,senderPublicKey:t},rpcOpts:aV.wc_sessionAuthenticate.autoReject,appLink:n})}}),a9(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),a9(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=aG.idle,this.processSessionRequestQueue()},(0,C.toMiliseconds)(this.requestQueueDelay))}),a9(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:t})=>{let r=this.client.core.history.pending;r.length>0&&r.filter(t=>t.topic===e&&"wc_sessionRequest"===t.request.method).forEach(e=>{let r=sR("session_request",e.request.id);if(0===this.events.listenerCount(r))throw Error(`emitting ${r} without any listeners`);this.events.emit(sR("session_request",e.request.id),{error:t})})}),a9(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===aG.active)return void this.client.logger.info("session request queue is already active.");let e=this.sessionRequestQueue.queue[0];if(!e)return void this.client.logger.info("session request queue is empty.");try{this.sessionRequestQueue.state=aG.active,this.emitSessionRequest(e)}catch(e){this.client.logger.error(e)}}),a9(this,"emitSessionRequest",e=>{this.client.events.emit("session_request",e)}),a9(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;let t=this.client.proposal.getAll().find(t=>t.pairingTopic===e.topic);
21t&&this.onSessionProposeRequest({topic:e.topic,payload:(0,t3.formatJsonRpcRequest)("wc_sessionPropose",a4(a6({},t),{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties,scopedProperties:t.scopedProperties}),t.id)})}),a9(this,"isValidConnect",async e=>{if(!ak(e)){let{message:t}=aE("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw Error(t)}let{pairingTopic:t,requiredNamespaces:r,optionalNamespaces:i,sessionProperties:n,scopedProperties:s,relays:o}=e;if(aS(t)||await this.isValidPairingTopic(t),!function(e,t){let r=!1;return t&&!e?r=!0:e&&aI(e)&&e.length&&e.forEach(e=>{r=aR(e)}),r}(o,!0)){let{message:e}=aE("MISSING_OR_INVALID",`connect() relays: ${o}`);throw Error(e)}if(aS(r)||0===aA(r)||this.validateNamespaces(r,"requiredNamespaces"),aS(i)||0===aA(i)||this.validateNamespaces(i,"optionalNamespaces"),aS(n)||this.validateSessionProps(n,"sessionProperties"),!aS(s)){this.validateSessionProps(s,"scopedProperties");let e=Object.keys(r||{}).concat(Object.keys(i||{}));if(!Object.keys(s).every(t=>e.includes(t)))throw Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(s)}, required/optional namespaces: ${JSON.stringify(e)}`)}}),a9(this,"validateNamespaces",(e,t)=>{let r=function(e,t,r){let i=null;if(e&&aA(e)){let n,s=aT(e,t);s&&(i=s);let o=(n=null,Object.entries(e).forEach(([e,i])=>{var s,o;let a;if(n)return;let c=(s=sI(e,i),o=`${t} ${r}`,a=null,aI(s)&&s.length?s.forEach(e=>{a||aO(e)||(a=a_("UNSUPPORTED_CHAINS",`${o}, chain ${e} should be a string and conform to "namespace:chainId" format`))}):aO(e)||(a=a_("UNSUPPORTED_CHAINS",`${o}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),a);c&&(n=c)}),n);o&&(i=o)}else i=aE("MISSING_OR_INVALID",`${t}, ${r} should be an object with data`);return i}(e,"connect()",t);if(r)throw Error(r.message)}),a9(this,"isValidApprove",async e=>{if(!ak(e))throw Error(aE("MISSING_OR_INVALID",`approve() params: ${e}`).message);let{id:t,namespaces:r,relayProtocol:i,sessionProperties:n,scopedProperties:s}=e;this.checkRecentlyDeleted(t),await this.isValidProposalId(t);let o=this.client.proposal.get(t),a=aM(r,"approve()");if(a)throw Error(a.message);let c=aL(o.requiredNamespaces,r,"approve()");if(c)throw Error(c.message);if(!aC(i,!0)){let{message:e}=aE("MISSING_OR_INVALID",`approve() relayProtocol: ${i}`);throw Error(e)}if(aS(n)||this.validateSessionProps(n,"sessionProperties"),!aS(s)){this.validateSessionProps(s,"scopedProperties");let e=new Set(Object.keys(r));if(!Object.keys(s).every(t=>e.has(t)))throw Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(s)}, approved namespaces: ${Array.from(e).join(", ")}`)}}),a9(this,"isValidReject",async e=>{if(!ak(e)){let{message:t}=aE("MISSING_OR_INVALID",`reject() params: ${e}`);throw Error(t)}let{id:t,reason:r}=e;if(this.checkRecentlyDeleted(t),await this.isValidProposalId(t),!function(e){return!(!e||"object"!=typeof e||!e.code||!aN(e.code,!1)||!e.message||!aC(e.message,!1))}(r)){let{message:e}=aE("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw Error(e)}}),a9(this,"isValidSessionSettleRequest",e=>{if(!ak(e)){let{message:t}=aE("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw Error(t)}
21let{relay:t,controller:r,namespaces:i,expiry:n}=e;if(!aR(t)){let{message:e}=aE("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw Error(e)}let s=function(e,t){let r=null;return aC(e?.publicKey,!1)||(r=aE("MISSING_OR_INVALID",`${t} controller public key should be a string`)),r}(r,"onSessionSettleRequest()");if(s)throw Error(s.message);let o=aM(i,"onSessionSettleRequest()");if(o)throw Error(o.message);if(sM(n)){let{message:e}=aE("EXPIRED","onSessionSettleRequest()");throw Error(e)}}),a9(this,"isValidUpdate",async e=>{if(!ak(e)){let{message:t}=aE("MISSING_OR_INVALID",`update() params: ${e}`);throw Error(t)}let{topic:t,namespaces:r}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);let i=this.client.session.get(t),n=aM(r,"update()");if(n)throw Error(n.message);let s=aL(i.requiredNamespaces,r,"update()");if(s)throw Error(s.message)}),a9(this,"isValidExtend",async e=>{if(!ak(e)){let{message:t}=aE("MISSING_OR_INVALID",`extend() params: ${e}`);throw Error(t)}let{topic:t}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t)}),a9(this,"isValidRequest",async e=>{if(!ak(e)){let{message:t}=aE("MISSING_OR_INVALID",`request() params: ${e}`);throw Error(t)}let{topic:t,request:r,chainId:i,expiry:n}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);let{namespaces:s}=this.client.session.get(t);if(!aD(s,i)){let{message:e}=aE("MISSING_OR_INVALID",`request() chainId: ${i}`);throw Error(e)}if(!function(e){return!(aS(e)||!aC(e.method,!1))}(r)){let{message:e}=aE("MISSING_OR_INVALID",`request() ${JSON.stringify(r)}`);throw Error(e)}if(!function(e,t,r){return!!aC(r,!1)&&(function(e,t){let r=[];return Object.values(e).forEach(e=>{ab(e.accounts).includes(t)&&r.push(...e.methods)}),r})(e,t).includes(r)}(s,i,r.method)){let{message:e}=aE("MISSING_OR_INVALID",`request() method: ${r.method}`);throw Error(e)}if(n&&!function(e,t){return aN(e,!1)&&e<=t.max&&e>=t.min}(n,aK)){let{message:e}=aE("MISSING_OR_INVALID",`request() expiry: ${n}. Expiry must be a number (in seconds) between ${aK.min} and ${aK.max}`);throw Error(e)}}),a9(this,"isValidRespond",async e=>{var t;if(!ak(e)){let{message:t}=aE("MISSING_OR_INVALID",`respond() params: ${e}`);throw Error(t)}let{topic:r,response:i}=e;try{await this.isValidSessionTopic(r)}catch(r){throw null!=(t=e?.response)&&t.id&&this.cleanupAfterResponse(e),r}if(!function(e){return!(aS(e)||aS(e.result)&&aS(e.error)||!aN(e.id,!1)||!aC(e.jsonrpc,!1))}(i)){let{message:e}=aE("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw Error(e)}}),a9(this,"isValidPing",async e=>{if(!ak(e)){let{message:t}=aE("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)}),a9(this,"isValidEmit",async e=>{if(!ak(e)){let{message:t}=aE("MISSING_OR_INVALID",`emit() params: ${e}`);throw Error(t)}let{topic:t,event:r,chainId:i}=e;await this.isValidSessionTopic(t);let{namespaces:n}=this.client.session.get(t);if(!aD(n,i)){let{message:e}=aE("MISSING_OR_INVALID",`emit() chainId: ${i}`);throw Error(e)}if(!function(e){return!(aS(e)||!aC(e.name,!1))}(r)||!function(e,t,r){return!!aC(r,!1)&&(function(e,t){let r=[];return Object.values(e).forEach(e=>{ab(e.accounts).includes(t)&&r.push(...e.events)}),r})(e,t).includes(r)}(n,i,r.name)){let{message:e}=aE("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw Error(e)}}),a9(this,"isValidDisconnect",async e=>{if(!ak(e)){let{message:t}=aE("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)}),a9(this,"isValidAuthenticate",e=>{let{chains:t,uri:r,domain:i,nonce:n}=e;if(!Array.isArray(t)||0===t.length)throw Error("chains is required and must be a non-empty array");if(!aC(r,!1))throw Error("uri is required parameter");if(!aC(i,!1))throw Error("domain is required parameter");if(!aC(n,!1))throw Error("nonce is required parameter");if([...new Set(t.map(e=>s_(e).namespace))].length>1)throw Error("Multi-namespace requests are not supported. Please request single namespace only.");let{namespace:s}=s_(t[0]);if("eip155"!==s)throw Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),a9(this,"getVerifyContext",async e=>{let{attestationId:t,hash:r,encryptedId:i,metadata:n,transportType:s}=e,o={verified:{verifyUrl:n.verifyUrl||rg,validation:"UNKNOWN",origin:n.url||""}};try{if(s===ra.link_mode){let e=this.getAppLinkIfEnabled(n,s);return o.verified.validation=e&&new URL(e).origin===new URL(n.url).origin?"VALID":"INVALID",o}let e=await this.client.core.verify.resolve({attestationId:t,hash:r,encryptedId:i,verifyUrl:n.verifyUrl});e&&(o.verified.origin=e.origin,o.verified.isScam=e.isScam,o.verified.validation=e.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(e){this.client.logger.warn(e)}return this.client.logger.debug(`Verify context: ${JSON.stringify(o)}`),o}),a9(this,"validateSessionProps",(e,t)=>{Object.values(e).forEach((r,i)=>{if(null==r){let{message:n}=aE("MISSING_OR_INVALID",`${t} must contain an existing value for each key. Received: ${r} for key ${Object.keys(e)[i]}`);throw Error(n)}})}),a9(this,"getPendingAuthRequest",e=>{let t=this.client.auth.requests.get(e);return"object"==typeof t?t:void 0}),a9(this,"addToRecentlyDeleted",(e,t)=>{if(this.recentlyDeletedMap.set(e,t),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let e=0,t=this.recentlyDeletedLimit/2;
21for(let r of this.recentlyDeletedMap.keys()){if(e++>=t)break;this.recentlyDeletedMap.delete(r)}}}),a9(this,"checkRecentlyDeleted",e=>{let t=this.recentlyDeletedMap.get(e);if(t){let{message:r}=aE("MISSING_OR_INVALID",`Record was recently deleted - ${t}: ${e}`);throw Error(r)}}),a9(this,"isLinkModeEnabled",(e,t)=>{var i,n,s,o,a,c,l,h,u;return!!e&&t===ra.link_mode&&(null==(n=null==(i=this.client.metadata)?void 0:i.redirect)?void 0:n.linkMode)===!0&&(null==(o=null==(s=this.client.metadata)?void 0:s.redirect)?void 0:o.universal)!==void 0&&(null==(c=null==(a=this.client.metadata)?void 0:a.redirect)?void 0:c.universal)!==""&&(null==(l=e?.redirect)?void 0:l.universal)!==void 0&&(null==(h=e?.redirect)?void 0:h.universal)!==""&&(null==(u=e?.redirect)?void 0:u.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&"u">typeof(null==r.g?void 0:r.g.Linking)}),a9(this,"getAppLinkIfEnabled",(e,t)=>{var r;return this.isLinkModeEnabled(e,t)?null==(r=e?.redirect)?void 0:r.universal:void 0}),a9(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;
21let t=sL(e,"topic")||"",r=decodeURIComponent(sL(e,"wc_ev")||""),i=this.client.session.keys.includes(t);i&&this.client.session.update(t,{transportType:ra.link_mode}),this.client.core.dispatchEnvelope({topic:t,message:r,sessionExists:i})}),a9(this,"registerLinkModeListeners",async()=>{var e;if("u">typeof sx&&"true"===sx.env.IS_VITEST||sC()&&null!=(e=this.client.metadata.redirect)&&e.linkMode){let e=null==r.g?void 0:r.g.Linking;if("u">typeof e){e.addEventListener("url",this.handleLinkModeMessage,this.client.name);let t=await e.getInitialURL();t&&setTimeout(()=>{this.handleLinkModeMessage({url:t})},50)}}}),a9(this,"shouldSetTVF",(e,t)=>{if(!t||"wc_sessionRequest"!==e)return!1;let{request:r}=t;return Object.keys(aY).includes(r.method)}),a9(this,"getTVFParams",(e,t,r)=>{var i,n;try{let s=t.request.method,o=this.extractTxHashesFromResult(s,r);return a4(a6({correlationId:e,rpcMethods:[s],chainId:t.chainId},this.isValidContractData(t.request.params)&&{contractAddresses:[null==(n=null==(i=t.request.params)?void 0:i[0])?void 0:n.to]}),{txHashes:o})}catch(e){this.client.logger.warn("Error getting TVF params",e)}return{}}),a9(this,"isValidContractData",e=>{var t;if(!e)return!1;try{let r=e?.data||(null==(t=e?.[0])?void 0:t.data);if(!r.startsWith("0x"))return!1;let i=r.slice(2);return!!/^[0-9a-fA-F]*$/.test(i)&&i.length%2==0}catch{}return!1}),a9(this,"extractTxHashesFromResult",(e,t)=>{try{let r=aY[e];if("string"==typeof t)return[t];let i=t[r.key];if(aI(i))return"solana_signAllTransactions"===e?i.map(e=>(function(e){let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);let i=r[0];if(0===i)throw Error("No signatures found");if(r.length<1+64*i)throw Error("Transaction data too short for claimed signature count");if(r.length<100)throw Error("Transaction too short");let n=sE.from(e,"base64").slice(1,65);return R.A.encode(n)})(e)):i;if("string"==typeof i)return[i]}catch(e){this.client.logger.warn("Error extracting tx hashes from result",e)}return[]})}async processPendingMessageEvents(){try{let e=this.client.session.keys,t=this.client.core.relayer.messages.getWithoutAck(e);for(let[e,r]of Object.entries(t))for(let t of r)try{await this.onProviderMessageEvent({topic:e,message:t,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${e}, message: ${t}`)}}catch(e){this.client.logger.warn("processPendingMessageEvents failed",e)}}isInitialized(){if(!this.initialized){let{message:e}=aE("NOT_INITIALIZED",this.name);throw Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(rn.message,e=>{this.onProviderMessageEvent(e)})}async onRelayMessage(e){let{topic:t,message:r,attestation:i,transportType:n}=e,{publicKey:s}=this.client.auth.authKeys.keys.includes(aQ)?this.client.auth.authKeys.get(aQ):{responseTopic:void 0,publicKey:void 0};try{let e=await this.client.core.crypto.decode(t,r,{receiverPublicKey:s,encoding:n===ra.link_mode?ap:af});(0,t3.isJsonRpcRequest)(e)?(this.client.core.history.set(t,e),await this.onRelayEventRequest({topic:t,payload:e,attestation:i,transportType:n,encryptedId:am(r)})):(0,t3.isJsonRpcResponse)(e)?(await this.client.core.history.resolve(e),await this.onRelayEventResponse({topic:t,payload:e,transportType:n}),this.client.core.history.delete(t,e.id)):await this.onRelayEventUnknownPayload({topic:t,payload:e,transportType:n}),await this.client.core.relayer.messages.ack(t,r)}catch(e){this.client.logger.error(e)}}registerExpirerEvents(){this.client.core.expirer.on(rp.expired,async e=>{let{topic:t,id:r}=function(e){let[t,r]=e.split(":"),i={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof r)i.topic=r;else if("id"===t&&Number.isInteger(Number(r)))i.id=Number(r);else throw Error(`Invalid target, expected id:number or topic:string, got ${t}:${r}`);return i}(e.target);return r&&this.client.pendingRequest.keys.includes(r)?await this.deletePendingSessionRequest(r,aE("EXPIRED"),!0):r&&this.client.auth.requests.keys.includes(r)?await this.deletePendingAuthRequest(r,aE("EXPIRED"),!0):void(t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}
21),this.client.events.emit("session_expire",{topic:t})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r})))})}registerPairingEvents(){this.client.core.pairing.events.on(rd.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(rd.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!aC(e,!1)){let{message:t}=aE("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:t}=aE("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if(sM(this.client.core.pairing.pairings.get(e).expiry)){let{message:t}=aE("EXPIRED",`pairing topic: ${e}`);throw Error(t)}}async isValidSessionTopic(e){if(!aC(e,!1)){let{message:t}=aE("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){let{message:t}=aE("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw Error(t)}if(sM(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});let{message:t}=aE("EXPIRED",`session topic: ${e}`);throw Error(t)}if(!this.client.core.crypto.keychain.has(e)){let{message:t}=aE("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(aC(e,!1)){let{message:t}=aE("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw Error(t)}else{let{message:t}=aE("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw Error(t)}}async isValidProposalId(e){if("number"!=typeof e){let{message:t}=aE("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw Error(t)}if(!this.client.proposal.keys.includes(e)){let{message:t}=aE("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw Error(t)}if(sM(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);let{message:t}=aE("EXPIRED",`proposal id: ${e}`);throw Error(t)}}}class ce extends na{constructor(e,t){super(e,t,"proposal",az),this.core=e,this.logger=t}}class ct extends na{constructor(e,t){super(e,t,"session",az),this.core=e,this.logger=t}}class cr extends na{constructor(e,t){super(e,t,"request",az,e=>e.id),this.core=e,this.logger=t}}class ci extends na{constructor(e,t){super(e,t,"authKeys",aX,()=>aQ),this.core=e,this.logger=t}}class cn extends na{constructor(e,t){super(e,t,"pairingTopics",aX),this.core=e,this.logger=t}}class cs extends na{constructor(e,t){super(e,t,"requests",aX,e=>e.id),this.core=e,this.logger=t}}var co=Object.defineProperty,ca=(e,t,r)=>((e,t,r)=>t in e?co(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class cc{constructor(e,t){this.core=e,this.logger=t,ca(this,"authKeys"),ca(this,"pairingTopics"),ca(this,"requests"),this.authKeys=new ci(this.core,this.logger),this.pairingTopics=new cn(this.core,this.logger),this.requests=new cs(this.core,this.logger)}
21async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var cl=Object.defineProperty,ch=(e,t,r)=>((e,t,r)=>t in e?cl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class cu extends A{constructor(e){super(e),ch(this,"protocol","wc"),ch(this,"version",2),ch(this,"name",aq.name),ch(this,"metadata"),ch(this,"core"),ch(this,"logger"),ch(this,"events",new i.EventEmitter),ch(this,"engine"),ch(this,"session"),ch(this,"proposal"),ch(this,"pendingRequest"),ch(this,"auth"),ch(this,"signConfig"),ch(this,"on",(e,t)=>this.events.on(e,t)),ch(this,"once",(e,t)=>this.events.once(e,t)),ch(this,"off",(e,t)=>this.events.off(e,t)),ch(this,"removeListener",(e,t)=>this.events.removeListener(e,t)),ch(this,"removeAllListeners",e=>this.events.removeAllListeners(e)),ch(this,"connect",async e=>{try{return await this.engine.connect(e)}catch(e){throw this.logger.error(e.message),e}}),ch(this,"pair",async e=>{try{return await this.engine.pair(e)}catch(e){throw this.logger.error(e.message),e}}),ch(this,"approve",async e=>{try{return await this.engine.approve(e)}catch(e){throw this.logger.error(e.message),e}}),ch(this,"reject",async e=>{try{return await this.engine.reject(e)}catch(e){throw this.logger.error(e.message),e}}),ch(this,"update",async e=>{try{return await this.engine.update(e)}catch(e){throw this.logger.error(e.message),e}}),ch(this,"extend",async e=>{try{return await this.engine.extend(e)}catch(e){throw this.logger.error(e.message),e}}),ch(this,"request",async e=>{try{return await this.engine.request(e)}catch(e){throw this.logger.error(e.message),e}}),ch(this,"respond",async e=>{try{return await this.engine.respond(e)}catch(e){throw this.logger.error(e.message),e}}),ch(this,"ping",async e=>{try{return await this.engine.ping(e)}catch(e){throw this.logger.error(e.message),e}}),ch(this,"emit",async e=>{try{return await this.engine.emit(e)}catch(e){throw this.logger.error(e.message),e}}),ch(this,"disconnect",async e=>{try{return await this.engine.disconnect(e)}catch(e){throw this.logger.error(e.message),e}}),ch(this,"find",e=>{try{return this.engine.find(e)}catch(e){throw this.logger.error(e.message),e}}),ch(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}}),ch(this,"authenticate",async(e,t)=>{try{return await this.engine.authenticate(e,t)}catch(e){throw this.logger.error(e.message),e}}),ch(this,"formatAuthMessage",e=>{try{return this.engine.formatAuthMessage(e)}catch(e){throw this.logger.error(e.message),e}}),ch(this,"approveSessionAuthenticate",async e=>{try{return await this.engine.approveSessionAuthenticate(e)}catch(e){throw this.logger.error(e.message),e}}),ch(this,"rejectSessionAuthenticate",async e=>{try{return await this.engine.rejectSessionAuthenticate(e)}catch(e){throw this.logger.error(e.message),e}}),this.name=e?.name||aq.name,this.metadata=e?.metadata||(0,M.g)()||{name:"",description:"",url:"",icons:[""]},this.signConfig=e?.signConfig;let t="u">typeof e?.logger&&"string"!=typeof e?.logger?e.logger:(0,a.h6)((0,a.iP)({level:e?.logger||aq.logger}));this.core=e?.core||new nB(e),this.logger=(0,a.U5)(t,this.name),this.session=new ct(this.core,this.logger),this.proposal=new ce(this.core,this.logger),this.pendingRequest=new cr(this.core,this.logger),this.engine=new a7(this),this.auth=new cc(this.core,this.logger)}static async init(e){let t=new cu(e);return await t.initialize(),t}get context(){return(0,a.oI)(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),setTimeout(()=>{this.engine.processRelayMessageCache()},(0,C.toMiliseconds)(C.ONE_SECOND))}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}function cd(e){let[t,r]=e.split(":");return{namespace:t,reference:r}}function cf(e=[],t=[]){return[...new Set([...e,...t])]}function cp(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function cg(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function cm(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function cy(e,t){cg(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}r(87358),r(81029).Buffer;let cb=BigInt(0x100000000-1),cw=BigInt(32),cv="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function cx(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function cE(e,t){return e<<32-t|e>>>t}let c_=68===new Uint8Array(new Uint32Array([0x11223344]).buffer)[0];function cI(e){for(let r=0;r<e.length;r++){var t;e[r]=(t=e[r])<<24&0xff000000|t<<8&0xff0000|t>>>8&65280|t>>>24&255}}function cA(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(e)),cg(e),e}class cS{clone(){return this._cloneInto()}}function cC(e){let t=t=>e().update(cA(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}let cN=[],cO=[],cP=[],cT=BigInt(0),cM=BigInt(1),cR=BigInt(2),ck=BigInt(7),cD=BigInt(256),cL=BigInt(113);for(let e=0,t=cM,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],cN.push(2*(5*i+r)),cO.push((e+1)*(e+2)/2%64);let n=cT;for(let e=0;e<7;e++)(t=(t<<cM^(t>>ck)*cL)%cD)&cR&&(n^=cM<<(cM<<BigInt(e))-cM);cP.push(n)}let[cU,cB]=function(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let n=0;n<e.length;n++){let{h:s,l:o}=function(e,t=!1){return t?{h:Number(e&cb),l:Number(e>>cw&cb)}:{h:0|Number(e>>cw&cb),l:0|Number(e&cb)}}(e[n],t);[r[n],i[n]]=[s,o]}return[r,i]}(cP,!0),cj=(e,t,r)=>r>32?((e,t,r)=>t<<r-32|e>>>64-r)(e,t,r):((e,t,r)=>e<<r|t>>>32-r)(e,t,r),c$=(e,t,r)=>r>32?((e,t,r)=>e<<r-32|t>>>64-r)(e,t,r):((e,t,r)=>t<<r|e>>>32-r)(e,t,r);class cz extends cS{constructor(e,t,r,i=!1,n=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,cp(r),
210>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}(this.state)}keccak(){c_||cI(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let i=(t+8)%10,n=(t+2)%10,s=r[n],o=r[n+1],a=cj(s,o,1)^r[i],c=c$(s,o,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],n=e[3];for(let r=0;r<24;r++){let i=cO[r],s=cj(t,n,i),o=c$(t,n,i),a=cN[r];t=e[a],n=e[a+1],e[a]=s,e[a+1]=o}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=cU[i],e[1]^=cB[i]}r.fill(0)}(this.state32,this.rounds),c_||cI(this.state32),this.posOut=0,this.pos=0}update(e){cm(this);let{blockLen:t,state:r}=this,i=(e=cA(e)).length;for(let n=0;n<i;){let s=Math.min(t-this.pos,i-n);for(let t=0;t<s;t++)r[this.pos++]^=e[n++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:i}=this;e[r]^=t,(128&t)!=0&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){cm(this,!1),cg(e),this.finish();let t=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return cp(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(cy(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new cz(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}function cq(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function cH(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function cF(e,...t){if(!cH(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function cW(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function cV(e){if("boolean"!=typeof e)throw Error(`boolean expected, not ${e}`)}cC(()=>new cz(136,1,32)),Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;let cK=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));if(68!==new Uint8Array(new Uint32Array([0x11223344]).buffer)[0])throw Error("Non little-endian hardware is not supported");function cG(e){if("string"==typeof e)e=function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}(e);else if(cH(e))e=cX(e);else throw Error("Uint8Array expected, got "+typeof e);return e}function cY(e,t,r=!0){if(void 0===t)return new Uint8Array(e);if(t.length!==e)throw Error("invalid output length, expected "+e+", got: "+t.length);if(r&&t.byteOffset%4!=0)throw Error("invalid output, must be aligned");return t}function cJ(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(0xffffffff),o=Number(r>>n&s),a=Number(r&s),c=4*!!i,l=4*!i;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)}function cX(e){return Uint8Array.from(e)}function cQ(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}let cZ=e=>Uint8Array.from(e.split("").map(e=>e.charCodeAt(0))),c0=cZ("expand 16-byte k"),c1=cZ("expand 32-byte k"),c2=cK(c0),c3=cK(c1);function c8(e,t){return e<<t|e>>>32-t}function c5(e){return e.byteOffset%4==0}let c6=0x100000000-1,c4=new Uint32Array,c9=(e,t)=>255&e[t++]|(255&e[t++])<<8;class c7{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,cF(e=cG(e),32);let t=c9(e,0),r=c9(e,2),i=c9(e,4),n=c9(e,6),s=c9(e,8),o=c9(e,10),a=c9(e,12),c=c9(e,14);this.r[0]=8191&t,this.r[1]=(t>>>13|r<<3)&8191,this.r[2]=(r>>>10|i<<6)&7939,this.r[3]=(i>>>7|n<<9)&8191,this.r[4]=(n>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|o<<2)&8191,this.r[7]=(o>>>11|a<<5)&8065,this.r[8]=(a>>>8|c<<8)&8191,this.r[9]=c>>>5&127;for(let t=0;t<8;t++)this.pad[t]=c9(e,16+2*t)}process(e,t,r=!1){let{h:i,r:n}
21=this,s=n[0],o=n[1],a=n[2],c=n[3],l=n[4],h=n[5],u=n[6],d=n[7],f=n[8],p=n[9],g=c9(e,t+0),m=c9(e,t+2),y=c9(e,t+4),b=c9(e,t+6),w=c9(e,t+8),v=c9(e,t+10),x=c9(e,t+12),E=c9(e,t+14),_=i[0]+(8191&g),I=i[1]+((g>>>13|m<<3)&8191),A=i[2]+((m>>>10|y<<6)&8191),S=i[3]+((y>>>7|b<<9)&8191),C=i[4]+((b>>>4|w<<12)&8191),N=i[5]+(w>>>1&8191),O=i[6]+((w>>>14|v<<2)&8191),P=i[7]+((v>>>11|x<<5)&8191),T=i[8]+((x>>>8|E<<8)&8191),M=i[9]+(E>>>5|2048*!r),R=0,k=0+_*s+5*p*I+5*f*A+5*d*S+5*u*C;R=k>>>13,k&=8191,k+=5*h*N+5*l*O+5*c*P+5*a*T+5*o*M,R+=k>>>13,k&=8191;let D=R+_*o+I*s+5*p*A+5*f*S+5*d*C;R=D>>>13,D&=8191,D+=5*u*N+5*h*O+5*l*P+5*c*T+5*a*M,R+=D>>>13,D&=8191;let L=R+_*a+I*o+A*s+5*p*S+5*f*C;R=L>>>13,L&=8191,L+=5*d*N+5*u*O+5*h*P+5*l*T+5*c*M,R+=L>>>13,L&=8191;let U=R+_*c+I*a+A*o+S*s+5*p*C;R=U>>>13,U&=8191,U+=5*f*N+5*d*O+5*u*P+5*h*T+5*l*M,R+=U>>>13,U&=8191;let B=R+_*l+I*c+A*a+S*o+C*s;R=B>>>13,B&=8191,B+=5*p*N+5*f*O+5*d*P+5*u*T+5*h*M,R+=B>>>13,B&=8191;let j=R+_*h+I*l+A*c+S*a+C*o;R=j>>>13,j&=8191,j+=N*s+5*p*O+5*f*P+5*d*T+5*u*M,R+=j>>>13,j&=8191;let $=R+_*u+I*h+A*l+S*c+C*a;R=$>>>13,$&=8191,$+=N*o+O*s+5*p*P+5*f*T+5*d*M,R+=$>>>13,$&=8191;let z=R+_*d+I*u+A*h+S*l+C*c;R=z>>>13,z&=8191,z+=N*a+O*o+P*s+5*p*T+5*f*M,R+=z>>>13,z&=8191;let q=R+_*f+I*d+A*u+S*h+C*l;R=q>>>13,q&=8191,q+=N*c+O*a+P*o+T*s+5*p*M,R+=q>>>13,q&=8191;let H=R+_*p+I*f+A*d+S*u+C*h;R=H>>>13,H&=8191,H+=N*l+O*c+P*a+T*o+M*s,R+=H>>>13,H&=8191,k=8191&(R=(R=(R<<2)+R|0)+k|0),R>>>=13,D+=R,i[0]=k,i[1]=D,i[2]=L,i[3]=U,i[4]=B,i[5]=j,i[6]=$,i[7]=z,i[8]=q,i[9]=H}finalize(){let{h:e,pad:t}=this,r=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let t=2;t<10;t++)e[t]+=i,i=e[t]>>>13,e[t]&=8191;e[0]+=5*i,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,r[0]=e[0]+5,i=r[0]>>>13,r[0]&=8191;for(let t=1;t<10;t++)r[t]=e[t]+i,i=r[t]>>>13,r[t]&=8191;r[9]-=8192;let n=(1^i)-1;for(let e=0;e<10;e++)r[e]&=n;n=~n;for(let t=0;t<10;t++)e[t]=e[t]&n|r[t];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let s=e[0]+t[0];e[0]=65535&s;for(let r=1;r<8;r++)s=(e[r]+t[r]|0)+(s>>>16)|0,e[r]=65535&s;cQ(r)}update(e){cW(this);let{buffer:t,blockLen:r}=this,i=(e=cG(e)).length;for(let n=0;n<i;){let s=Math.min(r-this.pos,i-n);if(s===r){for(;r<=i-n;n+=r)this.process(e,n);continue}t.set(e.subarray(n,n+s),this.pos),this.pos+=s,n+=s,this.pos===r&&(this.process(t,0,!1),this.pos=0)}return this}destroy(){cQ(this.h,this.r,this.buffer,this.pad)}digestInto(e){cW(this),function(e,t){cF(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished=!0;let{buffer:t,h:r}=this,{pos:i}=this;if(i){for(t[i++]=1;i<16;i++)t[i]=0;this.process(t,0,!0)}this.finalize();let n=0;for(let t=0;t<8;t++)e[n++]=r[t]>>>0,e[n++]=r[t]>>>8;return e}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}}let le=function(e){let t=(t,r)=>e(r).update(cG(t)).digest(),r=e(new Uint8Array(32));return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}(e=>new c7(e)),lt=function(e,t){let{allowShortKeys:r,extendNonceFn:i,counterLength:n,counterRight:s,rounds:o}=function(e,t){if(null==t||"object"!=typeof t)throw Error("options must be defined");return Object.assign(e,t)}({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if("function"!=typeof e)throw Error("core must be a function");return cq(n),cq(o),cV(s),cV(r),(t,a,c,l,h=0)=>{cF(t),cF(a),cF(c);let u=c.length;if(void 0===l&&(l=new Uint8Array(u)),cF(l),cq(h),h<0||h>=c6)throw Error("arx: counter overflow");if(l.length<u)throw Error(`arx: output (${l.length}) is shorter than data (${u})`);let d=[],f=t.length,p,g;if(32===f)d.push(p=cX(t)),g=c3;else if(16===f&&r)(p=new Uint8Array(32)).set(t),p.set(t,16),g=c2,d.push(p);else throw Error(`arx: invalid 32-byte key, got length=${f}`);c5(a)||d.push(a=cX(a));let m=cK(p);if(i){if(24!==a.length)throw Error("arx: extended nonce must be 24 bytes");i(g,m,cK(a.subarray(0,16)),m),a=a.subarray(16)}let y=16-n;if(y!==a.length)throw Error(`arx: nonce must be ${y} or 16 bytes`);if(12!==y){let e=new Uint8Array(12);e.set(a,s?0:12-a.length),a=e,d.push(a)}return function(e,t,r,i,n,s,o,a){let c=n.length,l=new Uint8Array(64),h=cK(l),u=c5(n)&&c5(s),d=u?cK(n):c4,f=u?cK(s):c4;for(let p=0;p<c;o++){if(e(t,r,i,h,o,a),o>=c6)throw Error("arx: counter overflow");let g=Math.min(64,c-p);if(u&&64===g){let e=p/4;
21if(p%4!=0)throw Error("arx: invalid block position");for(let t=0,r;t<16;t++)f[r=e+t]=d[r]^h[t];p+=64;continue}for(let e=0,t;e<g;e++)s[t=p+e]=n[t]^l[e];p+=g}}(e,g,m,cK(a),c,l,h,o),cQ(...d),l}}(function(e,t,r,i,n,s=20){let o=e[0],a=e[1],c=e[2],l=e[3],h=t[0],u=t[1],d=t[2],f=t[3],p=t[4],g=t[5],m=t[6],y=t[7],b=r[0],w=r[1],v=r[2],x=o,E=a,_=c,I=l,A=h,S=u,C=d,N=f,O=p,P=g,T=m,M=y,R=n,k=b,D=w,L=v;for(let e=0;e<s;e+=2)O=O+(R=c8(R^(x=x+A|0),16))|0,x=x+(A=c8(A^O,12))|0,O=O+(R=c8(R^x,8))|0,A=c8(A^O,7),P=P+(k=c8(k^(E=E+S|0),16))|0,E=E+(S=c8(S^P,12))|0,P=P+(k=c8(k^E,8))|0,S=c8(S^P,7),T=T+(D=c8(D^(_=_+C|0),16))|0,_=_+(C=c8(C^T,12))|0,T=T+(D=c8(D^_,8))|0,C=c8(C^T,7),M=M+(L=c8(L^(I=I+N|0),16))|0,I=I+(N=c8(N^M,12))|0,M=M+(L=c8(L^I,8))|0,N=c8(N^M,7),T=T+(L=c8(L^(x=x+S|0),16))|0,x=x+(S=c8(S^T,12))|0,T=T+(L=c8(L^x,8))|0,S=c8(S^T,7),M=M+(R=c8(R^(E=E+C|0),16))|0,E=E+(C=c8(C^M,12))|0,M=M+(R=c8(R^E,8))|0,C=c8(C^M,7),O=O+(k=c8(k^(_=_+N|0),16))|0,_=_+(N=c8(N^O,12))|0,O=O+(k=c8(k^_,8))|0,N=c8(N^O,7),P=P+(D=c8(D^(I=I+A|0),16))|0,I=I+(A=c8(A^P,12))|0,P=P+(D=c8(D^I,8))|0,A=c8(A^P,7);let U=0;i[U++]=o+x|0,i[U++]=a+E|0,i[U++]=c+_|0,i[U++]=l+I|0,i[U++]=h+A|0,i[U++]=u+S|0,i[U++]=d+C|0,i[U++]=f+N|0,i[U++]=p+O|0,i[U++]=g+P|0,i[U++]=m+T|0,i[U++]=y+M|0,i[U++]=n+R|0,i[U++]=b+k|0,i[U++]=w+D|0,i[U++]=v+L|0},{counterRight:!1,counterLength:4,allowShortKeys:!1}),lr=new Uint8Array(16),li=(e,t)=>{e.update(t);let r=t.length%16;r&&e.update(lr.subarray(r))},ln=new Uint8Array(32);function ls(e,t,r,i,n){let s=e(t,r,ln),o=le.create(s);n&&li(o,n),li(o,i);let a=new Uint8Array(16),c=new DataView(a.buffer,a.byteOffset,a.byteLength);cJ(c,0,BigInt(n?n.length:0),!0),cJ(c,8,BigInt(i.length),!0),o.update(a);let l=o.digest();return cQ(s,a),l}((e,t)=>Object.assign(function(r,...i){if(cF(r),void 0!==e.nonceLength){let t=i[0];if(!t)throw Error("nonce / iv required");e.varSizeNonce?cF(t):cF(t,e.nonceLength)}let n=e.tagLength;n&&void 0!==i[1]&&cF(i[1]);let s=t(r,...i),o=(e,t)=>{if(void 0!==t){if(2!==e)throw Error("cipher output not supported");cF(t)}},a=!1;return{encrypt(e,t){if(a)throw Error("cannot encrypt() twice with same key + nonce");return a=!0,cF(e),o(s.encrypt.length,t),s.encrypt(e,t)},decrypt(e,t){if(cF(e),n&&e.length<n)throw Error("invalid ciphertext length: smaller than tagLength="+n);return o(s.decrypt.length,t),s.decrypt(e,t)}}},e))({blockSize:64,nonceLength:12,tagLength:16},(e=>(t,r,i)=>({encrypt(n,s){let o=n.length;(s=cY(o+16,s,!1)).set(n);let a=s.subarray(0,-16);e(t,r,a,a,1);let c=ls(e,t,r,a,i);return s.set(c,o),cQ(c),s},decrypt(n,s){s=cY(n.length-16,s,!1);let o=n.subarray(0,-16),a=n.subarray(-16),c=ls(e,t,r,o,i);if(!function(e,t){if(e.length!==t.length)return!1;let r=0;for(let i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r}(a,c))throw Error("invalid tag");return s.set(n.subarray(0,-16)),e(t,r,s,s,1),cQ(c),s}}))(lt));new Uint8Array([0]),new Uint8Array;
21class lo extends cS{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=cx(this.buffer)}update(e){cm(this);let{view:t,buffer:r,blockLen:i}=this,n=(e=cA(e)).length;for(let s=0;s<n;){let o=Math.min(i-this.pos,n-s);if(o===i){let t=cx(e);for(;i<=n-s;s+=i)this.process(t,s);continue}r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){cm(this),cy(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:i,isLE:n}=this,{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(r,0),s=0);for(let e=s;e<i;e++)t[e]=0;(function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(0xffffffff),o=Number(r>>n&s),a=Number(r&s),c=4*!!i,l=4*!i;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)})(r,i-8,BigInt(8*this.length),n),this.process(r,0);let o=cx(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=a/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)o.setUint32(4*e,l[e],n)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:i,finished:n,destroyed:s,pos:o}=this;return e.length=i,e.pos=o,e.finished=n,e.destroyed=s,i%t&&e.buffer.set(r),e}}let la=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),lc=new Uint32Array([0x6a09e66
217,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),ll=new Uint32Array(64);class lh extends lo{constructor(){super(64,32,8,!1),this.A=0|lc[0],this.B=0|lc[1],this.C=0|lc[2],this.D=0|lc[3],this.E=0|lc[4],this.F=0|lc[5],this.G=0|lc[6],this.H=0|lc[7]}get(){let{A:e,B:t,C:r,D:i,E:n,F:s,G:o,H:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)ll[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=ll[e-15],r=ll[e-2],i=cE(t,7)^cE(t,18)^t>>>3,n=cE(r,17)^cE(r,19)^r>>>10;ll[e]=n+ll[e-7]+i+ll[e-16]|0}let{A:r,B:i,C:n,D:s,E:o,F:a,G:c,H:l}=this;for(let e=0;e<64;e++){var h,u,d,f;let t=l+(cE(o,6)^cE(o,11)^cE(o,25))+((h=o)&a^~h&c)+la[e]+ll[e]|0,p=(cE(r,2)^cE(r,13)^cE(r,22))+((u=r)&(d=i)^u&(f=n)^d&f)|0;l=c,c=a,a=o,o=s+t|0,s=n,n=i,i=r,r=t+p|0}r=r+this.A|0,i=i+this.B|0,n=n+this.C|0,s=s+this.D|0,o=o+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,i,n,s,o,a,c,l)}roundClean(){ll.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}cC(()=>new lh);BigInt(0);function lu(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}let ld=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),lf={_0:48,_9:57,A:65,F:70,a:97,f:102};function lp(e){return e>=lf._0&&e<=lf._9?e-lf._0:e>=lf.A&&e<=lf.F?e-(lf.A-10):e>=lf.a&&e<=lf.f?e-(lf.a-10):void 0}function lg(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let i=new Uint8Array(r);for(let t=0,n=0;t<r;t++,n+=2){let r=lp(e.charCodeAt(n)),s=lp(e.charCodeAt(n+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[n]+e[n+1])+'" at index '+n);i[t]=16*r+s}return i}let lm={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||lu(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)},ly=BigInt(0),lb=BigInt(1);function lw(e,t){let r=e%t;return r>=ly?r:t+r}function lv(e,t,r){let i=e;for(;t-- >ly;)i*=i,i%=r;return i}BigInt(0),BigInt(1),BigInt(0),BigInt(1),BigInt(2),BigInt(8);let lx=BigInt(0),lE=BigInt(1),l_=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);let lI=BigInt(1),lA=BigInt(2),lS=BigInt(3),lC=BigInt(5);function lN(e){return e.includes(":")}function lO(e){return lN(e)?e.split(":")[0]:e}BigInt(8),!function(e){let t=(function(e,t,r={}){let i=(t,r,i)=>{let n=lm[r];if("function"!=typeof n)throw Error("invalid validator function");let s=e[t];if(!(i&&void 0===s)&&!n(s,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))i(e,r,!1);for(let[e,t]of Object.entries(r))i(e,t,!0)}(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})),{P:r}=t,i=e=>lw(e,r),n=t.montgomeryBits,s=Math.ceil(n/8),o=t.nByteLength,a=t.adjustScalarBytes||(e=>e),c=t.powPminus2||(e=>(function(e,t,r){if(t<ly)throw Error("invalid exponent, negatives unsupported");if(r<=ly)throw Error("invalid modulus");if(r===lb)return ly;let i=lb;for(;t>ly;)t&lb&&(i=i*e%r),e=e*e%r,t>>=lb;return i})(e,r-BigInt(2),r));(t.a-BigInt(2))/BigInt(4);function l(e){var t;return t=i(e),lg(t.toString(16).padStart(2*s,"0")).reverse()}l(t.Gu)}({P:l_,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{let{pow_p_5_8:t,b2:r}=function(e){let t=BigInt(10),r=BigInt(20),i=BigInt(40),n=BigInt(80),s=e*e%l_*e%l_,o=lv(s,lA,l_)*s%l_,a=lv(o,lI,l_)*e%l_,c=lv(a,lC,l_)*a%l_,l=lv(c,t,l_)*c%l_,h=lv(l,r,l_)*l%l_,u=lv(h,i,l_)*h%l_,d=lv(u,n,l_)*u%l_,f=lv(d,n,l_)*u%l_,p=lv(f,t,l_)*c%l_;return{pow_p_5_8:lv(p,lA,l_)*e%l_,b2:s}}(e);return lw(lv(t,lS,l_)*r,l_)}
21,adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},randomBytes:function(e=32){if(cv&&"function"==typeof cv.getRandomValues)return cv.getRandomValues(new Uint8Array(e));if(cv&&"function"==typeof cv.randomBytes)return cv.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}}),Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;let lP={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function lT(e,t){let{message:r,code:i}=lP[e];return{message:t?`${r} ${t}`:r,code:i}}function lM(e,t){return!!Array.isArray(e)&&(!("u">typeof t)||!e.length||e.every(t))}var lR=r(57317),lk=r(81029).Buffer;let lD="error",lL="wc@2:universal_provider:",lU="https://rpc.walletconnect.org/v1/",lB="generic",lj=`${lU}bundler`,l$={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};function lz(){}function lq(e){return null==e||"object"!=typeof e&&"function"!=typeof e}function lH(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function lF(e){return"object"==typeof e&&null!==e}function lW(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function lV(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}let lK="[object String]",lG="[object Number]",lY="[object Boolean]",lJ="[object Arguments]";function lX(e,t,r,i=new Map,n){let s=n?.(e,t,r,i);if(null!=s)return s;if(lq(e))return e;if(i.has(e))return i.get(e);if(Array.isArray(e)){let t=Array(e.length);i.set(e,t);for(let s=0;s<e.length;s++)t[s]=lX(e[s],s,r,i,n);return Object.hasOwn(e,"index")&&(t.index=e.index),Object.hasOwn(e,"input")&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;for(let[s,o]of(i.set(e,t),e))t.set(s,lX(o,s,r,i,n));return t}if(e instanceof Set){let t=new Set;for(let s of(i.set(e,t),e))t.add(lX(s,void 0,r,i,n));return t}if("u">typeof lk&&lk.isBuffer(e))return e.subarray();if(lH(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);i.set(e,t);for(let s=0;s<e.length;s++)t[s]=lX(e[s],s,r,i,n);return t}if(e instanceof ArrayBuffer||"u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return i.set(e,t),lQ(t,e,r,i,n),t}if("u">typeof File&&e instanceof File){let t=new File([e],e.name,{type:e.type});return i.set(e,t),lQ(t,e,r,i,n),t}if(e instanceof Blob){let t=new Blob([e],{type:e.type});return i.set(e,t),lQ(t,e,r,i,n),t}if(e instanceof Error){let t=new e.constructor;return i.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,lQ(t,e,r,i,n),t}if("object"==typeof e&&function(e){switch(lV(e)){case lJ:case"[object Array]":case"[object ArrayBuffer]":case"[object DataView]":case lY:case"[object Date]":case"[object Float32Array]":case"[object Float64Array
21]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Map]":case lG:case"[object Object]":case"[object RegExp]":case"[object Set]":case lK:case"[object Symbol]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return!0;default:return!1}}(e)){let t=Object.create(Object.getPrototypeOf(e));return i.set(e,t),lQ(t,e,r,i,n),t}return e}function lQ(e,t,r=e,i,n){let s=[...Object.keys(t),...lW(t)];for(let o=0;o<s.length;o++){let a=s[o],c=Object.getOwnPropertyDescriptor(e,a);(null==c||c.writable)&&(e[a]=lX(t[a],a,r,i,n))}}function lZ(e){var t;return t=(t,r,i,n)=>{let s=void 0;if(null!=s)return s;if("object"==typeof e)switch(Object.prototype.toString.call(e)){case lG:case lK:case lY:{let t=new e.constructor(e?.valueOf());return lQ(t,e),t}case lJ:{let t={};return lQ(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}},lX(e,void 0,e,new Map,t)}function l0(e){return null!==e&&"object"==typeof e&&"[object Arguments]"===lV(e)}var l1=Object.defineProperty,l2=Object.defineProperties,l3=Object.getOwnPropertyDescriptors,l8=Object.getOwnPropertySymbols,l5=Object.prototype.hasOwnProperty,l6=Object.prototype.propertyIsEnumerable,l4=(e,t,r)=>t in e?l1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,l9=(e,t)=>{for(var r in t||(t={}))l5.call(t,r)&&l4(e,r,t[r]);if(l8)for(var r of l8(t))l6.call(t,r)&&l4(e,r,t[r]);return e},l7=(e,t)=>l2(e,l3(t));function he(e,t,r){var i;let n=cd(e);return(null==(i=t.rpcMap)?void 0:i[n.reference])||`${lU}?chainId=${n.namespace}:${n.reference}&projectId=${r}`}function ht(e){return e.includes(":")?e.split(":")[1]:e}function hr(e){return e.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function hi(e={},t={}){return function(e,...t){return function(e,...t){let r=t.slice(0,-1),i=t[t.length-1],n=e;for(let e=0;e<r.length;e++)n=function e(t,r,i,n){if(lq(t)&&(t=Object(t)),null==r||"object"!=typeof r)return t;if(n.has(r))return function(e){if(lq(e))return e;if(Array.isArray(e)||lH(e)||e instanceof ArrayBuffer||"u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)return e.slice(0);let t=Object.getPrototypeOf(e),r=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new r(e);if(e instanceof RegExp){let t=new r(e);return t.lastIndex=e.lastIndex,t}if(e instanceof DataView)return new r(e.buffer.slice(0));if(e instanceof Error){let t=new r(e.message);return t.stack=e.stack,t.name=e.name,t.cause=e.cause,t}return"u">typeof File&&e instanceof File?new r([e],e.name,{type:e.type,lastModified:e.lastModified}):"object"==typeof e?Object.assign(Object.create(t),e):e}(n.get(r));if(n.set(r,t),Array.isArray(r)){r=r.slice();for(let e=0;e<r.length;e++)r[e]=r[e]??void 0}let s=[...Object.keys(r),...lW(r)];for(let o=0;o<s.length;o++){let a=s[o],c=r[a],l=t[a];if(l0(c)&&(c={...c}),l0(l)&&(l={...l}),"u">typeof lk&&lk.isBuffer(c)&&(c=lZ(c)),Array.isArray(c))if("object"==typeof l&&null!=l){let e=[],t=Reflect.ownKeys(l);for(let r=0;r<t.length;r++){let i=t[r];e[i]=l[i]}l=e}else l=[];let h=i(l,c,a,t,r,n);null!=h?t[a]=h:Array.isArray(c)||lF(l)&&lF(c)?t[a]=e(l,c,i,n):null==l&&function(e){if("object"!=typeof e||null==e)return!1;if(null===Object.getPrototypeOf(e))return!0;if("[object Object]"!==Object.prototype.toString.call(e)){let t=e[Symbol.toStringTag];return null!=t&&!!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable&&e.toString()===`[object ${t}]`}let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(c)?t[a]=e({},c,i,n):null==l&&lH(c)?t[a]=lZ(c):(void 0===l||void 0!==c)&&(t[a]=c)}return t}(n,r[e],i,new Map);return n}(e,...t,lz)}(hn(e),hn(t))}function hn(e){var t,r,i,n;let s={};if(!(Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length))return s;for(let[o,a]of Object.entries(e)){let e=lN(o)?[o]:a.chains,c=a.methods||[],l=a.events||[],h=a.rpcMap||{},u=lO(o);s[u]=l7(l9(l9({},s[u]),a),{chains:cf(e,null==(t=s[u])?void 0:t.chains),methods:cf(c,null==(r=s[u])?void 0:r.methods),events:cf(l,null==(i=s[u])?void 0:i.events),rpcMap:l9(l9({},h),null==(n=s[u])?void 0:n.rpcMap)})}return s}function hs(e){return e.includes(":")?e.split(":")[2]:e}function ho(e){let t={};for(let[r,i]of Object.entries(e)){let e=i.methods||[],n=i.events||[],s=i.accounts||[],o=lN(r)?[r]:i.chains?i.chains:hr(i.accounts);t[r]={chains:o,methods:e,events:n,accounts:s}}return t}function ha(e){return"number"==typeof e?e:e.includes("0x")?parseInt(e,16):isNaN(Number(e=e.includes(":")?e.split(":")[1]:e))?e:Number(e)}let hc={},hl=e=>hc[e],hh=(e,t)=>{hc[e]=t};var hu=Object.defineProperty,hd=(e,t,r)=>((e,t,r)=>t in e?hu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class hf{constructor(e){hd(this,"name","polkadot"),hd(this,"client"),hd(this,"httpProviders"),hd(this,"events"),hd(this,"namespace"),hd(this,"chainId"),this.namespace=e.namespace,this.events=hl("events"),this.client=hl("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(l$.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=ht(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||he(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new t2.F(new lR.A(r,hl("disableProviderPing")))}}var hp=Object.defineProperty,hg=Object.defineProperties,hm=Object.getOwnPropertyDescriptors,hy=Object.getOwnPropertySymbols,hb=Object.prototype.hasOwnProperty,hw=Object.prototype.propertyIsEnumerable,hv=(e,t,r)=>t in e?hp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hx=(e,t)=>{for(var r in t||(t={}))hb.call(t,r)&&hv(e,r,t[r]);if(hy)for(var r of hy(t))hw.call(t,r)&&hv(e,r,t[r]);return e},hE=(e,t)=>hg(e,hm(t)),h_=(e,t,r)=>hv(e,"symbol"!=typeof t?t+"":t,r);class hI{constructor(e){h_(this,"name","eip155"),h_(this,"client"),h_(this,"chainId"),h_(this,"namespace"),h_(this,"httpProviders"),h_(this,"events"),this.namespace=e.namespace,this.events=hl("events"),this.client=hl("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(l$.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){let r=t||he(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new t2.F(new lR.V(r,hl("disableProviderPing")))}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=parseInt(ht(t));e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(){let e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,r;let i=e.request.params?null==(t=e.request.params[0])?void 0:t.chainId:"0x0",n=parseInt(i=i.startsWith("0x")?i:`0x${i}`,16);if(this.isChainApproved(n))this.setDefaultChain(`${n}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:null==(r=this.namespace.chains)?void 0:r[0]}),this.setDefaultChain(`${n}`);else throw Error(`Failed to switch to chain 'eip155:${n}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,r,i;let n=null==(r=null==(t=e.request)?void 0:t.params)?void 0:r[0];if(!n)throw Error("Missing address parameter in `wallet_getCapabilities` request");let s=this.client.session.get(e.topic),o=(null==(i=s?.sessionProperties)?void 0:i.capabilities)||{};if(null!=o&&o[n])return o?.[n];let a=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:hE(hx({},s.sessionProperties||{}),{capabilities:hE(hx({},o||{}),{[n]:a})})})}catch(e){console.warn("Failed to update session with capabilities",e)}return a}
21async getCallStatus(e){var t,r;let i=this.client.session.get(e.topic),n=null==(t=i.sessionProperties)?void 0:t.bundler_name;if(n){let t=this.getBundlerUrl(e.chainId,n);try{return await this.getUserOperationReceipt(t,e)}catch(e){console.warn("Failed to fetch call status from bundler",e,t)}}let s=null==(r=i.sessionProperties)?void 0:r.bundler_url;if(s)try{return await this.getUserOperationReceipt(s,e)}catch(e){console.warn("Failed to fetch call status from custom bundler",e,s)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var r;let i=new URL(e),n=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((0,t3.formatJsonRpcRequest)("eth_getUserOperationReceipt",[null==(r=t.request.params)?void 0:r[0]]))});if(!n.ok)throw Error(`Failed to fetch user operation receipt - ${n.status}`);return await n.json()}getBundlerUrl(e,t){return`${lj}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}var hA=Object.defineProperty,hS=(e,t,r)=>((e,t,r)=>t in e?hA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class hC{constructor(e){hS(this,"name","solana"),hS(this,"client"),hS(this,"httpProviders"),hS(this,"events"),hS(this,"namespace"),hS(this,"chainId"),this.namespace=e.namespace,this.events=hl("events"),this.client=hl("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(l$.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=ht(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||he(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new t2.F(new lR.A(r,hl("disableProviderPing")))}}var hN=Object.defineProperty,hO=(e,t,r)=>((e,t,r)=>t in e?hN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class hP{constructor(e){hO(this,"name","cosmos"),hO(this,"client"),hO(this,"httpProviders"),hO(this,"events"),hO(this,"namespace"),hO(this,"chainId"),this.namespace=e.namespace,this.events=hl("events"),this.client=hl("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(l$.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=ht(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||he(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new t2.F(new lR.A(r,hl("disableProviderPing")))}}var hT=Object.defineProperty,hM=(e,t,r)=>((e,t,r)=>t in e?hT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class hR{constructor(e){hM(this,"name","algorand"),hM(this,"client"),hM(this,"httpProviders"),hM(this,"events"),hM(this,"namespace"),hM(this,"chainId"),this.namespace=e.namespace,this.events=hl("events"),this.client=hl("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){let r=t||he(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.chainId=e,this.events.emit(l$.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||he(e,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new t2.F(new lR.A(r,hl("disableProviderPing")))}}var hk=Object.defineProperty,hD=(e,t,r)=>((e,t,r)=>t in e?hk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class hL{constructor(e){hD(this,"name","cip34"),hD(this,"client"),hD(this,"httpProviders"),hD(this,"events"),hD(this,"namespace"),hD(this,"chainId"),this.namespace=e.namespace,this.events=hl("events"),this.client=hl("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(l$.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{let r=this.getCardanoRPCUrl(t),i=ht(t);e[i]=this.createHttpProvider(i,r)}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){let t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||this.getCardanoRPCUrl(e);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new t2.F(new lR.A(r,hl("disableProviderPing")))}}var hU=Object.defineProperty,hB=(e,t,r)=>((e,t,r)=>t in e?hU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class hj{constructor(e){hB(this,"name","elrond"),hB(this,"client"),hB(this,"httpProviders"),hB(this,"events"),hB(this,"namespace"),hB(this,"chainId"),this.namespace=e.namespace,this.events=hl("events"),this.client=hl("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(l$.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=ht(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||he(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new t2.F(new lR.A(r,hl("disableProviderPing")))}}var h$=Object.defineProperty,hz=(e,t,r)=>((e,t,r)=>t in e?h$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class hq{constructor(e){hz(this,"name","multiversx"),hz(this,"client"),hz(this,"httpProviders"),hz(this,"events"),hz(this,"namespace"),hz(this,"chainId"),this.namespace=e.namespace,this.events=hl("events"),this.client=hl("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(l$.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=ht(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||he(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new t2.F(new lR.A(r,hl("disableProviderPing")))}}var hH=Object.defineProperty,hF=(e,t,r)=>((e,t,r)=>t in e?hH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);
21class hW{constructor(e){hF(this,"name","near"),hF(this,"client"),hF(this,"httpProviders"),hF(this,"events"),hF(this,"namespace"),hF(this,"chainId"),this.namespace=e.namespace,this.events=hl("events"),this.client=hl("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){let r=t||he(`${this.name}:${e}`,this.namespace);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(l$.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||he(e,this.namespace);return typeof r>"u"?void 0:new t2.F(new lR.A(r,hl("disableProviderPing")))}}var hV=Object.defineProperty,hK=(e,t,r)=>((e,t,r)=>t in e?hV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class hG{constructor(e){hK(this,"name","tezos"),hK(this,"client"),hK(this,"httpProviders"),hK(this,"events"),hK(this,"namespace"),hK(this,"chainId"),this.namespace=e.namespace,this.events=hl("events"),this.client=hl("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){let r=t||he(`${this.name}:${e}`,this.namespace);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(l$.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{e[t]=this.createHttpProvider(t)}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||he(e,this.namespace);return typeof r>"u"?void 0:new t2.F(new lR.A(r))}}var hY=Object.defineProperty,hJ=(e,t,r)=>((e,t,r)=>t in e?hY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class hX{constructor(e){hJ(this,"name",lB),hJ(this,"client"),hJ(this,"httpProviders"),hJ(this,"events"),hJ(this,"namespace"),hJ(this,"chainId"),this.namespace=e.namespace,this.events=hl("events"),this.client=hl("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(l$.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){var e,t;let r={};return null==(t=null==(e=this.namespace)?void 0:e.accounts)||t.forEach(e
21=>{let t=cd(e);r[`${t.namespace}:${t.reference}`]=this.createHttpProvider(e)}),r}getHttpProvider(e){let t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||he(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new t2.F(new lR.A(r,hl("disableProviderPing")))}}var hQ=Object.defineProperty,hZ=Object.defineProperties,h0=Object.getOwnPropertyDescriptors,h1=Object.getOwnPropertySymbols,h2=Object.prototype.hasOwnProperty,h3=Object.prototype.propertyIsEnumerable,h8=(e,t,r)=>t in e?hQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,h5=(e,t)=>{for(var r in t||(t={}))h2.call(t,r)&&h8(e,r,t[r]);if(h1)for(var r of h1(t))h3.call(t,r)&&h8(e,r,t[r]);return e},h6=(e,t)=>hZ(e,h0(t)),h4=(e,t,r)=>h8(e,"symbol"!=typeof t?t+"":t,r);class h9{constructor(e){h4(this,"client"),h4(this,"namespaces"),h4(this,"optionalNamespaces"),h4(this,"sessionProperties"),h4(this,"scopedProperties"),h4(this,"events",new(n())),h4(this,"rpcProviders",{}),h4(this,"session"),h4(this,"providerOpts"),h4(this,"logger"),h4(this,"uri"),h4(this,"disableProviderPing",!1),this.providerOpts=e,this.logger="u">typeof e?.logger&&"string"!=typeof e?.logger?e.logger:(0,a.h6)((0,a.iP)({level:e?.logger||lD})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){let t=new h9(e);return await t.initialize(),t}async request(e,t,r){let[i,n]=this.validateChain(t);if(!this.session)throw Error("Please call connect() before request()");return await this.getProvider(i).request({request:h5({},e),chainId:`${i}:${n}`,topic:this.session.topic,expiry:r})}sendAsync(e,t,r,i){let n=new Date().getTime();this.request(e,r,i).then(e=>t(null,(0,t3.formatJsonRpcResult)(n,e))).catch(e=>t(e,void 0))}async enable(){if(!this.client)throw Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(e=this.session)?void 0:e.topic,reason:lT("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();let{uri:r,response:i}=await this.client.authenticate(e,t);r&&(this.uri=r,this.events.emit("display_uri",r));let n=await i();if(this.session=n.session,this.session){let e=ho(this.session.namespaces);this.namespaces=hi(this.namespaces,e),await this.persist("namespaces",this.namespaces),this.onConnect()}return n}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){let{uri:t,approval:r}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties});t&&(this.uri=t,this.events.emit("display_uri",t));let i=await r();this.session=i;let n=ho(i.namespaces);return this.namespaces=hi(this.namespaces,n),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;let[r,i]=this.validateChain(e),n=this.getProvider(r);n.name===lB?n.setDefaultChain(`${r}:${i}`,t):n.setDefaultChain(i,t)}catch(e){if(!/Please call connect/.test(e.message))throw e}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");let t=this.client.pairing.getAll();if(lM(t)){for(let r of t)e.deletePairings?this.client.core.expirer.set(r.topic,0):await this.client.core.relayer.subscriber.unsubscribe(r.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var e,t;if(this.client=this.providerOpts.client||await cu.init({core:this.providerOpts.core,logger:this.providerOpts.logger||lD,relayUrl:this.providerOpts.relayUrl||"wss://relay.walletconnect.org",projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(r){throw this.logger.error("Failed to get session",r),Error(`The provided session: ${null==(t=null==(e=this.providerOpts)?void 0:e.session)?void 0:t.topic} doesn't exist in the Sign client`)}else{let e=this.client.session.getAll();this.session=e[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw Error("Sign Client not initialized");if(!this.session)throw Error("Session not initialized. Please call connect() before enable()");let e=[...new Set(Object.keys(this.session.namespaces).map(e=>lO(e)))];hh("client",this.client),hh("events",this.events),hh("disableProviderPing",this.disableProviderPing),e.forEach(e
21=>{if(!this.session)return;let t=function(e,t){let r=Object.keys(t.namespaces).filter(t=>t.includes(e));if(!r.length)return[];let i=[];return r.forEach(e=>{let r=t.namespaces[e].accounts;i.push(...r)}),i}(e,this.session),r=hr(t),i=h6(h5({},hi(this.namespaces,this.optionalNamespaces)[e]),{accounts:t,chains:r});switch(e){case"eip155":this.rpcProviders[e]=new hI({namespace:i});break;case"algorand":this.rpcProviders[e]=new hR({namespace:i});break;case"solana":this.rpcProviders[e]=new hC({namespace:i});break;case"cosmos":this.rpcProviders[e]=new hP({namespace:i});break;case"polkadot":this.rpcProviders[e]=new hf({namespace:i});break;case"cip34":this.rpcProviders[e]=new hL({namespace:i});break;case"elrond":this.rpcProviders[e]=new hj({namespace:i});break;case"multiversx":this.rpcProviders[e]=new hq({namespace:i});break;case"near":this.rpcProviders[e]=new hW({namespace:i});break;case"tezos":this.rpcProviders[e]=new hG({namespace:i});break;default:this.rpcProviders[lB]?this.rpcProviders[lB].updateNamespace(i):this.rpcProviders[lB]=new hX({namespace:i})}})}registerEventListeners(){if(typeof this.client>"u")throw Error("Sign Client is not initialized");this.client.on("session_ping",e=>{var t;let{topic:r}=e;r===(null==(t=this.session)?void 0:t.topic)&&this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{var t;let{params:r,topic:i}=e;if(i!==(null==(t=this.session)?void 0:t.topic))return;let{event:n}=r;if("accountsChanged"===n.name){let e=n.data;e&&lM(e)&&this.events.emit("accountsChanged",e.map(hs))}else if("chainChanged"===n.name){let e=r.chainId,t=r.event.data,i=lO(e),n=ha(e)!==ha(t)?`${i}:${ha(t)}`:e;this.onChainChanged(n)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var r,i;if(e!==(null==(r=this.session)?void 0:r.topic))return;let{namespaces:n}=t,s=null==(i=this.client)?void 0:i.session.get(e);this.session=h6(h5({},s),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{var t;e.topic===(null==(t=this.session)?void 0:t.topic)&&(await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",h6(h5({},lT("USER_DISCONNECTED")),{data:e.topic})))}),this.on(l$.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[lB]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace(null==(t=this.session)?void 0:t.namespaces[e])})}setNamespaces(e){let{namespaces:t,optionalNamespaces:r,sessionProperties:i,scopedProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),r&&Object.keys(r).length&&(this.optionalNamespaces=r),this.sessionProperties=i,this.scopedProperties=n}validateChain(e){let[t,r]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,r];if(t&&!Object.keys(this.namespaces||{}).map(e=>lO(e)).includes(t))throw Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&r)return[t,r];let i=lO(Object.keys(this.namespaces)[0]),n=this.rpcProviders[i].getDefaultChain();return[i,n]}async requestAccounts(){let[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}async onChainChanged(e,t=!1){if(!this.namespaces)return;let[r,i]=this.validateChain(e);i&&(t||this.getProvider(r).setDefaultChain(i),this.namespaces[r]?this.namespaces[r].defaultChain=i:this.namespaces[`${r}:${i}`]?this.namespaces[`${r}:${i}`].defaultChain=i:this.namespaces[`${r}:${i}`]={defaultChain:i},this.events.emit("chainChanged",i),await this.persist("namespaces",this.namespaces))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,await this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(e,t){var r;let i=(null==(r=this.session)?void 0:r.topic)||"";await this.client.core.storage.setItem(`${lL}/${e}${i}`,t)}async getFromStore(e){var t;let r=(null==(t=this.session)?void 0:t.topic)||"";return await this.client.core.storage.getItem(`${lL}/${e}${r}`)}async deleteFromStore(e){var t;let r=(null==(t=this.session)?void 0:t.topic)||"";await this.client.core.storage.removeItem(`${lL}/${e}${r}`)}async cleanupStorage(){var e;try{if((null==(e=this.client)?void 0:e.session.length)>0)return;for(let e of(await this.client.core.storage.getKeys()))e.startsWith(lL)&&await this.client.core.storage.removeItem(e)}catch(e){this.logger.warn("Failed to cleanup storage",e)}}}},33372:(e,t,r)=>{"use strict";var i=r(98392),n=r(78239),s=n.assert,o=n.cachedProperty,a=n.parseBytes;function c(e,t){this.eddsa=e,"object"!=typeof t&&(t=a(t)),Array.isArray(t)&&(s(t.length===2*e.encodingLength,"Signature has invali
21d size"),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),s(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof i&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}o(c,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),o(c,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),o(c,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),o(c,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),c.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},c.prototype.toHex=function(){return n.encode(this.toBytes(),"hex").toUpperCase()},e.exports=c},33869:(e,t,r)=>{"use strict";var i=r(78239),n=i.assert,s=i.parseBytes,o=i.cachedProperty;function a(e,t){this.eddsa=e,this._secret=s(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=s(t.pub)}a.fromPublic=function(e,t){return t instanceof a?t:new a(e,{pub:t})},a.fromSecret=function(e,t){return t instanceof a?t:new a(e,{secret:t})},a.prototype.secret=function(){return this._secret},o(a,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),o(a,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),o(a,"privBytes",function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,i=t.slice(0,e.encodingLength);return i[0]&=248,i[r]&=127,i[r]|=64,i}),o(a,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),o(a,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),o(a,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),a.prototype.sign=function(e){return n(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},a.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},a.prototype.getSecret=function(e){return n(this._secret,"KeyPair is public only"),i.encode(this.secret(),e)},a.prototype.getPublic=function(e){return i.encode(this.pubBytes(),e)},e.exports=a},34430:function(e){e.exports={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||t[0])+"]"}}},34918:(e,t,r)=>{"use strict";r.d(t,{sc:()=>y,Zf:()=>b});var i=r(458);class n extends i.Vw{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=(0,i.O8)(this.buffer)}update(e){(0,i.CC)(this),e=(0,i.ZJ)(e),(0,i.DO)(e);let{view:t,buffer:r,blockLen:n}=this,s=e.length;for(let o=0;o<s;){let a=Math.min(n-this.pos,s-o);if(a===n){let t=(0,i.O8)(e);for(;n<=s-o;o+=n)this.process(t,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,i.CC)(this),(0,i.Ht)(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:s}=this,{pos:o}=this;t[o++]=128,(0,i.uH)(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;e++)t[e]=0;!function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(0xffffffff),o=Number(r>>n&s),a=Number(r&s),c=4*!!i,l=4*!i;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)}(r,n-8,BigInt(8*this.length),s),this.process(r,0);let a=(0,i.O8)(e),c=this.outputLen;if(c%4)throw Error("_sha2: outputLen should be aligned to 32bit");let l=c/4,h=this.get();if(l>h.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)a.setUint32(4*e,h[e],s)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:i,finished:n,destroyed:s,pos:o}=this;return e.destroyed=s,e.finished=n,e.length=i,e.pos=o,i%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}
vendor: 3,109 bytes, line 21
21let s=Uint32Array.from([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),o=Uint32Array.from([0x6a09e667,0xf3bcc908,0xbb67ae85,0x84caa73b,0x3c6ef372,0xfe94f82b,0xa54ff53a,0x5f1d36f1,0x510e527f,0xade682d1,0x9b05688c,0x2b3e6c1f,0x1f83d9ab,0xfb41bd6b,0x5be0cd19,0x137e2179]);var a=r(78710);let c=Uint32Array.from([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),l=new Uint32Array(64);class h extends n{constructor(e=32){super(64,e,8,!1),this.A=0|s[0],this.B=0|s[1],this.C=0|s[2],this.D=0|s[3],this.E=0|s[4],this.F=0|s[5],this.G=0|s[6],this.H=0|s[7]}get(){let{A:e,B:t,C:r,D:i,E:n,F:s,G:o,H:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)l[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=l[e-15],r=l[e-2],n=(0,i.Ow)(t,7)^(0,i.Ow)(t,18)^t>>>3,s=(0,i.Ow)(r,17)^(0,i.Ow)(r,19)^r>>>10;l[e]=s+l[e-7]+n+l[e-16]|0}let{A:r,B:n,C:s,D:o,E:a,F:h,G:u,H:d}=this;for(let e=0;e<64;e++){var f,p,g,m;let t=d+((0,i.Ow)(a,6)^(0,i.Ow)(a,11)^(0,i.Ow)(a,25))+((f=a)&h^~f&u)+c[e]+l[e]|0,y=((0,i.Ow)(r,2)^(0,i.Ow)(r,13)^(0,i.Ow)(r,22))+((p=r)&(g=n)^p&(m=s)^g&m)|0;d=u,u=h,h=a,a=o+t|0,o=s,s=n,n=r,r=t+y|0}r=r+this.A|0,n=n+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,h=h+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(r,n,s,o,a,h,u,d)}roundClean(){(0,i.uH)(l)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,i.uH)(this.buffer)}}let u=a.lD(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
215771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),d=u[0],f=u[1],p=new Uint32Array(80),g=new Uint32Array(80);class m extends n{constructor(e=64){super(128,e,16,!1),this.Ah=0|o[0],this.Al=0|o[1],this.Bh=0|o[2],this.Bl=0|o[3],this.Ch=0|o[4],this.Cl=0|o[5],this.Dh=0|o[6],this.Dl=0|o[7],this.Eh=0|o[8],this.El=0|o[9],this.Fh=0|o[10],this.Fl=0|o[11],this.Gh=0|o[12],this.Gl=0|o[13],this.Hh=0|o[14],this.Hl=0|o[15]}get(){let{Ah:e,Al:t,Bh:r,Bl:i,Ch:n,Cl:s,Dh:o,Dl:a,Eh:c,El:l,Fh:h,Fl:u,Gh:d,Gl:f,Hh:p,Hl:g}=this;return[e,t,r,i,n,s,o,a,c,l,h,u,d,f,p,g]}set(e,t,r,i,n,s,o,a,c,l,h,u,d,f,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|i,this.Ch=0|n,this.Cl=0|s,this.Dh=0|o,this.Dl=0|a,this.Eh=0|c,this.El=0|l,this.Fh=0|h,this.Fl=0|u,this.Gh=0|d,this.Gl=0|f,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)p[r]=e.getUint32(t),g[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|p[e-15],r=0|g[e-15],i=a.rE(t,r,1)^a.rE(t,r,8)^a.xn(t,r,7),n=a.ry(t,r,1)^a.ry(t,r,8)^a.jm(t,r,7),s=0|p[e-2],o=0|g[e-2],c=a.rE(s,o,19)^a.qh(s,o,61)^a.xn(s,o,6),l=a.ry(s,o,19)^a.Ei(s,o,61)^a.jm(s,o,6),h=a.CW(n,l,g[e-7],g[e-16]
21),u=a.CQ(h,i,c,p[e-7],p[e-16]);p[e]=0|u,g[e]=0|h}let{Ah:r,Al:i,Bh:n,Bl:s,Ch:o,Cl:c,Dh:l,Dl:h,Eh:u,El:m,Fh:y,Fl:b,Gh:w,Gl:v,Hh:x,Hl:E}=this;for(let e=0;e<80;e++){let t=a.rE(u,m,14)^a.rE(u,m,18)^a.qh(u,m,41),_=a.ry(u,m,14)^a.ry(u,m,18)^a.Ei(u,m,41),I=u&y^~u&w,A=m&b^~m&v,S=a.F8(E,_,A,f[e],g[e]),C=a.TH(S,x,t,I,d[e],p[e]),N=0|S,O=a.rE(r,i,28)^a.qh(r,i,34)^a.qh(r,i,39),P=a.ry(r,i,28)^a.Ei(r,i,34)^a.Ei(r,i,39),T=r&n^r&o^n&o,M=i&s^i&c^s&c;x=0|w,E=0|v,w=0|y,v=0|b,y=0|u,b=0|m,({h:u,l:m}=a.WQ(0|l,0|h,0|C,0|N)),l=0|o,h=0|c,o=0|n,c=0|s,n=0|r,s=0|i;let R=a.Vl(N,P,M);r=a.Vr(R,C,O,T),i=0|R}({h:r,l:i}=a.WQ(0|this.Ah,0|this.Al,0|r,0|i)),({h:n,l:s}=a.WQ(0|this.Bh,0|this.Bl,0|n,0|s)),({h:o,l:c}=a.WQ(0|this.Ch,0|this.Cl,0|o,0|c)),({h:l,l:h}=a.WQ(0|this.Dh,0|this.Dl,0|l,0|h)),({h:u,l:m}=a.WQ(0|this.Eh,0|this.El,0|u,0|m)),({h:y,l:b}=a.WQ(0|this.Fh,0|this.Fl,0|y,0|b)),({h:w,l:v}=a.WQ(0|this.Gh,0|this.Gl,0|w,0|v)),({h:x,l:E}=a.WQ(0|this.Hh,0|this.Hl,0|x,0|E)),this.set(r,i,n,s,o,c,l,h,u,m,y,b,w,v,x,E)}roundClean(){(0,i.uH)(p,g)}destroy(){(0,i.uH)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}let y=(0,i.qj)(()=>new h),b=(0,i.qj)(()=>new m)},35425:e=>{function t(){this.buffer=[],this.length=0}t.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let r=0;r<t;r++)this.putBit((e>>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},e.exports=t},35630:(e,t,r)=>{let i=r(46342).getSymbolSize;t.getPositions=function(e){let t=i(e);return[[0,0],[t-7,0],[0,t-7]]}},36117:function(e){e.exports=function(){"use strict";var e="millisecond",t="second",r="minute",i="hour",n="week",s="month",o="quarter",a="year",c="date",l="Invalid Date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,u=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d=function(e,t,r){var i=String(e);return!i||i.length>=t?e:""+Array(t+1-i.length).join(r)+e},f="en",p={};p[f]={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||t[0])+"]"}};var g="$isDayjsObject",m=function(e){return e instanceof v||!(!e||!e[g])},y=function e(t,r,i){var n;if(!t)return f;if("string"==typeof t){var s=t.toLowerCase();p[s]&&(n=s),r&&(p[s]=r,n=s);var o=t.split("-");if(!n&&o.length>1)return e(o[0])}else{var a=t.name;p[a]=t,n=a}return!i&&n&&(f=n),n||!i&&f},b=function(e,t){if(m(e))return e.clone();var r="object"==typeof t?t:{};return r.date=e,r.args=arguments,new v(r)},w={s:d,z:function(e){var t=-e.utcOffset(),r=Math.abs(t);return(t<=0?"+":"-")+d(Math.floor(r/60),2,"0")+":"+d(r%60,2,"0")},m:function e(t,r){if(t.date()<r.date())return-e(r,t);var i=12*(r.year()-t.year())+(r.month()-t.month()),n=t.clone().add(i,s),o=r-n<0,a=t.clone().add(i+(o?-1:1),s);return+(-(i+(r-n)/(o?n-a:a-n))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(l){return({M:s,y:a,w:n,d:"day",D:c,h:i,m:r,s:t,ms:e,Q:o})[l]||String(l||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}};w.l=y,w.i=m,w.w=function(e,t){return b(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var v=function(){function d(e){this.$L=y(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[g]=!0}var f=d.prototype;return f.parse=function(e){this.$d=function(e){var t=e.date,r=e.utc;if(null===t)return new Date(NaN);if(w.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var i=t.match(h);if(i){var n=i[2]-1||0,s=(i[7]||"0").substring(0,3);return r?new Date(Date.UTC(i[1],n,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)):new Date(i[1],n,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)}}return new Date(t)}(e),this.init()},f.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},f.$utils=function(){return w},f.isValid=function(){return this.$d.toString()!==l},f.isSame=function(e,t){var r=b(e);return this.startOf(t)<=r&&r<=this.endOf(t)},f.isAfter=function(e,t){return b(e)<this.startOf(t)},f.isBefore=function(e,t){return this.endOf(t)<b(e)},f.$g=function(e,t,r){return w.u(e)?this[t]:this.set(r,e)},f.unix=function(){return Math.floor(this.valueOf()/1e3)},f.valueOf=function(){return this.$d.getTime()},f.startOf=function(e,o){var l=this,h=!!w.u(o)||o,u=w.p(e),d=function(e,t){var r=w.w(l.$u?Date.UTC(l.$y,t,e):new Date(l.$y,t,e),l);return h?r:r.endOf("day")},f=function(e,t){return w.w(l.toDate()[e].apply(l.toDate("s"),(h?[0,0,0,0]:[23,59,59,999]).slice(t)),l)},p=this.$W,g=this.$M,m=this.$D,y="set"+(this.$u?"UTC":"");switch(u){case a:return h?d(1,0):d(31,11);case s:return h?d(1,g):d(0,g+1);case n:var b=this.$locale().weekStart||0,v=(p<b?p+7:p)-b;return d(h?m-v:m+(6-v),g);case"day":case c:return f(y+"Hours",0);case i:return f(y+"Minutes",1);case r:return f(y+"Seconds",2);case t:return f(y+"Milliseconds",3);default:return this.clone()}},f.endOf=function(e){return this.startOf(e,!1)},f.$set=function(n,o){var l,h=w.p(n),u="set"+(this.$u?"UTC":""),d=((l={}).day=u+"Date",l[c]=u+"Date",l[s]=u+"Month",l[a]=u+"FullYear",l[i]=u+"Hours",l[r]=u+"Minutes",l[t]=u+"Seconds",l[e]=u+"Milliseconds",l)[h],f="day"===h?this.$D+(o-this.$W):o;if(h===s||h===a){var p=this.clone().set(c,1);p.$d[d](f),p.init(),this.$d=p.set(c,Math.min(this.$D,p.daysInMonth())).$d}else d&&this.$d[d](f);return this.init(),this},f.set=function(e,t){return this.clone().$set(e,t)},f.get=function(e){return this[w.p(e)]()},f.add=function(e,o){var c,l=this;e=Number(e);var h=w.p(o),u=function(t){var r=b(l);return w.w(r.date(r.date()+Math.round(t*e)),l)};if(h===s)return this.set(s,this.$M+e);if(h===a)return this.set(a,this.$y+e);if("day"===h)return u(1);if(h===n)return u(7);var d=((c={})[r]=6e4,c[i]=36e5,c[t]=1e3,c)[h]||1,f=this.$d.getTime()+e*d;return w.w(f,this)},f.subtract=function(e,t){return this.add(-1*e,t)},f.format=function(e){var t=this,r=this.$locale();if(!this.isValid())return r.invalidDate||l;var i=e||"YYYY-MM-DDTHH:mm:ssZ",n=w.z(this),s=this.$H,o=this.$m,a=this.$M,c=r.weekdays,h=r.months,d=r.meri
21diem,f=function(e,r,n,s){return e&&(e[r]||e(t,i))||n[r].slice(0,s)},p=function(e){return w.s(s%12||12,e,"0")},g=d||function(e,t,r){var i=e<12?"AM":"PM";return r?i.toLowerCase():i};return i.replace(u,function(e,i){return i||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return w.s(t.$y,4,"0");case"M":return a+1;case"MM":return w.s(a+1,2,"0");case"MMM":return f(r.monthsShort,a,h,3);case"MMMM":return f(h,a);case"D":return t.$D;case"DD":return w.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return f(r.weekdaysMin,t.$W,c,2);case"ddd":return f(r.weekdaysShort,t.$W,c,3);case"dddd":return c[t.$W];case"H":return String(s);case"HH":return w.s(s,2,"0");case"h":return p(1);case"hh":return p(2);case"a":return g(s,o,!0);case"A":return g(s,o,!1);case"m":return String(o);case"mm":return w.s(o,2,"0");case"s":return String(t.$s);case"ss":return w.s(t.$s,2,"0");case"SSS":return w.s(t.$ms,3,"0");case"Z":return n}return null}(e)||n.replace(":","")})},f.utcOffset=function(){return-(15*Math.round(this.$d.getTimezoneOffset()/15))},f.diff=function(e,c,l){var h,u=this,d=w.p(c),f=b(e),p=(f.utcOffset()-this.utcOffset())*6e4,g=this-f,m=function(){return w.m(u,f)};switch(d){case a:h=m()/12;break;case s:h=m();break;case o:h=m()/3;break;case n:h=(g-p)/6048e5;break;case"day":h=(g-p)/864e5;break;case i:h=g/36e5;break;case r:h=g/6e4;break;case t:h=g/1e3;break;default:h=g}return l?h:w.a(h)},f.daysInMonth=function(){return this.endOf(s).$D},f.$locale=function(){return p[this.$L]},f.locale=function(e,t){if(!e)return this.$L;var r=this.clone(),i=y(e,t,!0);return i&&(r.$L=i),r},f.clone=function(){return w.w(this.$d,this)},f.toDate=function(){return new Date(this.valueOf())},f.toJSON=function(){return this.isValid()?this.toISOString():null},f.toISOString=function(){return this.$d.toISOString()},f.toString=function(){return this.$d.toUTCString()},d}(),x=v.prototype;return b.prototype=x,[["$ms",e],["$s",t],["$m",r],["$H",i],["$W","day"],["$M",s],["$y",a],["$D",c]].forEach(function(e){x[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),b.extend=function(e,t){return e.$i||(e(t,v,b),e.$i=!0),b},b.locale=y,b.isDayjs=m,b.unix=function(e){return b(1e3*e)},b.en=p[f],b.Ls=p,b.p={},b}()},36202:(e,t,r)=>{"use strict";e.exports=function(e){var t,r,i,n;return t=e.lib.WordArray,i=(r=e.algo).SHA256,n=r.SHA224=i.extend({_doReset:function(){this._hash=new t.init([0xc1059ed8,0x367cd507,0x3070dd17,0xf70e5939,0xffc00b31,0x68581511,0x64f98fa7,0xbefa4fa4])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}}),e.SHA224=i._createHelper(n),e.HmacSHA224=i._createHmacHelper(n),e.SHA224}(r(16611),r(92475))},36452:(e,t,r)=>{"use strict";r.d(t,{AE:()=>n,Ez:()=>o,K3:()=>g,KL:()=>y,Kd:()=>u,PQ:()=>c,Sz:()=>s,UF:()=>f,Y6:()=>a,Y8:()=>l,fk:()=>h,kW:()=>d,m7:()=>i,o7:()=>m,z4:()=>p});class i extends Error{constructor(e,t){super(e),this.error=t}}class n extends i{constructor(){super(...arguments),this.name="WalletNotReadyError"}}class s extends i{constructor(){super(...arguments),this.name="WalletLoadError"}}class o extends i{constructor(){super(...arguments),this.name="WalletConfigError"}}class a extends i{constructor(){super(...arguments),this.name="WalletConnectionError"}}class c extends i{constructor(){super(...arguments),this.name="WalletDisconnectedError"}}class l extends i{constructor(){super(...arguments),this.name="WalletDisconnectionError"}}class h extends i{constructor(){super(...arguments),this.name="WalletAccountError"}}class u extends i{constructor(){super(...arguments),this.name="WalletPublicKeyError"}}class d extends i{constructor(){super(...arguments),this.name="WalletNotConnectedError"}}class f extends i{constructor(){super(...arguments),this.name="WalletSendTransactionError"}}class p extends i{constructor(){super(...arguments),this.name="WalletSignTransactionError"}}class g extends i{constructor(){super(...arguments),this.name="WalletSignMessageError"}}class m extends i{constructor(){super(...arguments),this.name="WalletSignInError"}}class y extends i{constructor(){super(...arguments),this.name="WalletWindowClosedError"}}},38053:(e,t)=>{"use strict";
21Object.defineProperty(t,"__esModule",{value:!0}),t.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let t=this.get(e);if(void 0!==t.elapsed)throw Error(`Watch already stopped for label: ${e}`);let r=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:r})}get(e){let t=this.timestamps.get(e);if(void 0===t)throw Error(`No timestamp found for label: ${e}`);return t}elapsed(e){let t=this.get(e);return t.elapsed||Date.now()-t.started}}t.Watch=r,t.default=r},38530:(e,t,r)=>{"use strict";e.exports=function(e){var t,r,i,n;return r=(t=e.lib).Base,i=t.WordArray,(n=e.x64={}).Word=r.extend({init:function(e,t){this.high=e,this.low=t}}),n.WordArray=r.extend({init:function(e,t){e=this.words=e||[],void 0!=t?this.sigBytes=t:this.sigBytes=8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var s=e[n];r.push(s.high),r.push(s.low)}return i.create(r,this.sigBytes)},clone:function(){for(var e=r.clone.call(this),t=e.words=this.words.slice(0),i=t.length,n=0;n<i;n++)t[n]=t[n].clone();return e}}),e}(r(16611))},40709:(e,t,r)=>{"use strict";var i=r(20920),n=r(64874),s=r(4117),o=r(3285),a=i.sum32,c=i.sum32_4,l=i.sum32_5,h=s.ch32,u=s.maj32,d=s.s0_256,f=s.s1_256,p=s.g0_256,g=s.g1_256,m=n.BlockHash,y=[0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2];function b(){if(!(this instanceof b))return new b;m.call(this),this.h=[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19],this.k=y,this.W=Array(64)}i.inherits(b,m),e.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;
21i++)r[i]=c(g(r[i-2]),r[i-7],p(r[i-15]),r[i-16]);var n=this.h[0],s=this.h[1],m=this.h[2],y=this.h[3],b=this.h[4],w=this.h[5],v=this.h[6],x=this.h[7];for(o(this.k.length===r.length),i=0;i<r.length;i++){var E=l(x,f(b),h(b,w,v),this.k[i],r[i]),_=a(d(n),u(n,s,m));x=v,v=w,w=b,b=a(y,E),y=m,m=s,s=n,n=a(E,_)}this.h[0]=a(this.h[0],n),this.h[1]=a(this.h[1],s),this.h[2]=a(this.h[2],m),this.h[3]=a(this.h[3],y),this.h[4]=a(this.h[4],b),this.h[5]=a(this.h[5],w),this.h[6]=a(this.h[6],v),this.h[7]=a(this.h[7],x)},b.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},40800:(e,t,r)=>{"use strict";r.d(t,{o0:()=>f});var i=r(87358),n=function(e,t,r){if(r||2==arguments.length)for(var i,n=0,s=t.length;n<s;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},s=function(e,t,r){this.name=e,this.version=t,this.os=r,this.type="browser"},o=function(e){this.version=e,this.type="node",this.name="node",this.os=i.platform},a=function(e,t,r,i){this.name=e,this.version=t,this.os=r,this.bot=i,this.type="bot-device"},c=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},l=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},h=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,u=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],d=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function f(e){return e?p(e):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new l:"undefined"!=typeof navigator?p(navigator.userAgent):void 0!==i&&i.version?new o(i.version.slice(1)):null}function p(e){var t=""!==e&&u.reduce(function(t,r){var i=r[0],n=r[1];if(t)return t;var s=n.exec(e);return!!s&&[i,s]},!1);if(!t)return null;var r=t[0],i=t[1];if("searchbot"===r)return new c;var o=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);o?o.length<3&&(o=n(n([],o,!0),function(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}(3-o.length),!0)):o=[];var l=o.join("."),f=function(e){for(var t=0,r=d.length;t<r;t++){var i=d[t],n=i[0];if(i[1].exec(e))return n}return null}(e),p=h.exec(e);return p&&p[1]?new a(r,l,f,p[1]):new s(r,l,f)}},40950:(e,t,r)=>{"use strict";r.d(t,{Ak:()=>c,UT:()=>v,Xf:()=>b,fH:()=>y,hT:()=>m,u0:()=>a});var i=r(5257),n=r(22527);let s=BigInt(0),o=BigInt(1);function a(e,t){let r=t.negate();return e?r:t}function c(e,t){let r=(0,n.pS)(e.Fp,t.map(e=>e.Z));return t.map((t,i)=>e.fromAffine(t.toAffine(r[i])))}function l(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function h(e,t){l(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),s=2**e;return{windows:r,windowSize:n,mask:(0,i.OG)(e),maxNumber:s,shiftBy:BigInt(e)}}function u(e,t,r){let{windowSize:i,mask:n,maxNumber:s,shiftBy:a}=r,c=Number(e&n),l=e>>a;c>i&&(c-=s,l+=o);let h=t*i,u=h+Math.abs(c)-1,d=0===c;return{nextN:l,offset:u,isZero:d,isNeg:c<0,isNegF:t%2!=0,offsetF:h}}let d=new WeakMap,f=new WeakMap;function p(e){return f.get(e)||1}function g(e){if(e!==s)throw Error("invalid wNAF")}class m{constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let i=e;for(;t>s;)t&o&&(r=r.add(i)),i=i.double(),t>>=o;return r}precomputeWindow(e,t){let{windows:r,windowSize:i}=h(t,this.bits),n=[],s=e,o=s;for(let e=0;e<r;e++){o=s,n.push(o);for(let e=1;e<i;e++)o=o.add(s),n.push(o);s=o.double()}return n}wNAF(e,t,r){if(!this.Fn.isValid(r))throw Error("invalid scalar");let i=this.ZERO,n=this.BASE,s=h(e,this.bits);for(let e=0;e<s.windows;e++){let{nextN:o,offset:c,isZero:l,isNeg:h,isNegF:d,offsetF:f}=u(r,e,s);r=o,l?n=n.add(a(d,t[f])):i=i.add(a(h,t[c]))}return g(r),{p:i,f:n}}wNAFUnsafe(e,t,r,i=this.ZERO){let n=h(e,this.bits);for(let e=0;e<n.windows&&r!==s;e++){let{nextN:s,offset:o,isZero:a,isNeg:c}=u(r,e,n);if(r=s,!a){let e=t[o];i=i.add(c?e.negate():e)}}return g(r),i}getPrecomputes(e,t,r){let i=d.get(t);
21return i||(i=this.precomputeWindow(t,e),1!==e&&("function"==typeof r&&(i=r(i)),d.set(t,i))),i}cached(e,t,r){let i=p(e);return this.wNAF(i,this.getPrecomputes(i,e,r),t)}unsafe(e,t,r,i){let n=p(e);return 1===n?this._unsafeLadder(e,t,i):this.wNAFUnsafe(n,this.getPrecomputes(n,e,r),t,i)}createCache(e,t){l(t,this.bits),f.set(e,t),d.delete(e)}hasCache(e){return 1!==p(e)}}function y(e,t,r,i){let n=t,a=e.ZERO,c=e.ZERO;for(;r>s||i>s;)r&o&&(a=a.add(n)),i&o&&(c=c.add(n)),n=n.double(),r>>=o,i>>=o;return{p1:a,p2:c}}function b(e,t,r,n){if(!Array.isArray(r))throw Error("array expected");r.forEach((t,r)=>{if(!(t instanceof e))throw Error("invalid point at index "+r)});if(!Array.isArray(n))throw Error("array of scalars expected");n.forEach((e,r)=>{if(!t.isValid(e))throw Error("invalid scalar at index "+r)});let s=r.length,o=n.length;if(s!==o)throw Error("arrays of points and scalars must have equal length");let a=e.ZERO,c=(0,i.dJ)(BigInt(s)),l=1;c>12?l=c-3:c>4?l=c-2:c>0&&(l=2);let h=(0,i.OG)(l),u=Array(Number(h)+1).fill(a),d=Math.floor((t.BITS-1)/l)*l,f=a;for(let e=d;e>=0;e-=l){u.fill(a);for(let t=0;t<o;t++){let i=Number(n[t]>>BigInt(e)&h);u[i]=u[i].add(r[t])}let t=a;for(let e=u.length-1,r=a;e>0;e--)r=r.add(u[e]),t=t.add(r);if(f=f.add(t),0!==e)for(let e=0;e<l;e++)f=f.double()}return f}function w(e,t,r){if(!t)return(0,n.D0)(e,{isLE:r});if(t.ORDER!==e)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return(0,n.jr)(t),t}function v(e,t,r={},i){if(void 0===i&&(i="edwards"===e),!t||"object"!=typeof t)throw Error(`expected valid ${e} CURVE object`);for(let e of["p","n","h"]){let r=t[e];if(!("bigint"==typeof r&&r>s))throw Error(`CURVE.${e} must be positive bigint`)}let n=w(t.p,r.Fp,i),o=w(t.n,r.Fn,i);for(let r of["Gx","Gy","a","weierstrass"===e?"b":"d"])if(!n.isValid(t[r]))throw Error(`CURVE.${r} must be valid field element of CURVE.Fp`);return{CURVE:t=Object.freeze(Object.assign({},t)),Fp:n,Fn:o}}},41281:(e,t,r)=>{"use strict";let i,n,s,o;r.d(t,{r:()=>tc});var a,c,l,h,u,d,f,p,g,m,y,b,w,v,x,E,_,I,A,S,C=r(45669),N=r(51470),O=r(36452);let P="solana:signIn",T="solana:signMessage",M="solana:signAndSendTransaction",R="solana:signTransaction";var k=r(25223);globalThis.TextDecoder,globalThis.TextEncoder;let D=`(?:\\nURI: (?<uri>[^\\n]+))?(?:\\nVersion: (?<version>[^\\n]+))?(?:\\nChain ID: (?<chainId>[^\\n]+))?(?:\\nNonce: (?<nonce>[^\\n]+))?(?:\\nIssued At: (?<issuedAt>[^\\n]+))?(?:\\nExpiration Time: (?<expirationTime>[^\\n]+))?(?:\\nNot Before: (?<notBefore>[^\\n]+))?(?:\\nRequest ID: (?<requestId>[^\\n]+))?(?:\\nResources:(?<resources>(?:\\n- [^\\n]+)*))?`;RegExp(`^(?<domain>[^\\n]+?) wants you to sign in with your Solana account:\\n(?<address>[^\\n]+)(?:\\n|$)(?:\\n(?<statement>[\\S\\s]*?)(?:\\n|$))??${D}\\n*$`);let L={ERROR_ASSOCIATION_PORT_OUT_OF_RANGE:"ERROR_ASSOCIATION_PORT_OUT_OF_RANGE",ERROR_FORBIDDEN_WALLET_BASE_URL:"ERROR_FORBIDDEN_WALLET_BASE_URL",ERROR_SECURE_CONTEXT_REQUIRED:"ERROR_SECURE_CONTEXT_REQUIRED",ERROR_SESSION_CLOSED:"ERROR_SESSION_CLOSED",ERROR_SESSION_TIMEOUT:"ERROR_SESSION_TIMEOUT",ERROR_WALLET_NOT_FOUND:"ERROR_WALLET_NOT_FOUND",ERROR_INVALID_PROTOCOL_VERSION:"ERROR_INVALID_PROTOCOL_VERSION",ERROR_LOOPBACK_ACCESS_BLOCKED:"ERROR_LOOPBACK_ACCESS_BLOCKED",ERROR_ASSOCIATION_CANCELLED:"ERROR_ASSOCIATION_CANCELLED"};var U=class extends Error{data;code;constructor(...e){let[t,r,i]=e;super(r),this.code=t,this.data=i,this.name="SolanaMobileWalletAdapterError"}},B=class extends Error{data;code;jsonRpcMessageId;constructor(...e){let[t,r,i,n]=e;super(i),this.code=r,this.data=n,this.jsonRpcMessageId=t,this.name="SolanaMobileWalletAdapterProtocolError"}};function j(e,t){let r=window.btoa(String.fromCharCode.call(null,...e));return t?r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):r}function $(e){return new Uint8Array(window.atob(e).split("").map(e=>e.charCodeAt(0)))}async function z(e,t){let r=await crypto.subtle.exportKey("raw",e),i=await crypto.subtle.sign({hash:"SHA-256",name:"ECDSA"},t,r),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(new Uint8Array(r),0),n.set(new Uint8Array(i),r.byteLength),n}let q="solana:cloneAuthorization";async function H(e,t,r){var i,n,s,o;let a=e.domain??window.location.host,c=t.accounts[0].address,l=(o=function(e){let t=`${e.domain} wants you to sign in with your Solana account: 22`;t+=`${e.address}`,e.statement&&(t+=` 23 24${e.statement}`);let r=[];if(e.uri&&r.push(`URI: ${e.uri}
24`),e.version&&r.push(`Version: ${e.version}`),e.chainId&&r.push(`Chain ID: ${e.chainId}`),e.nonce&&r.push(`Nonce: ${e.nonce}`),e.issuedAt&&r.push(`Issued At: ${e.issuedAt}`),e.expirationTime&&r.push(`Expiration Time: ${e.expirationTime}`),e.notBefore&&r.push(`Not Before: ${e.notBefore}`),e.requestId&&r.push(`Request ID: ${e.requestId}`),e.resources)for(let t of(r.push("Resources:"),e.resources))r.push(`- ${t}`);return r.length&&(t+=` 25 26${r.join("\n")}`),t}({...e,domain:a,address:(i=$(c),(n="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Object.freeze({...s={read(e,t){let r=0===t||t<=-e.byteLength?e:e.slice(t);if(0===r.length)return["",0];let i=r.findIndex(e=>0!==e);i=-1===i?r.length:i;let s=n[0].repeat(i);return i===r.length?[s,e.length]:[s+function(e,t){let r=BigInt(t.length),i=[];for(;e>0n;)i.unshift(t[Number(e%r)]),e/=r;return i.join("")}(r.slice(i).reduce((e,t)=>256n*e+BigInt(t),0n),n),e.length]}},decode:(e,t=0)=>s.read(e,t)[0]})).decode(i))}),window.btoa(o)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),h=$((await r("sign_messages",{addresses:[c],payloads:[l]})).signed_payloads[0]),u=j(h.slice(0,h.length-64)),d=j(h.slice(h.length-64));return{address:c,signed_message:0==u.length?l:u,signature:d}}async function F(e,t,r){let i=function(e){if(e>=0x100000000)throw Error("Outbound sequence number overflow. The maximum sequence number is 32-bytes.");let t=new ArrayBuffer(4);return new DataView(t).setUint32(0,e,!1),new Uint8Array(t)}(t),n=new Uint8Array(12);crypto.getRandomValues(n);let s=await crypto.subtle.encrypt(V(i,n),r,new TextEncoder().encode(e)),o=new Uint8Array(i.byteLength+n.byteLength+s.byteLength);return o.set(new Uint8Array(i),0),o.set(new Uint8Array(n),i.byteLength),o.set(new Uint8Array(s),i.byteLength+n.byteLength),o}async function W(e,t){let r=e.slice(0,4),n=e.slice(4,16),s=e.slice(16),o=await crypto.subtle.decrypt(V(r,n),t,s);return(void 0===i&&(i=new TextDecoder("utf-8")),i).decode(o)}function V(e,t){return{additionalData:e,iv:t,name:"AES-GCM",tagLength:128}}async function K(){return await crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign"])}async function G(){return await crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"])}function Y(e){if(e<49152||e>65535)throw new U(L.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE,`Association port number must be between 49152 and 65535. ${e} given.`,{port:e});return e}function J(e){return e.replace(/(^\/+|\/+$)/g,"").split("/")}async function X(e,t,r,i=["v1"]){let n=Y(t),s=function(e){let t="",r=new Uint8Array(e),i=r.byteLength;for(let e=0;e<i;e++)t+=String.fromCharCode(r[e]);return window.btoa(t)}(await crypto.subtle.exportKey("raw",e)),o=function(e,t){let r=null;if(t){try{r=new URL(t)}catch{}if(r?.protocol!=="https:")throw new U(L.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}return r||=new URL("solana-wallet:/"),new URL(e.startsWith("/")?e:[...J(r.pathname),...J(e)].join("/"),r)}("v1/associate/local",r);return o.searchParams.set("association",s.replace(/[/+=]/g,e=>({"/":"_","+":"-","=":"."})[e])),o.searchParams.set("port",`${n}`),i.forEach(e=>{o.searchParams.set("v",e)}),o}async function Q(e,t){return F(JSON.stringify(e),e.id,t)}async function Z(e,t){let r=JSON.parse(await W(e,t));if(Object.hasOwnProperty.call(r,"error"))throw new B(r.id,r.error.code,r.error.message);return r}async function ee(e,t,r){let[i,n]=await Promise.all([crypto.subtle.exportKey("raw",t),crypto.subtle.importKey("raw",e.slice(0,65),{name:"ECDH",namedCurve:"P-256"},!1,[])]),s=await crypto.subtle.deriveBits({name:"ECDH",public:n},r,256),o=await crypto.subtle.importKey("raw",s,"HKDF",!1,["deriveKey"]);return await crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(i),info:new Uint8Array},o,{name:"AES-GCM",length:128},!1,["encrypt","decrypt"])}async function et(e,t){let r=JSON.parse(await W(e,t)),i="legacy";if(Object.hasOwnProperty.call(r,"v"))switch(r.v){case 1:case"1":case"v1":i="v1";break;case"legacy":i="legacy";break;default:throw new U(L.ERROR_INVALID_PROTOCOL_VERSION,`Unknown/unsupported protocol version: ${r.v}`)}return{protocol_version:i}}let er={Firefox:0,Other:1},ei=null;async function en(e){if("https:"===e.protocol)window.location.assign(e);else try{switch(-1!==navigator.userAgent.indexOf("Firefox/")?er.Firefox:er.Other){case er.Firefox:null==ei&&((ei=document.createElement("iframe")).style.display="none",document.body.appendChild(ei)),ei.contentWindow.location.href=e.toString();break;case er.Other:{let t=new Promise((e,t)=>
26{function r(){clearTimeout(n),window.removeEventListener("blur",i)}function i(){r(),e()}window.addEventListener("blur",i);let n=setTimeout(()=>{r(),t()},3e3)});window.location.assign(e),await t}}}catch{throw new U(L.ERROR_WALLET_NOT_FOUND,"Found no installed wallet that supports the mobile wallet protocol.")}}async function es(e,t){let r=Y(49152+Math.floor(16384*Math.random()));return await en(await X(e,r,t)),r}let eo={retryDelayScheduleMs:[150,150,200,500,500,750,750,1e3],timeoutMs:3e4};function ea(e){return new DataView(e).getUint32(0,!1)}async function ec(e){let t,r,i;if("undefined"==typeof window||!0!==window.isSecureContext)throw new U(L.ERROR_SECURE_CONTEXT_REQUIRED,"The mobile wallet adapter protocol must be used in a secure context (`https`).");let n=await K(),s=`ws://localhost:${await es(n.publicKey,e?.baseUri)}/solana-wallet`,o=(()=>{let e=[...eo.retryDelayScheduleMs];return()=>e.length>1?e.shift():e[0]})(),a=1,c=0,l={__type:"disconnected"},h=!1;return{close:()=>{r.close(),i()},wallet:new Promise((e,u)=>{let d,f,p={},g=async()=>{if("connecting"!==l.__type)return void console.warn(`Expected adapter state to be \`connecting\` at the moment the websocket opens. Got \`${l.__type}\`.`);r.removeEventListener("open",g);let{associationKeypair:e}=l,t=await G();r.send(await z(t.publicKey,e.privateKey)),l={__type:"hello_req_sent",associationPublicKey:e.publicKey,ecdhPrivateKey:t.privateKey}},m=e=>{e.wasClean?l={__type:"disconnected"}:u(new U(L.ERROR_SESSION_CLOSED,`The wallet session dropped unexpectedly (${e.code}: ${e.reason}).`,{closeEvent:e})),d()},y=async e=>{d(),Date.now()-t>=eo.timeoutMs?u(new U(L.ERROR_SESSION_TIMEOUT,`Failed to connect to the wallet websocket at ${s}.`)):(await new Promise(e=>{let t=o();f=window.setTimeout(e,t)}),w())},b=async t=>{let i=await t.data.arrayBuffer();switch(l.__type){case"connecting":{if(0!==i.byteLength)throw Error("Encountered unexpected message while connecting");let e=await G();r.send(await z(e.publicKey,n.privateKey)),l={__type:"hello_req_sent",associationPublicKey:n.publicKey,ecdhPrivateKey:e.privateKey};break}case"connected":try{let e=ea(i.slice(0,4));if(e!==c+1)throw Error("Encrypted message has invalid sequence number");c=e;let t=await Z(i,l.sharedSecret),r=p[t.id];delete p[t.id],r.resolve(t.result)}catch(e){if(e instanceof B){let t=p[e.jsonRpcMessageId];delete p[e.jsonRpcMessageId],t.reject(e)}else throw e}break;case"hello_req_sent":{var s,o;if(0===i.byteLength){let e=await G();r.send(await z(e.publicKey,n.privateKey)),l={__type:"hello_req_sent",associationPublicKey:n.publicKey,ecdhPrivateKey:e.privateKey};break}let t=await ee(i,l.associationPublicKey,l.ecdhPrivateKey),d=i.slice(65),f=0!==d.byteLength?await (async()=>{let e=ea(d.slice(0,4));if(e!==c+1)throw Error("Encrypted message has invalid sequence number");return c=e,et(d,t)})():{protocol_version:"legacy"};l={__type:"connected",sharedSecret:t,sessionProperties:f};let g=(s=f.protocol_version,o=async(e,i)=>{let n=a++;return r.send(await Q({id:n,jsonrpc:"2.0",method:e,params:i??{}},t)),new Promise((t,r)=>{p[n]={resolve(i){switch(e){case"authorize":case"reauthorize":{let{wallet_uri_base:e}=i;if(null!=e)try{let t;try{t=new URL(e)}catch{throw new U(L.ERROR_FORBIDDEN_WALLET_BASE_URL,"Invalid base URL supplied by wallet")}if("https:"!==t.protocol)throw new U(L.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}catch(e){r(e);return}}}t(i)},reject:r}})},new Proxy({},{get:(e,t)=>"then"===t?null:(null==e[t]&&(e[t]=async function(e){let{method:r,params:i}=function(e,t,r){let i=t,n=e.toString().replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`).toLowerCase();switch(e){case"authorize":{let e=i,{chain:t}=e;if("legacy"===r){switch(t){case"solana:testnet":t="testnet";break;case"solana:devnet":t="devnet";break;case"solana:mainnet":t="mainnet-beta";break;default:t=e.cluster}e.cluster=t,i=e}else{switch(t){case"testnet":case"devnet":t=`solana:${t}`;break;case"mainnet-beta":t="solana:mainnet"}e.chain=t,i=e}}case"reauthorize":{let{auth_token:e,identity:t}=i;e&&("legacy"===r?(n="reauthorize",i={auth_token:e,identity:t}):n="authorize")}}return{method:n,params:i}}(t,e,s),n=await o(r,i);return"authorize"===r&&i.sign_in_payload&&!n.sign_in_result&&(n.sign_in_result=await H(i.sign_in_payload,n,o)),function(e,t,r){if("getCapabilities"===e)switch(r){case"legacy":{let e=["solana:signTransactions"];return!0===t.supports_clone_authorization&&e.push(q),{...t,features:e}}case"v1":return{...t,supports_sign_and_send_transactions:!0,supports_clone_authorization:t.features.includes(q)}}return t}(t,n,s)}),e[t]),defineProperty:()=>!1,deleteProperty:()=>!1}));h=!0;try{e(g)}catch(e){u(e)}}}};i=()=>{r.removeEventListener("message",b),d(),h||u(new U(L.ERROR_SESSION_CLOSED,"The wallet session was closed before connection.",{closeEvent:ne
26w CloseEvent("socket was closed before connection")}))};let w=()=>{d&&d(),l={__type:"connecting",associationKeypair:n},void 0===t&&(t=Date.now()),(r=new WebSocket(s,["com.solana.mobilewalletadapter.v1"])).addEventListener("open",g),r.addEventListener("close",m),r.addEventListener("error",y),r.addEventListener("message",b),d=()=>{window.clearTimeout(f),r.removeEventListener("open",g),r.removeEventListener("close",m),r.removeEventListener("error",y),r.removeEventListener("message",b)}};w()})}}let el="standard:connect",eh="standard:disconnect",eu="standard:events";var ed=r(8444);r(52769);let ef="solana:mainnet";function ep(e){return window.btoa(String.fromCharCode.call(null,...e))}function eg(e){return new Uint8Array(window.atob(e).split("").map(e=>e.charCodeAt(0)))}let em=` 27<div class="mobile-wallet-adapter-embedded-loading-indicator" role="dialog" aria-modal="true" aria-labelledby="modal-title"> 28 <div data-modal-close style="position: absolute; width: 100%; height: 100%;"></div> 29 <div class="mobile-wallet-adapter-embedded-loading-container"> 30 <div class="mobile-wallet-adapter-embedded-loading-animation"></div> 31 </div> 32</div> 33`,ey=` 34.mobile-wallet-adapter-embedded-loading-indicator { 35 display: flex; /* Use flexbox to center content */ 36 justify-content: center; /* Center horizontally */ 37 align-items: start; /* Center vertically */ 38 position: fixed; /* Stay in place */ 39 z-index: 1; /* Sit on top */ 40 left: 0; 41 top: 0; 42 width: 100%; /* Full width */ 43 height: 100%; /* Full height */ 44 background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ 45 overflow-y: auto; /* enable scrolling */ 46} 47 48.mobile-wallet-adapter-embedded-loading-container { 49 display: flex; 50 margin: auto; 51} 52 53.mobile-wallet-adapter-embedded-loading-animation { 54 position: relative; 55 left: -9999px; 56 width: 10px; 57 height: 10px; 58 border-radius: 5px; 59 background-color: var(--spinner-color); 60 color: var(--spinner-color); 61 box-shadow: 9984px 0 0 0 var(--spinner-color), 62 9999px 0 0 0 var(--spinner-color), 63 10014px 0 0 0 var(--spinner-color); 64 animation: dot-typing 1.5s infinite linear; 65} 66 67@keyframes dot-typing { 68 0% { 69 box-shadow: 9984px 0 0 0 var(--spinner-color), 70 9999px 0 0 0 var(--spinner-color), 71 10014px 0 0 0 var(--spinner-color); 72 } 73 16.667% { 74 box-shadow: 9984px -10px 0 0 var(--spinner-color), 75 9999px 0 0 0 var(--spinner-color), 76 10014px 0 0 0 var(--spinner-color); 77 } 78 33.333% { 79 box-shadow: 9984px 0 0 0 var(--spinner-color), 80 9999px 0 0 0 var(--spinner-color), 81 10014px 0 0 0 var(--spinner-color); 82 } 83 50% { 84 box-shadow: 9984px 0 0 0 var(--spinner-color), 85 9999px -10px 0 0 var(--spinner-color), 86 10014px 0 0 0 var(--spinner-color); 87 } 88 66.667% { 89 box-shadow: 9984px 0 0 0 var(--spinner-color), 90 9999px 0 0 0 var(--spinner-color), 91 10014px 0 0 0 var(--spinner-color); 92 } 93 83.333% { 94 box-shadow: 9984px 0 0 0 var(--spinner-color), 95 9999px 0 0 0 var(--spinner-color), 96 10014px -10px 0 0 var(--spinner-color); 97 } 98 100% { 99 box-shadow: 9984px 0 0 0 var(--spinner-color), 100 9999px 0 0 0 var(--spinner-color), 101 10014px 0 0 0 var(--spinner-color); 102 } 103} 104`;var eb=class{#e=null;#t={};#r=!1;dom=null;constructor(){this.init=this.init.bind(this),this.#e=document.getElementById("mobile-wallet-adapter-embedded-root-ui")}
104async init(){console.log("Injecting modal"),this.#i()}open=()=>{console.debug("Modal open"),this.#n(),this.#e&&(this.#e.style.display="flex")};close=e=>{console.debug("Modal close"),this.#s(),this.#e&&(this.#e.style.display="none"),this.#t.close?.forEach(t=>t(e))};addEventListener(e,t){return this.#t[e]?.push(t)||(this.#t[e]=[t]),()=>this.removeEventListener(e,t)}removeEventListener(e,t){this.#t[e]=this.#t[e]?.filter(e=>t!==e)}#i(){if(this.dom)return;this.#e=document.createElement("div"),this.#e.id="mobile-wallet-adapter-embedded-root-ui",this.#e.innerHTML=em,this.#e.style.display="none";let e=document.createElement("style");e.id="mobile-wallet-adapter-embedded-modal-styles",e.textContent=ey;let t=document.createElement("div");this.dom=t.attachShadow({mode:"closed"}),t.style.setProperty("--spinner-color","#FFFFFF"),this.dom.appendChild(e),this.dom.appendChild(this.#e),document.body.appendChild(t)}#n(){this.#e&&!this.#r&&([...this.#e.querySelectorAll("[data-modal-close]")].forEach(e=>e?.addEventListener("click",e=>{this.close(e)})),window.addEventListener("load",this.close),document.addEventListener("keydown",this.#o),this.#r=!0)}#s(){this.#r&&(window.removeEventListener("load",this.close),document.removeEventListener("keydown",this.#o),this.#e&&([...this.#e.querySelectorAll("[data-modal-close]")].forEach(e=>e?.removeEventListener("click",this.close)),this.#r=!1))}#o=e=>{"Escape"===e.key&&this.close(e)}};let ew=` 105<div class="mobile-wallet-adapter-embedded-modal-container" role="dialog" aria-modal="true" aria-labelledby="modal-title"> 106 <div data-modal-close style="position: absolute; width: 100%; height: 100%;"></div> 107 <div class="mobile-wallet-adapter-embedded-modal-card"> 108 <div> 109 <button data-modal-close class="mobile-wallet-adapter-embedded-modal-close"> 110 <svg width="14" height="14"> 111 <path d="M 6.7125,8.3036995 1.9082,13.108199 c -0.2113,0.2112 -0.4765,0.3168 -0.7957,0.3168 -0.3192,0 -0.5844,-0.1056 -0.7958,-0.3168 C 0.1056,12.896899 0,12.631699 0,12.312499 c 0,-0.3192 0.1056,-0.5844 0.3167,-0.7958 L 5.1212,6.7124995 0.3167,1.9082 C 0.1056,1.6969 0,1.4317 0,1.1125 0,0.7933 0.1056,0.5281 0.3167,0.3167 0.5281,0.1056 0.7933,0 1.1125,0 1.4317,0 1.6969,0.1056 1.9082,0.3167 L 6.7125,5.1212 11.5167,0.3167 C 11.7281,0.1056 11.9933,0 12.3125,0 c 0.3192,0 0.5844,0.1056 0.7957,0.3167 0.2112,0.2114 0.3168,0.4766 0.3168,0.7958 0,0.3192 -0.1056,0.5844 -0.3168,0.7957 L 8.3037001,6.7124995 13.1082,11.516699 c 0.2112,0.2114 0.3168,0.4766 0.3168,0.7958 0,0.3192 -0.1056,0.5844 -0.3168,0.7957 -0.2113,0.2112 -0.4765,0.3168 -0.7957,0.3168 -0.3192,0 -0.5844,-0.1056 -0.7958,-0.3168 z" /> 112 </svg> 113 </button> 114 </div> 115 <div class="mobile-wallet-adapter-embedded-modal-content"></div> 116 </div> 117</div> 118`,ev=` 119.mobile-wallet-adapter-embedded-modal-container { 120 display: flex; /* Use flexbox to center content */ 121 justify-content: center; /* Center horizontally */ 122 align-items: center; /* Center vertically */ 123 position: fixed; /* Stay in place */ 124 z-index: 2147483647; /* Sit on top */ 125 left: 0; 126 top: 0; 127 width: 100%; /* Full width */ 128 height: 100%; /* Full height */ 129 background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ 130 overflow-y: auto; /* enable scrolling */ 131} 132 133.mobile-wallet-adapter-embedded-modal-card { 134 display: flex; 135 flex-direction: column; 136 margin: auto 20px; 137 max-width: 780px; 138 padding: 20px; 139 border-radius: 24px; 140 background: #ffffff; 141 font-family: "Inter Tight", "PT Sans", Calibri, sans-serif; 142 transform: translateY(-200%); 143 animation: slide-in 0.5s forwards; 144} 145 146@keyframes slide-in { 147 100% { transform: translateY(0%); } 148} 149 150.mobile-wallet-adapter-embedded-modal-close { 151 display: flex; 152 align-items: center; 153 justify-content: center; 154 width: 32px; 155 height: 32px; 156 cursor: pointer; 157 background: #e4e9e9; 158 border: none; 159 border-radius: 50%; 160} 161 162.mobile-wallet-adapter-embedded-modal-close:focus-visible { 163 outline-color: red; 164} 165 166.mobile-wallet-adapter-embedded-modal-close svg { 167 fill: #546266; 168 transition: fill 200ms ease 0s; 169} 170
171.mobile-wallet-adapter-embedded-modal-close:hover svg { 172 fill: #fff; 173} 174`,ex=` 175<link rel="preconnect" href="https://fonts.googleapis.com"> 176<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> 177<link href="https://fonts.googleapis.com/css2?family=Inter+Tight:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet"> 178`;var eE=class{#e=null;#t={};#r=!1;dom=null;constructor(){this.init=this.init.bind(this),this.#e=document.getElementById("mobile-wallet-adapter-embedded-root-ui")}async init(){console.log("Injecting modal"),this.#i()}open=()=>{console.debug("Modal open"),this.#n(),this.#e&&(this.#e.style.display="flex")};close=e=>{console.debug("Modal close"),this.#s(),this.#e&&(this.#e.style.display="none"),this.#t.close?.forEach(t=>t(e))};addEventListener(e,t){return this.#t[e]?.push(t)||(this.#t[e]=[t]),()=>this.removeEventListener(e,t)}removeEventListener(e,t){this.#t[e]=this.#t[e]?.filter(e=>t!==e)}#i(){if(document.getElementById("mobile-wallet-adapter-embedded-root-ui")){this.#e||(this.#e=document.getElementById("mobile-wallet-adapter-embedded-root-ui"));return}this.#e=document.createElement("div"),this.#e.id="mobile-wallet-adapter-embedded-root-ui",this.#e.innerHTML=ew,this.#e.style.display="none";let e=this.#e.querySelector(".mobile-wallet-adapter-embedded-modal-content");e&&(e.innerHTML=this.contentHtml);let t=document.createElement("style");t.id="mobile-wallet-adapter-embedded-modal-styles",t.textContent=ev+this.contentStyles;let r=document.createElement("div");r.innerHTML=ex,this.dom=r.attachShadow({mode:"closed"}),this.dom.appendChild(t),this.dom.appendChild(this.#e),document.body.appendChild(r)}#n(){this.#e&&!this.#r&&([...this.#e.querySelectorAll("[data-modal-close]")].forEach(e=>e?.addEventListener("click",this.close)),window.addEventListener("load",this.close),document.addEventListener("keydown",this.#o),this.#r=!0)}#s(){this.#r&&(window.removeEventListener("load",this.close),document.removeEventListener("keydown",this.#o),this.#e&&([...this.#e.querySelectorAll("[data-modal-close]")].forEach(e=>e?.removeEventListener("click",this.close)),this.#r=!1))}#o=e=>{"Escape"===e.key&&this.close(e)}},e_=class extends eE{contentStyles=eA;contentHtml=eI;initWithCallback(e){super.init(),this.#a(e)}#a(e){let t=this.dom?.getElementById("mobile-wallet-adapter-launch-action"),r=async()=>{t?.removeEventListener("click",r),this.close(),e()};t?.addEventListener("click",r)}};let eI=` 179<svg class="mobile-wallet-adapter-embedded-modal-launch-icon" width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"> 180 <path d="M21.6 48C7.2 48 0 40.8 0 26.4V21.6C0 7.2 7.2 0 21.6 0H26.4C40.8 0 48 7.2 48 21.6V26.4C48 40.8 40.8 48 26.4 48H21.6Z" fill="#15994E"/> 181 <mask id="mask0_189_522" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="8" y="8" width="32" height="32"> 182 <rect x="8" y="8" width="32" height="32" fill="#D9D9D9"/> 183 </mask> 184 <g mask="url(#mask0_189_522)"> 185 <mask id="mask1_189_522" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="8" y="8" width="32" height="32"> 186 <rect x="8" y="8" width="32" height="32" fill="#D9D9D9"/> 187 </mask> 188 <g mask="url(#mask1_189_522)"> 189 <path d="M22.1092 26.1208L19.4498 23.4615C19.1736 23.1851 18.8253 23.0468 18.4048 23.0468C17.9846 23.0468 17.6363 23.1851 17.3598 23.4615C17.0836 23.7377 16.9468 24.0861 16.9495 24.5065C16.9522 24.9267 17.0916 25.275 17.3678 25.5512L21.0405 29.2238C21.3463 29.5276 21.7031 29.6795 22.1108 29.6795C22.5184 29.6795 22.8742 29.5276 23.1782 29.2238L30.5918 21.8098C30.8683 21.5336 31.0065 21.1867 31.0065 20.7692C31.0065 20.3514 30.8683 20.0044 30.5918 19.7282C30.3156 19.4517 29.9673 19.3135 29.5468 19.3135C29.1266 19.3135 28.7784 19.4517 28.5022 19.7282L22.1092 26.1208ZM23.9998 37.6042C22.113 37.6042 20.3425 37.2473 18.6885 36.5335C17.0343 35.8197 15.5954 34.8512 14.3718 33.6278C13.1485 32.4043 12.18 30.9654 11.4662 29.3112C10.7524 27.6572 10.3955 25.8867 10.3955 23.9998C10.3955 22.113 10.7524 20.3425 11.4662 18.6885C12.18 17.0343 13.1485 15.5954 14.3718 14.3718C15.5954 13.1485 17.0343 12.18 18.6885 11.4662C20.3425 10.7524 22.113 10.3955 23.9998 10.3955C25.8867 10.3955 27.6572 10.7524 29.3112 11.4662C30.9654 12.18 32.4043 13.1485 33.6278 14.3718C34.8512 15.5954 35.8197 17.0343 36.5335 18.6885C37.2473 20.3425 37.6042 22.113 37.6042 23.9998C37.6042 25.8867 37.2473 27.6572 36.5335 29.3112C35.8197 30.9654 34.8512 32.4043 33.6278 33.6278C32.4043 34.8512 30.9654 35.8197 29.3112 36.5335C27.6572 37.2473 25.8867 37.6042 23.9998 37.6042Z" fill="white"/> 190 </g> 191 </g> 192</svg> 193<div class="mobile-wallet-adapter-embedded-modal-title">Ready to connect!</div> 194<div> 195 <button data-modal-action id="mobile-wallet-adapter-launch-action" class="mobile-wallet-adapter-embedded-modal-launch-action"> 196 Connect Wallet 197 </button> 198</div> 199`,eA=` 200.mobile-wallet-adapter-embedded-modal-close { 201 display: none; 202} 203.mobile-wallet-adapter-embedded-modal-content { 204 text-align: center; 205 min-width: 300px; 206} 207.mobile-wallet-adapter-embedded-modal-launch-icon { 208 margin-top: 24px; 209} 210.mobile-wallet-adapter-embedded-modal-title { 211 margin: 18px 100px 30px 100px; 212 color: #000000;
213 font-size: 2.75em; 214 font-weight: 600; 215} 216.mobile-wallet-adapter-embedded-modal-launch-action { 217 display: block; 218 width: 100%; 219 height: 56px; 220 font-size: 1.25em; 221 background: #000000; 222 color: #FFFFFF; 223 border-radius: 18px; 224} 225/* Smaller screens */ 226@media all and (max-width: 600px) { 227 .mobile-wallet-adapter-embedded-modal-title { 228 font-size: 1.5em; 229 margin-right: 12px; 230 margin-left: 12px; 231 } 232} 233`;var eS=class extends eE{contentStyles=eN;get contentHtml(){let e=!function(){let e="undefined"!=typeof document&&document.referrer.startsWith("android-app://");if("undefined"==typeof window)return e;let t=window.matchMedia("(display-mode: standalone)").matches,r=window.matchMedia("(display-mode: fullscreen)").matches,i=window.matchMedia("(display-mode: minimal-ui)").matches;return e||t||r||i}()?"Tap the lock or settings icon in the address bar to open site settings":"Long press the app icon on your home screen to open site settings";return eC.replace("{{PERMISSION_INSTRUCTION_DETAIL}}",e)}
233async init(){super.init(),this.#a()}#a(){let e=this.dom?.getElementById("mobile-wallet-adapter-launch-action"),t=async r=>{e?.removeEventListener("click",t),this.close(r)};e?.addEventListener("click",t)}};let eC=` 234<div class="mobile-wallet-adapter-embedded-modal-header"> 235 Local Wallet Connection 236</div> 237<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"> 238 <path d="M21.6 48C7.2 48 0 40.8 0 26.4V21.6C0 7.2 7.2 0 21.6 0H26.4C40.8 0 48 7.2 48 21.6V26.4C48 40.8 40.8 48 26.4 48H21.6Z" fill="#ED1515"/> 239 <mask id="mask0_147_1364" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="8" y="8" width="32" height="32"> 240 <rect x="8" y="8" width="32" height="32" fill="#D9D9D9"/> 241 </mask> 242 <g mask="url(#mask0_147_1364)"> 243 <path d="M20.1398 36.2705C19.7363 36.2705 19.3508 36.1945 18.9835 36.0425C18.6162 35.8907 18.2916 35.674 18.0098 35.3922L12.6072 29.9895C12.3254 29.7077 12.1086 29.3832 11.9568 29.0158C11.8048 28.6485 11.7288 28.2631 11.7288 27.8595V20.1395C11.7288 19.736 11.8048 19.3505 11.9568 18.9832C12.1086 18.6158 12.3254 18.2913 12.6072 18.0095L18.0098 12.6068C18.2916 12.3251 18.6162 12.1083 18.9835 11.9565C19.3508 11.8045 19.7363 11.7285 20.1398 11.7285H27.8598C28.2634 11.7285 28.6488 11.8045 29.0162 11.9565C29.3835 12.1083 29.708 12.3251 29.9898 12.6068L35.3925 18.0095C35.6743 18.2913 35.891 18.6158 36.0428 18.9832C36.1948 19.3505 36.2708 19.736 36.2708 20.1395V27.8595C36.2708 28.2631 36.1948 28.6485 36.0428 29.0158C35.891 29.3832 35.6743 29.7077 35.3925 29.9895L29.9898 35.3922C29.708 35.674 29.3835 35.8907 29.0162 36.0425C28.6488 36.1945 28.2634 36.2705 27.8598 36.2705H20.1398ZM20.1732 33.2372H27.8265L33.2375 27.8262V20.1728L27.8265 14.7618H20.1732L14.7622 20.1728V27.8262L20.1732 33.2372ZM23.9998 25.9538L26.7868 28.7408C27.0473 29.0013 27.3729 29.1302 27.7638 29.1275C28.1549 29.1248 28.4807 28.9933 28.7412 28.7328C29.0016 28.4724 29.1318 28.1466 29.1318 27.7555C29.1318 27.3646 29.0016 27.039 28.7412 26.7785L25.9542 23.9995L28.7412 21.2125C29.0016 20.9521 29.1318 20.6264 29.1318 20.2355C29.1318 19.8444 29.0016 19.5186 28.7412 19.2582C28.4807 18.9977 28.1549 18.8675 27.7638 18.8675C27.3729 18.8675 27.0473 18.9977 26.7868 19.2582L23.9998 22.0452L21.2128 19.2582C20.9524 18.9977 20.628 18.8675 20.2398 18.8675C19.8514 18.8675 19.5269 18.9977 19.2665 19.2582C19.006 19.5186 18.8758 19.8444 18.8758 20.2355C18.8758 20.6264 19.006 20.9521 19.2665 21.2125L22.0455 23.9995L19.2585 26.7865C18.998 27.047 18.8692 27.3713 18.8718 27.7595C18.8745 28.148 19.006 28.4724 19.2665 28.7328C19.5269 28.9933 19.8527 29.1235 20.2438 29.1235C20.6347 29.1235 20.9604 28.9933 21.2208 28.7328L23.9998 25.9538Z" fill="black"/> 244 </g> 245</svg> 246<div class="mobile-wallet-adapter-embedded-modal-title"> 247 Your wallet connection is blocked 248</div> 249<div id="mobile-wallet-adapter-local-launch-message" class="mobile-wallet-adapter-embedded-modal-subtitle"> 250 Visit site settings in the address bar and allow "Apps on Device". 251</div> 252 253<div class="mobile-wallet-adapter-embedded-modal-divider"><hr></div> 254<div class="mobile-wallet-adapter-embedded-modal-footer"> 255 <div class="mobile-wallet-adapter-embedded-modal-details"> 256 <!-- Clickable header (label associated with the checkbox) --> 257 <label for="collapsible-1" class="mobile-wallet-adapter-embedded-modal-details-collapsible-header"> 258 <!-- Hidden checkbox to track state --> 259 <input type="checkbox" id="collapsible-1" class="mobile-wallet-adapter-embedded-modal-details-collapsible-input"> 260 <span class="mobile-wallet-adapter-embedded-modal-details-collapsible-header-label"> 261 See details 262 </span> 263 <svg class="mobile-wallet-adapter-embedded-modal-details-collapsible-header-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> 264 <mask id="mask0_147_1382" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="24" height="24"> 265 <rect width="24" height="24" fill="#D9D9D9"/> 266 </mask> 267 <g mask="url(#mask0_147_1382)"> 268 <path d="M11.9999 17.0811C11.8506 17.0811 11.7087 17.0563 11.5741 17.0067C11.4395 16.957 11.3162 16.8762 11.2042 16.7643L6.57924 12.1393C6.36801 11.9281 6.26656 11.66
2687 6.27489 11.3561C6.28322 11.0453 6.39301 10.7842 6.60424 10.573C6.81547 10.3618 7.08069 10.2561 7.39989 10.2561C7.71909 10.2561 7.9843 10.3618 8.19554 10.573L11.9999 14.3773L15.8292 10.548C16.0405 10.3368 16.3015 10.2353 16.6124 10.2436C16.9233 10.252 17.1843 10.3618 17.3955 10.573C17.6068 10.7842 17.7124 11.0494 17.7124 11.3686C17.7124 11.6878 17.6068 11.9531 17.3955 12.1643L12.7955 16.7643C12.6836 16.8762 12.5603 16.957 12.4257 17.0067C12.2911 17.0563 12.1492 17.0811 11.9999 17.0811Z" fill="black"/> 269 </g> 270 </svg> 271 </label> 272 273 <!-- Content to show/hide --> 274 <ul class="mobile-wallet-adapter-embedded-modal-details-collapsible-content"> 275 <li>{{PERMISSION_INSTRUCTION_DETAIL}}</li> 276 <li>Allow "Apps on Device"</li> 277 </ul> 278 </div> 279</div> 280<div> 281 <button data-modal-action id="mobile-wallet-adapter-launch-action" class="mobile-wallet-adapter-embedded-modal-launch-action"> 282 Got it 283 </button> 284</div> 285`,eN=` 286.mobile-wallet-adapter-embedded-modal-close { 287 display: none; 288} 289.mobile-wallet-adapter-embedded-modal-content { 290 text-align: center; 291} 292.mobile-wallet-adapter-embedded-modal-header { 293 margin: 18px auto 30px auto; 294 color: #7D9093; 295 font-size: 1.0em; 296 font-weight: 500; 297} 298.mobile-wallet-adapter-embedded-modal-title { 299 margin: 18px 100px auto 100px; 300 color: #000000; 301 font-size: 2.75em; 302 font-weight: 600; 303} 304.mobile-wallet-adapter-embedded-modal-subtitle { 305 margin: 12px 60px 30px 60px; 306 color: #7D9093; 307 font-size: 1.25em; 308 font-weight: 400; 309} 310.mobile-wallet-adapter-embedded-modal-details-collapsible-header { 311 display: flex; 312 flex-direction: row; 313 justify-content: space-between; 314 margin: 10px auto 10px auto; 315 color: #000000; 316 font-size: 1.5em; 317 font-weight: 600; 318 cursor: pointer; /* Show pointer on hover */ 319 transition: background 0.2s ease; /* Smooth background change */ 320} 321.mobile-wallet-adapter-embedded-modal-details-collapsible-header-icon { 322 transition: rotate 0.3s ease; 323} 324.mobile-wallet-adapter-embedded-modal-details-collapsible-input { 325 display: none; /* Hide the checkbox */ 326} 327.mobile-wallet-adapter-embedded-modal-details-collapsible-content { 328 margin: 0px auto 40px auto; 329 max-height: 0px; /* Collapse content */ 330 overflow: hidden; /* Hide overflow when collapsed */ 331 transition: max-height 0.3s ease; /* Smooth transition */ 332} 333.mobile-wallet-adapter-embedded-modal-details-collapsible-content li { 334 margin: 20px auto; 335 color: #000000; 336 font-size: 1.25em; 337 font-weight: 400; 338 text-align: left; 339} 340/* When checkbox is checked, show content */ 341.mobile-wallet-adapter-embedded-modal-details-collapsible-header:has(> input:checked) ~ .mobile-wallet-adapter-embedded-modal-details-collapsible-content { 342 max-height: 300px; 343} 344.mobile-wallet-adapter-embedded-modal-details-collapsible-header:has(> input:checked) > .mobile-wallet-adapter-embedded-modal-details-collapsible-header-icon { 345 rotate: 180deg; 346} 347.mobile-wallet-adapter-embedded-modal-launch-action { 348 display: block; 349 width: 100%; 350 height: 56px; 351 /*margin-top: 40px;*/ 352 font-size: 1.25em; 353 /*line-height: 24px;*/ 354 /*letter-spacing: -1%;*/ 355 background: #000000; 356 color: #FFFFFF; 357 border-radius: 18px; 358} 359/* Smaller screens */ 360@media all and (max-width: 600px) { 361 .mobile-wallet-adapter-embedded-modal-title { 362 font-size: 1.75em; 363 margin-right: 12px; 364 margin-left: 12px; 365 } 366 .mobile-wallet-adapter-embedded-modal-subtitle { 367 margin-right: 12px; 368 margin-left: 12px; 369 } 370} 371`;var eO=class extends eE{contentStyles=eT;contentHtml=eP;async init(){super.init(),this.#a()}#a(){let e=this.dom?.getElementById("mobile-wallet-adapter-launch-action"),t=async()=>{e?.removeEventListener("click",t);try{await fetch("http://localhost")}catch{}this.close()};e?.addEventListener("click",t)}};let eP=` 372<div class="mobile-wallet-adapter-embedded-modal-title">Allow connections to your wallet</div> 373<div id="mobile-wallet-adapter-local-launch-message" class="mobile-wallet-adapter-embedded-modal-subtitle"> 374 Tap "Allow" on the next screen 375</div> 376<svg class="mobile-wallet-adapter-embedded-modal-permission-prompt-mock" xmlns="http://www.w3.org/2000/svg" width="281" height="83" viewBox="0 0 281 83" fill="none"> 377 <rect width="281" height="83" rx="22" fill="#F0F3F5"/> 378 <path d="M254.194 64L252.626 56.657H254.047L254.866 61.452L254.985 62.278H255.02L255.146 61.452L255.993 57.497H257.4L258.254 61.431L258.373 62.278H258.415L258.534 61.431L259.346 56.657H260.718L259.143 64H257.673L256.826 59.961L256.693 59.093H256.651L256.511 59.961L255.664 64H254.194Z" fill="black"/> 379 <path d="M248.837 64.231C248.147 64.231 247.54 64.07 247.017 63.748C246.495 63.426 246.086 62.978 245.792 62.404C245.498 61.83 245.351 61.1673 245.351 60.416V60.241C245.351 59.4897 245.498 58.827 245.792 58.253C246.086 57.679 246.495 57.2333 247.017 56.916C247.54 56.594 248.147 56.433 248.837 56.433C249.528 56.433 250.135 56.594 250.657 56.916C251.18 5
3797.2333 251.588 57.679 251.882 58.253C252.176 58.827 252.323 59.4897 252.323 60.241V60.416C252.323 61.1673 252.176 61.83 251.882 62.404C251.588 62.978 251.18 63.426 250.657 63.748C250.135 64.07 249.528 64.231 248.837 64.231ZM248.837 62.824C249.43 62.824 249.897 62.607 250.237 62.173C250.583 61.7343 250.755 61.1417 250.755 60.395V60.262C250.755 59.5107 250.583 58.918 250.237 58.484C249.897 58.05 249.43 57.833 248.837 57.833C248.249 57.833 247.783 58.05 247.437 58.484C247.092 58.918 246.919 59.5107 246.919 60.262V60.395C246.919 61.1417 247.092 61.7343 247.437 62.173C247.783 62.607 248.249 62.824 248.837 62.824Z" fill="black"/> 380 <path d="M242.298 64.231C241.467 64.231 240.814 63.993 240.338 63.517C239.866 63.0364 239.631 62.3737 239.631 61.529V53.78H241.178V61.389C241.178 62.3317 241.591 62.803 242.417 62.803C242.65 62.803 242.865 62.7587 243.061 62.67C243.257 62.5814 243.464 62.4367 243.684 62.236L244.538 63.377C244.225 63.6664 243.884 63.881 243.516 64.021C243.152 64.161 242.746 64.231 242.298 64.231ZM237.51 55.061V53.78H240.611V55.061H237.51Z" fill="black"/> 381 <path d="M234.463 64.231C233.633 64.231 232.979 63.993 232.503 63.517C232.032 63.0364 231.796 62.3737 231.796 61.529V53.78H233.343V61.389C233.343 62.3317 233.756 62.803 234.582 62.803C234.816 62.803 235.03 62.7587 235.226 62.67C235.422 62.5814 235.63 62.4367 235.849 62.236L236.703 63.377C236.391 63.6664 236.05 63.881 235.681 64.021C235.317 64.161 234.911 64.231 234.463 64.231ZM229.675 55.061V53.78H232.776V55.061H229.675Z" fill="black"/> 382 <path d="M221.442 64L224.557 53.976H226.132L229.233 64H227.581L225.642 56.972L225.341 55.761H225.299L225.005 56.972L223.073 64H221.442ZM222.835 61.634L223.255 60.29H227.371L227.805 61.634H222.835Z" fill="black"/> 383 <path d="M178.261 64L175.034 60.066V60.024L178.121 56.657H180.011L176.504 60.423V59.632L180.165 64H178.261ZM173.543 64V53.78H175.097V64H173.543Z" fill="#7D9093" fill-opacity="0.5"/> 384 <path d="M169.306 64.224C168.588 64.224 167.958 64.0653 167.416 63.748C166.88 63.426 166.462 62.9803 166.163 62.411C165.865 61.837 165.715 61.1673 165.715 60.402V60.248C165.715 59.4873 165.862 58.8223 166.156 58.253C166.45 57.679 166.863 57.2333 167.395 56.916C167.927 56.594 168.546 56.433 169.25 56.433C169.978 56.433 170.59 56.6056 171.084 56.951C171.579 57.2917 171.955 57.777 172.211 58.407L170.874 58.995C170.72 58.6123 170.508 58.323 170.237 58.127C169.967 57.9263 169.633 57.826 169.236 57.826C168.63 57.826 168.149 58.0383 167.794 58.463C167.444 58.883 167.269 59.4616 167.269 60.199V60.465C167.269 61.1837 167.454 61.7577 167.822 62.187C168.196 62.6163 168.69 62.831 169.306 62.831C169.712 62.831 170.06 62.733 170.349 62.537C170.639 62.341 170.877 62.0423 171.063 61.641L172.379 62.285C172.188 62.6957 171.941 63.0457 171.637 63.335C171.334 63.6243 170.986 63.846 170.594 64C170.202 64.1493 169.773 64.224 169.306 64.224Z" fill="#7D9093" fill-opacity="0.5"/> 385 <path d="M161.003 64.231C160.312 64.231 159.706 64.07 159.183 63.748C158.66 63.426 158.252 62.978 157.958 62.404C157.664 61.83 157.517 61.1673 157.517 60.416V60.241C157.517 59.4897 157.664 58.827 157.958 58.253C158.252 57.679 158.66 57.2333 159.183 56.916C159.706 56.594 160.312 56.433 161.003 56.433C161.694 56.433 162.3 56.594 162.823 56.916C163.346 57.2333 163.754 57.679 164.048 58.253C164.342 58.827 164.489 59.4897 164.489 60.241V60.416C164.489 61.1673 164.342 61.83 164.048 62.404C163.754 62.978 163.346 63.426 162.823 63.748C162.3 64.07 161.694 64.231 161.003 64.231ZM161.003 62.824C161.596 62.824 162.062 62.607 162.403 62.173C162.748 61.7343 162.921 61.1417 162.921 60.395V60.262C162.921 59.5107 162.748 58.918 162.403 58.484C162.062 58.05 161.596 57.833 161.003 57.833C160.415 57.833 159.948 58.05 159.603 58.484C159.258 58.918 159.085 59.5107 159.085 60.262V60.395C159.085 61.1417 159.258 61.7343 159.603 62.173C159.948 62.607 160.415 62.824 161.003 62.824Z" fill="#7D9093" fill-opacity="0.5"/> 386 <path d="M154.463 64.231C153.633 64.231 152.979 63.993 152.503 63.517C152.032 63.0364 151.796 62.3737 151.796 61.529V53.78H153.343V61.389C153.343 62.3317 153.756 62.803 154.582 62.803C154.816 62.803 155.03 62.7587 155.226 62.67C155.422 62.5814 155.63 62.4367 155.849 62.236L156.703 63.377C156.391 63.6664 156.05 63.881 155.681 64.021C155.317 64.161 154.911 64.231 154.463 64.231ZM149.675 55.061V53.78H152.776V55.061H149.675Z" fill="#7D9093" fill-opacity="0.5"/> 387 <path d="M142.24 64V53.976H145.544C146.421 53.976 147.112 54.1953 147.616 54.634C148.12 55.0726 148.372 55.6583 148.372 56.391V56.566C148.372 57.0886 148.246 57.5366 147.994 57.91C147.742 58.2833 147.38 58.5586 146.909 58.736V58.792C147.492 58.9226 147.947 59.2003 148.274 59.625C148.605 60.045 148.771 60.5606 148.771 61.172V61.361C148.771 61.893 148.645 62.3573 148.393 62.754C148.145 63.1506 147.795 63.4586 147.343 63.678C146.895 63.8926 146.365 64 145.754 64H142.24ZM143.794 62.656H145.5
38772C146.085 62.656 146.482 62.5253 146.762 62.264C147.042 62.0026 147.182 61.6293 147.182 61.144V60.99C147.182 60.5046 147.037 60.1313 146.748 59.87C146.463 59.604 146.05 59.471 145.509 59.471H143.36V58.183H145.32C145.791 58.183 146.153 58.064 146.405 57.826C146.657 57.588 146.783 57.2496 146.783 56.811V56.685C146.783 56.2416 146.657 55.9033 146.405 55.67C146.157 55.4366 145.796 55.32 145.32 55.32H143.794V62.656Z" fill="#7D9093" fill-opacity="0.5"/> 388 <rect x="18" y="17" width="246" height="7" rx="3.5" fill="#7D9093" fill-opacity="0.26"/> 389 <rect x="18" y="33" width="82" height="7" rx="3.5" fill="#7D9093" fill-opacity="0.26"/> 390</svg> 391<div> 392 <button data-modal-action id="mobile-wallet-adapter-launch-action" class="mobile-wallet-adapter-embedded-modal-launch-action"> 393 Continue to Allow 394 </button> 395</div> 396`,eT=` 397.mobile-wallet-adapter-embedded-modal-close { 398 display: none; 399} 400.mobile-wallet-adapter-embedded-modal-content { 401 text-align: center; 402} 403.mobile-wallet-adapter-embedded-modal-title { 404 margin: 18px 100px auto 100px; 405 color: #000000; 406 font-size: 2.75em; 407 font-weight: 600; 408} 409.mobile-wallet-adapter-embedded-modal-subtitle { 410 margin: 20px 60px 40px 60px; 411 color: #7D9093; 412 font-size: 1.25em; 413 font-weight: 400; 414} 415.mobile-wallet-adapter-embedded-modal-permission-prompt-mock { 416 width: 90%; 417 height: auto; 418 margin: 0 auto 30px auto; 419 display: block; 420} 421.mobile-wallet-adapter-embedded-modal-launch-action { 422 display: block; 423 width: 100%; 424 height: 56px; 425 font-size: 1.25em; 426 background: #000000; 427 color: #FFFFFF; 428 border-radius: 18px; 429} 430/* Smaller screens */ 431@media all and (max-width: 600px) { 432 .mobile-wallet-adapter-embedded-modal-title { 433 font-size: 1.5em; 434 margin-right: 12px; 435 margin-left: 12px; 436 } 437 .mobile-wallet-adapter-embedded-modal-subtitle { 438 margin-right: 12px; 439 margin-left: 12px; 440 } 441} 442`;async function eM(){if(!("undefined"!=typeof navigator&&navigator.userAgent.includes("Solana Mobile Web Shell")))try{let e=await navigator.permissions.query({name:"loopback-network"});if("granted"===e.state)return;if("denied"===e.state){let e=new eS;throw e.init(),e.open(),new U(L.ERROR_LOOPBACK_ACCESS_BLOCKED,"Local Network Access permission denied")}if("prompt"===e.state){let t=new eO;if(await new Promise((r,i)=>{t.addEventListener("close",e=>{e&&i(new U(L.ERROR_ASSOCIATION_CANCELLED,"Wallet connection cancelled by user",{event:e}))}),e.onchange=()=>{e.onchange=null,r(e.state)},t.init(),t.open()})!=="granted")return await eM();{let e=new e_;await new Promise((t,r)=>{e.addEventListener("close",e=>{e&&r(new U(L.ERROR_ASSOCIATION_CANCELLED,"Wallet connection cancelled by user",{event:e}))}),e.initWithCallback(async()=>{t(!0)}),e.open()});return}}throw new U(L.ERROR_LOOPBACK_ACCESS_BLOCKED,"Local Network Access permission unknown")}catch(e){if(e instanceof TypeError&&(e.message.includes("loopback-network")||e.message.includes("local-network-access")))return;if(e instanceof U)throw e;throw new U(L.ERROR_LOOPBACK_ACCESS_BLOCKED,e instanceof Error?e.message:"Local Network Access permission unknown")}}let eR="Mobile Wallet Adapter",ek=[M,R,T,P];function eD(e){return e instanceof Error?e.message:"Unknown error"}var eL=class{#c={};#l="1.0.0";#h=eR;#u="https://solanamobile.com/wallets";#d="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik03IDIuNUgxN0MxNy44Mjg0IDIuNSAxOC41IDMuMTcxNTcgMTguNSA0VjIwQzE4LjUgMjAuODI4NCAxNy44Mjg0IDIxLjUgMTcgMjEuNUg3QzYuMTcxNTcgMjEuNSA1LjUgMjAuODI4NCA1LjUgMjBWNEM1LjUgMy4xNzE1NyA2LjE3MTU3IDIuNSA3IDIuNVpNMyA0QzMgMS43OTA4NiA0Ljc5MDg2IDAgNyAwSDE3QzE5LjIwOTEgMCAyMSAxLjc5MDg2IDIxIDRWMjBDMjEgMjIuMjA5MSAxOS4yMDkxIDI0IDE3IDI0SDdDNC43OTA4NiAyNCAzIDIyLjIwOTEgMyAyMFY0Wk0xMSA0LjYxNTM4QzEwLjQ0NzcgNC42MTUzOCAxMCA1LjA2MzEgMTAgNS42MTUzOFY2LjM4NDYyQzEwIDYuOTM2OSAxMC40NDc3IDcuMzg0NjIgMTEgNy4zODQ2MkgxM0MxMy41NTIzIDcuMzg0NjIgMTQgNi45MzY5IDE0IDYuMzg0NjJWNS42MTUzOEMxNCA1LjA2MzEgMTMuNTUyMyA0LjYxNTM4IDEzIDQuNjE1MzhIMTFaIiBmaWxsPSIjRENCOEZGIi8+Cjwvc3ZnPgo=";#f;#p;#g;#m=!1;#y=0;#b=[];#w;#v;#x;get version(){return this.#l}get name(){return this.#h}get url(){return this.#u}get icon(){return this.#d}get chains(){return this.#b}get features(){return{[el]:{version:"1.0.0",connect:this.#E},[eh]:{version:"1.0.0",disconnect:this.#_},[eu]:{version:"1.0.0",on:this.#I},[T]:{version:"1.0.0",signMessage:this.#A},[P]:{version:"1.0.0",signIn:this.#S},...this.#v}}get accounts(){return this.#p?.accounts??[]}constructor(e){this.#g=e.authorizationCache,this.#f=e.appIdentity,this.#b=e.chains,this.#w=e.chainSelector,this.#x=e.onWalletNotFound,this.#v={[M]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:this.#C},[R]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:this.#N}}}get connected(){return!!this.#p}get isAuthorized(){return!!this.#p}get currentAuthorization(){return this.#p}get cachedAuthorizationResult(){return this.#g.get()}#I=(e,t)=>(this.#c[e]?.push(t)||(this.#c[e]=[t]),()=>this.#O(e,t));
442#P(e,...t){this.#c[e]?.forEach(e=>e.apply(null,t))}#O(e,t){this.#c[e]=this.#c[e]?.filter(e=>t!==e)}#E=async({silent:e}={})=>{if(this.#m||this.connected)return{accounts:this.accounts};this.#m=!0;try{if(e){let e=await this.#g.get();if(!e)return{accounts:this.accounts};await this.#T(e.capabilities),await this.#M(e)}else await this.#R()}catch(e){throw Error(eD(e),{cause:e})}finally{this.#m=!1}return{accounts:this.accounts}};#R=async e=>{try{let t=await this.#g.get();if(t)return this.#M(t),t;let r=await this.#w.select(this.#b);return await this.#k(async t=>{let[i,n]=await Promise.all([t.getCapabilities(),t.authorize({chain:r,identity:this.#f,sign_in_payload:e})]),s=this.#D(n.accounts),o={...n,accounts:s,chain:r,capabilities:i};return Promise.all([this.#T(i),this.#g.set(o),this.#M(o)]),o})}catch(e){throw Error(eD(e),{cause:e})}};#M=async e=>{let t=null==this.#p||this.#p?.accounts.length!==e.accounts.length||this.#p.accounts.some((t,r)=>t.address!==e.accounts[r].address);this.#p=e,t&&this.#P("change",{accounts:this.accounts})};#T=async e=>{let t=e.features.includes("solana:signTransactions"),r=e.supports_sign_and_send_transactions,i=M in this.features!==r||R in this.features!==t;this.#v={...(r||!r&&!t)&&{[M]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:this.#C}},...t&&{[R]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:this.#N}}},i&&this.#P("change",{features:this.features})};#L=async(e,t,r)=>{try{let[i,n]=await Promise.all([this.#p?.capabilities??await e.getCapabilities(),e.authorize({auth_token:t,identity:this.#f,chain:r})]),s=this.#D(n.accounts),o={...n,accounts:s,chain:r,capabilities:i};Promise.all([this.#g.set(o),this.#M(o)])}catch(e){throw this.#_(),Error(eD(e),{cause:e})}};#_=async()=>{this.#g.clear(),this.#m=!1,this.#y++,this.#p=void 0,this.#P("change",{accounts:this.accounts})};#k=async e=>{let t=this.#p?.wallet_uri_base,r=t?{baseUri:t}:void 0,i=this.#y,n=new eb;try{let t,i=!0,s=await Promise.race([eM().then(async()=>{n.init();let{wallet:t,close:s}=await ec(r);i=!1,n.addEventListener("close",e=>{e&&s()}),n.open();let o=await e(await t);return n.close(),s(),o}),new Promise((e,r)=>{t=setTimeout(()=>{i&&r(new U(L.ERROR_ASSOCIATION_CANCELLED,"Wallet connection timed out",{event:void 0}))},3e4)})]);return clearTimeout(t),s}catch(e){throw n.close(),this.#y!==i&&await new Promise(()=>{}),e instanceof Error&&"SolanaMobileWalletAdapterError"===e.name&&"ERROR_WALLET_NOT_FOUND"===e.code&&await this.#x(this),e}};#U=()=>{if(!this.#p)throw Error("Wallet not connected");return{authToken:this.#p.auth_token,chain:this.#p.chain}};#D=e=>e.map(e=>{let t=eg(e.address);return{address:ed.A.encode(t),publicKey:t,label:e.label,icon:e.icon,chains:e.chains??this.#b,features:e.features??ek}});#B=async e=>{let{authToken:t,chain:r}=this.#U();try{let i=e.map(e=>ep(e));return await this.#k(async e=>(await this.#L(e,t,r),(await e.signTransactions({payloads:i})).signed_payloads.map(eg)))}catch(e){throw Error(eD(e),{cause:e})}};#j=async(e,t)=>{let{authToken:r,chain:i}=this.#U();try{return await this.#k(async n=>{let[s]=await Promise.all([n.getCapabilities(),this.#L(n,r,i)]);if(s.supports_sign_and_send_transactions){let r=ep(e);return(await n.signAndSendTransactions({...t,payloads:[r]})).signatures.map(eg)[0]}throw Error("connected wallet does not support signAndSendTransaction")})}catch(e){throw Error(eD(e),{cause:e})}};#C=async(...e)=>{let t=[];for(let r of e){let e=await this.#j(r.transaction,r.options);t.push({signature:e})}return t};#N=async(...e)=>(await this.#B(e.map(({transaction:e})=>e))).map(e=>({signedTransaction:e}));#A=async(...e)=>{let{authToken:t,chain:r}=this.#U(),i=e.map(({account:e})=>ep(new Uint8Array(e.publicKey))),n=e.map(({message:e})=>ep(e));try{return await this.#k(async e=>(await this.#L(e,t,r),(await e.signMessages({addresses:i,payloads:n})).signed_payloads.map(eg).map(e=>({signedMessage:e,signature:e.slice(-64)}))))}catch(e){throw Error(eD(e),{cause:e})}};#S=async(...e)=>{let t=[];if(!(e.length>1))return[await this.#$(e[0])];for(let r of e)t.push(await this.#$(r));return t};#$=async e=>{this.#m=!0;try{let t=await this.#R({...e,domain:e?.domain??window.location.host});if(!t.sign_in_result)throw Error("Sign in failed, no sign in result returned by wallet");let r=t.sign_in_result.address,i=t.accounts.find(e=>e.address==r);return{account:{...i??{address:ed.A.encode(eg(r))},publicKey:eg(r),chains:i?.chains??this.#b,features:i?.features??t.capabilities.features},signedMessage:eg(t.sign_in_result.signed_message),signature:eg(t.sign_in_result.signature)}}catch(e){throw Error(eD(e),{cause:e})}finally{this.#m=!1}}},eU=class extends eE{contentStyles=ej;contentHtml=eB;initWithError(e){super.init(),this.populateError(e)}populateError(e){let t=this.dom?.getElementById("mobile-wallet-adapter-error-message"),r=this.dom?.getElementById("mobile-wallet-adapter-error-action");if(t){if("SolanaMobileWalletAdapterError"===e.name)switch(e.code){case"ERROR_WALLET_NOT_FOUND":t.innerHTML="To use mobile wallet adapter, you must have a compatible mobile wallet application installed on your device.",r&&r.addEventListener("click",()=>{window.location.href="https://solanamobile.com/wallets"});return;case"ERROR_BROWSER_NOT_SUPPORTED":t.innerHTML="This browser appears to be incompatible with mobile wallet adapter. Open this page in a compatible mobile browser app and try again.",r&&(r.style.display="none");return}t.innerHTML=`An unexpected error occurred: ${e.message}`}else console.log("Failed to locate error dialog element")}};let eB=` 443<svg class="mobile-wallet-adapter-embedded-modal-error-icon" xmlns="http://www.w3.org/2000/svg" height="50px" viewBox="0 -960 960 960" width="50px" fill="#000000"><path d="M 280,-80 Q 197,-80 138.5,-138.5 80,-197 80,-280 80,-363 138.5,-421.5 197,-480 280,-480 q 83,0 141.5,58.5 58.5,58.5 58.5,141.5 0,83 -58.5,141.5 Q 363,-80 280,-80 Z M 824,-120 568,-376 Q 556,-389 542.5,-402.5 529,-416 516,-428 q 38,-24 61,-64 23,-40 23,-88 0,-75 -52.5,-127.5 Q 495,-760 420,-760 345,-760 292.5,-707.5 240,-655 240,-580 q 0,6 0.5,11.5 0.5,5.5 1.5,11.5 -18,2 -39.5,8 -21.5,6 -38.5,14 -2,-11 -3,-22 -1,-11 -1,-23 0,-109 75.5,-184.5 Q 311,-840 420,-840 q 109,0 184.5,75.5 75.5,75.5 75.5,184.5 0,43 -13.5,81.5 Q 653,-460 629,-428 l 251,252 z m -615,-61 71,-71 70,71 29,-28 -71,-71 71,-71 -28,-28 -71,71 -71,-71 -28,28 71,71 -71,71 z"/></svg> 444<div class="mobile-wallet-adapter-embedded-modal-title">We can't find a wallet.</div> 445<div id="mobile-wallet-adapter-error-message" class="mobile-wallet-adapter-embedded-modal-subtitle"></div> 446<div> 447 <button data-error-action id="mobile-wallet-adapter-error-action" class="mobile-wallet-adapter-embedded-modal-error-action"> 448 Find a wallet 449 </button> 450</div> 451`,ej=` 452.mobile-wallet-adapter-embedded-modal-content { 453 text-align: center; 454} 455 456.mobile-wallet-adapter-embedded-modal-error-icon { 457 margin-top: 24px; 458} 459 460.mobile-wallet-adapter-embedded-modal-title { 461 margin: 18px 100px auto 100px; 462 color: #000000;
463 font-size: 2.75em; 464 font-weight: 600; 465} 466 467.mobile-wallet-adapter-embedded-modal-subtitle { 468 margin: 30px 60px 40px 60px; 469 color: #000000; 470 font-size: 1.25em; 471 font-weight: 400; 472} 473 474.mobile-wallet-adapter-embedded-modal-error-action { 475 display: block; 476 width: 100%; 477 height: 56px; 478 /*margin-top: 40px;*/ 479 font-size: 1.25em; 480 /*line-height: 24px;*/ 481 /*letter-spacing: -1%;*/ 482 background: #000000; 483 color: #FFFFFF; 484 border-radius: 18px; 485} 486 487/* Smaller screens */ 488@media all and (max-width: 600px) { 489 .mobile-wallet-adapter-embedded-modal-title { 490 font-size: 1.5em; 491 margin-right: 12px; 492 margin-left: 12px; 493 } 494 .mobile-wallet-adapter-embedded-modal-subtitle { 495 margin-right: 12px; 496 margin-left: 12px; 497 } 498} 499`;async function e$(){if("undefined"!=typeof window){let e=window.navigator.userAgent.toLowerCase(),t=new eU;e.includes("wv")?t.initWithError({name:"SolanaMobileWalletAdapterError",code:"ERROR_BROWSER_NOT_SUPPORTED",message:""}):t.initWithError({name:"SolanaMobileWalletAdapterError",code:"ERROR_WALLET_NOT_FOUND",message:""}),t.open()}}let ez="SolanaMobileWalletAdapterDefaultAuthorizationCache";function eq(e){return window.btoa(String.fromCharCode.call(null,...e))}function eH(e){switch(e){case"mainnet-beta":return"solana:mainnet";case"testnet":return"solana:testnet";case"devnet":return"solana:devnet";default:return e}}function eF(e){return e instanceof Error?e.message:"Unknown error"}var eW=class extends C.Xl{supportedTransactionVersions=new Set(["legacy",0]);name;icon;url;#z;#m=!1;#q="undefined"!=typeof window&&window.isSecureContext&&"undefined"!=typeof document&&/android/i.test(navigator.userAgent)?N.Ok.Loadable:N.Ok.Unsupported;#H;#F;#W;#V=async e=>{if(e.accounts&&e.accounts.length>0){this.#K();let t=await this.#H(e.accounts);t!==this.#F&&(this.#F=t,this.#W=void 0,this.emit("connect",this.publicKey))}};constructor(e,t){super(),this.#H=async e=>{let r=await t.addressSelector.select(e.map(({publicKey:e})=>eq(new Uint8Array(e))));return e.find(({publicKey:e})=>eq(new Uint8Array(e))===r)??e[0]},this.#z=e,this.#z.features[eu].on("change",this.#V),this.name=this.#z.name,this.icon=this.#z.icon,this.url=this.#z.url}get publicKey(){if(!this.#W&&this.#F)try{this.#W=new k.PublicKey(this.#F.publicKey)}catch(e){throw new O.Kd(e instanceof Error&&e?.message||"Unknown error",e)}return this.#W??null}get connected(){return this.#z.connected}get connecting(){return this.#m}get readyState(){return this.#q}async autoConnect_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(){return await this.autoConnect()}async autoConnect(){this.#E(!0)}async connect(){this.#E()}async #E(e=!1){if(!this.connecting&&!this.connected)return await this.#G(async()=>{if(this.#q!==N.Ok.Installed&&this.#q!==N.Ok.Loadable)throw new O.AE;this.#m=!0;try{await this.#z.features[el].connect({silent:e})}catch(e){throw new O.Y6(e instanceof Error&&e.message||"Unknown error",e)}finally{this.#m=!1}})}async performAuthorization(e){try{let t=await this.#z.cachedAuthorizationResult;if(t)return await this.#z.features[el].connect({silent:!0}),t;return e?await this.#z.features[P].signIn(e):await this.#z.features[el].connect(),await await this.#z.cachedAuthorizationResult}catch(e){throw new O.Y6(e instanceof Error&&e.message||"Unknown error",e)}}async disconnect(){return await this.#G(async()=>{this.#m=!1,this.#W=void 0,this.#F=void 0,await this.#z.features[eh].disconnect(),this.emit("disconnect")})}async signIn(e){return this.#G(async()=>{if(this.#q!==N.Ok.Installed&&this.#q!==N.Ok.Loadable)throw new O.AE;this.#m=!0;try{let t=await this.#z.features[P].signIn({...e,domain:e?.domain??window.location.host});if(t.length>0)return t[0];throw Error("Sign in failed, no sign in result returned by wallet")}catch(e){throw new O.Y6(e instanceof Error&&e.message||"Unknown error",e)}finally{this.#m=!1}})}async signMessage(e){return await this.#G(async()=>{let t=this.#U();try{return(await this.#z.features[T].signMessage({account:t,message:e}))[0].signature}catch(e){throw new O.K3(eF(e),e)}})}async sendTransaction(e,t,r){return await this.#G(async()=>{let i=this.#U();try{if(M in this.#z.features){let t=eH(this.#z.currentAuthorization.chain),[n]=(await this.#z.features[M].signAndSendTransaction({account:i,transaction:e.serialize(),chain:t,options:r?{skipPreflight:r.skipPreflight,maxRetries:r.maxRetries}:void 0})).map(e=>eq(e.signature));return n}{let[i]=await this.#B([e]);if("version"in i)return await t.sendTransaction(i);{let e=i.serialize();return await t.sendRawTransaction(e,{...r,preflightCommitment:function(){let e,i;switch(t.commitment){case"confirmed":case"finalized":case"processed":e=t.commitment;break;default:e="finalized"}switch(r?.preflightCommitment){case"confirmed":case"finalized":case"processed":i=r.preflightCommitment;break;case void 0:i=e;break;default:i="finalized"}return("finalized"===i?2:+("confirmed"===i))<("finalized"===e?2:+("confirmed"===e))?i:e}()})}}}catch(e){throw new O.UF(eF(e),e)}})}async signTransaction(e){return await this.#G(async()=>{let[t]=await this.#B([e]);return t})}async signAllTransactions(e){return await this.#G(async()=>await this.#B(e))}
499#K(){this.#q!==N.Ok.Installed&&this.emit("readyStateChange",this.#q=N.Ok.Installed)}#U(){if(!this.#z.isAuthorized||!this.#F)throw new O.kW;return this.#F}async #B(e){let t=this.#U();try{if(R in this.#z.features)return this.#z.features[R].signTransaction(...e.map(e=>({account:t,transaction:e.serialize()}))).then(e=>e.map(e=>{let t=e.signedTransaction,r=64*t[0]+1;return"legacy"===k.VersionedMessage.deserializeMessageVersion(t.slice(r,t.length))?k.Transaction.from(t):k.VersionedTransaction.deserialize(t)}));throw Error("Connected wallet does not support signing transactions")}catch(e){throw new O.z4(eF(e),e)}}async #G(e){try{return await e()}catch(e){throw this.emit("error",e instanceof O.m7?e:new O.m7(eF(e),e)),e}}},eV=class extends eW{constructor(e){let t=eH(e.chain??e.cluster);super(new eL({appIdentity:e.appIdentity,authorizationCache:{set:e.authorizationResultCache.set,get:async()=>await e.authorizationResultCache.get(),clear:e.authorizationResultCache.clear},chains:[t],chainSelector:{select:async e=>1===e.length?e[0]:e.includes(ef)?ef:e[0]},onWalletNotFound:async()=>{e.onWalletNotFound(this)}}),{addressSelector:e.addressSelector,chain:t})}},eK=class extends eV{};async function eG(e){return e$()}let eY=function(e){return el in e.features&&eu in e.features&&(M in e.features||R in e.features)};var eJ=r(51901);function eX(e){switch(e){case"processed":case"confirmed":case"finalized":case void 0:return e;case"recent":return"processed";case"single":case"singleGossip":return"confirmed";case"max":case"root":return"finalized";default:return}}new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap,new WeakMap;var eQ=function(e,t,r,i){if("a"===r&&!i)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},eZ=function(e,t,r,i,n){if("m"===i)throw TypeError("Private method is not writable");if("a"===i&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};class e0 extends N.Ce{get name(){return eQ(this,p,"f").name}get url(){return"https://github.com/solana-labs/wallet-standard"}get icon(){return eQ(this,p,"f").icon}get readyState(){return eQ(this,g,"f")}get publicKey(){return eQ(this,l,"f")}get connecting(){return eQ(this,h,"f")}get supportedTransactionVersions(){return eQ(this,f,"f")}get wallet(){return eQ(this,p,"f")}get standard(){return!0}constructor({wallet:e}){super(),a.add(this),c.set(this,void 0),l.set(this,void 0),h.set(this,void 0),u.set(this,void 0),d.set(this,void 0),f.set(this,void 0),p.set(this,void 0),g.set(this,"undefined"==typeof window||"undefined"==typeof document?N.Ok.Unsupported:N.Ok.Installed),v.set(this,e=>{if("accounts"in e){let e=eQ(this,p,"f").accounts[0];eQ(this,c,"f")&&!eQ(this,u,"f")&&e!==eQ(this,c,"f")&&(e?eQ(this,a,"m",y).call(this,e):(this.emit("error",new O.PQ),eQ(this,a,"m",b).call(this)))}"features"in e&&eQ(this,a,"m",w).call(this)}),eZ(this,p,e,"f"),eZ(this,c,null,"f"),eZ(this,l,null,"f"),eZ(this,h,!1,"f"),eZ(this,u,!1,"f"),eZ(this,d,eQ(this,p,"f").features[eu].on("change",eQ(this,v,"f")),"f"),eQ(this,a,"m",w).call(this)}destroy(){eZ(this,c,null,"f"),eZ(this,l,null,"f"),eZ(this,h,!1,"f"),eZ(this,u,!1,"f");let e=eQ(this,d,"f");e&&(eZ(this,d,null,"f"),e())}async autoConnect(){return eQ(this,a,"m",m).call(this,{silent:!0})}async connect(){return eQ(this,a,"m",m).call(this)}async disconnect(){if(eh in eQ(this,p,"f").features)try{eZ(this,u,!0,"f"),await eQ(this,p,"f").features[eh].disconnect()}catch(e){this.emit("error",new O.Y8(e?.message,e))}finally{eZ(this,u,!1,"f")}eQ(this,a,"m",b).call(this)}async sendTransaction(e,t,r={}){try{var i;let n,s=eQ(this,c,"f");if(!s)throw new O.kW;if(M in eQ(this,p,"f").features)if(s.features.includes(M))n=M;else if(R in eQ(this,p,"f").features&&s.features.includes(R))n=R;else throw new O.fk;else if(R in eQ(this,p,"f").features){if(!s.features.includes(R))throw new O.fk;n=R}else throw new O.Ez;let o=(i=t.rpcEndpoint).includes("https://api.mainnet-beta.solana.com")?ef:/\bdevnet\b/i.test(i)?"solana:devnet":/\btestnet\b/i.test(i)?"solana:testnet"
vendor: 8,885 bytes, line 499
499:/\blocalhost\b/i.test(i)||/\b127\.0\.0\.1\b/.test(i)?"solana:localnet":ef;if(!s.chains.includes(o))throw new O.UF;try{let i,{signers:a,...c}=r;if((0,eJ.Y)(e)?(a?.length&&e.sign(a),i=e.serialize()):(e=await this.prepareTransaction(e,t,c),a?.length&&e.partialSign(...a),i=new Uint8Array(e.serialize({requireAllSignatures:!1,verifySignatures:!1}))),n===M){let[e]=await eQ(this,p,"f").features[M].signAndSendTransaction({account:s,chain:o,transaction:i,options:{preflightCommitment:eX(c.preflightCommitment||t.commitment),skipPreflight:c.skipPreflight,maxRetries:c.maxRetries,minContextSlot:c.minContextSlot}});return ed.A.encode(e.signature)}{let[e]=await eQ(this,p,"f").features[R].signTransaction({account:s,chain:o,transaction:i,options:{preflightCommitment:eX(c.preflightCommitment||t.commitment),minContextSlot:c.minContextSlot}});return await t.sendRawTransaction(e.signedTransaction,{...c,preflightCommitment:eX(c.preflightCommitment||t.commitment)})}}catch(e){if(e instanceof O.m7)throw e;throw new O.UF(e?.message,e)}}catch(e){throw this.emit("error",e),e}}}c=new WeakMap,l=new WeakMap,h=new WeakMap,u=new WeakMap,d=new WeakMap,f=new WeakMap,p=new WeakMap,g=new WeakMap,v=new WeakMap,a=new WeakSet,m=async function(e){try{if(this.connected||this.connecting)return;if(eQ(this,g,"f")!==N.Ok.Installed)throw new O.AE;if(eZ(this,h,!0,"f"),!eQ(this,p,"f").accounts.length)try{await eQ(this,p,"f").features[el].connect(e)}catch(e){throw new O.Y6(e?.message,e)}let t=eQ(this,p,"f").accounts[0];if(!t)throw new O.fk;eQ(this,a,"m",y).call(this,t)}catch(e){throw this.emit("error",e),e}finally{eZ(this,h,!1,"f")}},y=function(e){let t;try{t=new k.PublicKey(e.address)}catch(e){throw new O.Kd(e?.message,e)}eZ(this,c,e,"f"),eZ(this,l,t,"f"),eQ(this,a,"m",w).call(this),this.emit("connect",t)},b=function(){eZ(this,c,null,"f"),eZ(this,l,null,"f"),eQ(this,a,"m",w).call(this),this.emit("disconnect")},w=function(){let e=M in eQ(this,p,"f").features?eQ(this,p,"f").features[M].supportedTransactionVersions:eQ(this,p,"f").features[R].supportedTransactionVersions;eZ(this,f,!function(e,t){if(e===t)return!0;let r=e.length;if(r!==t.length)return!1;for(let i=0;i<r;i++)if(e[i]!==t[i])return!1;return!0}(e,["legacy"])?new Set(e):null,"f"),R in eQ(this,p,"f").features&&eQ(this,c,"f")?.features.includes(R)?(this.signTransaction=eQ(this,a,"m",x),this.signAllTransactions=eQ(this,a,"m",E)):(delete this.signTransaction,delete this.signAllTransactions),T in eQ(this,p,"f").features&&eQ(this,c,"f")?.features.includes(T)?this.signMessage=eQ(this,a,"m",_):delete this.signMessage,P in eQ(this,p,"f").features?this.signIn=eQ(this,a,"m",I):delete this.signIn},x=async function(e){try{let t=eQ(this,c,"f");if(!t)throw new O.kW;if(!(R in eQ(this,p,"f").features))throw new O.Ez;if(!t.features.includes(R))throw new O.fk;try{let r=(await eQ(this,p,"f").features[R].signTransaction({account:t,transaction:(0,eJ.Y)(e)?e.serialize():new Uint8Array(e.serialize({requireAllSignatures:!1,verifySignatures:!1}))}))[0].signedTransaction;return(0,eJ.Y)(e)?k.VersionedTransaction.deserialize(r):k.Transaction.from(r)}catch(e){if(e instanceof O.m7)throw e;throw new O.z4(e?.message,e)}}catch(e){throw this.emit("error",e),e}},E=async function(e){try{let t=eQ(this,c,"f");if(!t)throw new O.kW;if(!(R in eQ(this,p,"f").features))throw new O.Ez;if(!t.features.includes(R))throw new O.fk;try{let r=await eQ(this,p,"f").features[R].signTransaction(...e.map(e=>({account:t,transaction:(0,eJ.Y)(e)?e.serialize():new Uint8Array(e.serialize({requireAllSignatures:!1,verifySignatures:!1}))})));return e.map((e,t)=>{let i=r[t].signedTransaction;return(0,eJ.Y)(e)?k.VersionedTransaction.deserialize(i):k.Transaction.from(i)})}catch(e){throw new O.z4(e?.message,e)}}catch(e){throw this.emit("error",e),e}},_=async function(e){try{let t=eQ(this,c,"f");if(!t)throw new O.kW;if(!(T in eQ(this,p,"f").features))throw new O.Ez;if(!t.features.includes(T))throw new O.fk;try{return(await eQ(this,p,"f").features[T].signMessage({account:t,message:e}))[0].signature}catch(e){throw new O.K3(e?.message,e)}}catch(e){throw this.emit("error",e),e}},I=async function(e={}){try{let t;if(!(P in eQ(this,p,"f").features))throw new O.Ez;try{[t]=await eQ(this,p,"f").features[P].signIn(e)}catch(e){throw new O.o7(e?.message,e)}if(!t)throw new O.o7;return eQ(this,a,"m",y).call(this,t.account),t}catch(e){throw this.emit("error",e),e}};var e1=function(e,t,r,i){if("a"===r&&!i)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},e2=function(e,t,r,i,n){if("m"===i)throw TypeError("Private method is not writable");if("a"===i&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};let e3=new Set,e8={};function e5(...e){return(e=e.filter(e=>!e3.has(e))).length?(e.forEach(e=>{n=void 0,e3.add(e)}),e8.register?.forEach(t=>e9(()=>t(...e))),function(){e.forEach(e=>{n=void 0,e3.delete(e)}),e8.unregister?.forEach(t=>e9(()=>t(...e)))}):()=>{}}function e6(){return n||(n=[...e3]),n}function e4(e,t){return e8[e]?.push(t)||(e8[e]=[t]),function(){e8[e]=e8[e]?.filter(e=>t!==e)}}function e9(e){try{e()}catch(e){console.error(e)}}class e7 extends Event{get detail(){return e1(this,A,"f")}get type(){return"wallet-standard:app-ready"}constructor(e){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),A.set(this,void 0),e2(this,A,e,"f")}preventDefault(){throw Error("preventDefault cannot be called")}stopImmediatePropagation(){throw Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw Error("stopPropagation cannot be called")}}A=new WeakMap;var te=r(12115);function tt(e){let t=(0,te.useRef)(void 0);return void 0===t.current&&(t.current={value:e()}),t.current.value}function tr(e){return e.filter(eY).map(e=>new e0({wallet:e}))}!function(e){e[e.DESKTOP_WEB=0]="DESKTOP_WEB",e[e.MOBILE_WEB=1]="MOBILE_WEB"}(S||(S={}));var ti=r(84034);class tn extends O.m7{constructor(){super(...arguments),this.name="WalletNotSelectedError"}}var ts=r(55955);function to({children:e,wallets:t,adapter:r,isUnloadingRef:i,onAutoConnectRequest:n,onConnectError:s,onError:o,onSelectWallet:a}){let c=(0,te.useRef)(!1),[l,h]=(0,te.useState)(!1),u=(0,te.useRef)(!1),[d,f]=(0,te.useState)(!1),[p,g]=(0,te.useState)(()=>r?.publicKey??null),[m,y]=(0,te.useState)(()=>r?.connected??!1),b=(0,te.useRef)(o);(0,te.useEffect)(()=>(b.current=o,()=>{b.current=void 0}),[o]);let w=(0,te.useRef)((e,t)=>(!i.current&&(b.current?b.current(e,t):(console.error(e,t),e instanceof O.AE&&"undefined"!=typeof window&&t&&window.open(t.url,"_blank"))),e)),[v,x]=(0,te.useState)(()=>t.map(e=>({adapter:e,readyState:e.readyState})).filter(({readyState:e})=>e!==N.Ok.Unsupported));(0,te.useEffect)(()=>{function e(e){x(t=>{let r=t.findIndex(({adapter:e})=>e===this);if(-1===r)return t;let{adapter:i}=t[r];return[...t.slice(0,r),{adapter:i,readyState:e},...t.slice(r+1)].filter(({readyState:e})=>e!==N.Ok.Unsupported)})}return x(e=>t.map((t,r)=>{let i=e[r];return i&&i.adapter===t&&i.readyState===t.readyState?i:{adapter:t,readyState:t.readyState}}).filter(({readyState:e})=>e!==N.Ok.Unsupported)),t.forEach(t=>t.on("readyStateChange",e,t)),()=>{t.forEach(t=>t.off("readyStateChange",e,t))}},[r,t]);let E=(0,te.useMemo)(()=>v.find(e=>e.adapter===r)??null,[r,v]);(0,te.useEffect)(()=>{if(!r)return;let e=e=>{g(e),c.current=!1,h(!1),y(!0),u.current=!1,f(!1)},t=()=>{i.current||(g(null),c.current=!1,h(!1),y(!1),u.current=!1,f(!1))},n=e=>{w.current(e,r)};return r.on("connect",e),r.on("disconnect",t),r.on("error",n),()=>{r.off("connect",e),r.off("disconnect",t),r.off("error",n),t()}},[r,i]);let _=(0,te.useRef)(!1);(0,te.useEffect)(()=>()=>{_.current=!1},[r]),(0,te.useEffect)(()=>{_.current||c.current||m||!n||E?.readyState!==N.Ok.Installed&&E?.readyState!==N.Ok.Loadable||(c.current=!0,h(!0),_.current=!0,async function(){try{await n()}catch{s()}finally{h(!1),c.current=!1}}())},[m,n,s,E]);let I=(0,te.useCallback)(async(e,t,i)=>{if(!r)throw w.current(new tn);if(!m)throw w.current(new O.kW,r);return await r.sendTransaction(e,t,i)},[r,m]),A=(0,te.useMemo)(()=>r&&"signTransaction"in r?async e=>{if(!m)throw w.current(new O.kW,r);return await r.signTransaction(e)}:void 0,[r,m]),S=(0,te.useMemo)(()=>r&&"signAllTransactions"in r?async e=>{if(!m)throw w.current(new O.kW,r);return await r.signAllTransactions(e)}:void 0,[r,m]),C=(0,te.useMemo)(()=>r&&"signMessage"in r?async e=>{if(!m)throw w.current(new O.kW,r);return await r.signMessage(e)}:void 0,[r,m]),P=(0,te.useMemo)(()=>r&&"signIn"in r?async e=>await r.signIn(e):void 0,[r]),T=(0,te.useCallback)(async()=>
499{if(c.current||u.current||E?.adapter.connected)return;if(!E)throw w.current(new tn);let{adapter:e,readyState:t}=E;if(t!==N.Ok.Installed&&t!==N.Ok.Loadable)throw w.current(new O.AE,e);c.current=!0,h(!0);try{await e.connect()}catch(e){throw s(),e}finally{h(!1),c.current=!1}},[s,E]),M=(0,te.useCallback)(async()=>{if(!u.current&&r){u.current=!0,f(!0);try{await r.disconnect()}finally{f(!1),u.current=!1}}},[r]);return te.createElement(ts.b.Provider,{value:{autoConnect:!!n,wallets:v,wallet:E,publicKey:p,connected:m,connecting:l,disconnecting:d,select:a,connect:T,disconnect:M,sendTransaction:I,signTransaction:A,signAllTransactions:S,signMessage:C,signIn:P}},e)}function ta(e){return function({adapters:e,userAgentString:t}){return e.some(e=>e.name!==eR&&e.readyState===N.Ok.Installed)?S.DESKTOP_WEB:t&&/android/i.test(t)&&!/(WebView|Version\/.+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+)|; wv\).+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+))/i.test(t)?S.MOBILE_WEB:S.DESKTOP_WEB}({adapters:e,userAgentString:(void 0===s&&(s=globalThis.navigator?.userAgent??null),s)})===S.MOBILE_WEB}function tc({children:e,wallets:t,autoConnect:r,localStorageKey:i="walletName",onError:n}){let{connection:s}=(0,ti.w)(),a=function(e){let t=tt(()=>new Set),{get:r,on:i}=tt(()=>(function(){if(o||(o=function(){if(o||(o=Object.freeze({register:e5,get:e6,on:e4}),"undefined"==typeof window))return o;let e=Object.freeze({register:e5});try{window.addEventListener("wallet-standard:register-wallet",({detail:t})=>t(e))}catch(e){console.error("wallet-standard:register-wallet event listener could not be added\n",e)}try{window.dispatchEvent(new e7(e))}catch(e){console.error("wallet-standard:app-ready event could not be dispatched\n",e)}return o}(),"undefined"==typeof window))return o;let e=window.navigator.wallets||[];if(!Array.isArray(e))return console.error("window.navigator.wallets is not an array"),o;let{register:t}=o,r=(...e)=>e.forEach(e=>e9(()=>e({register:t})));try{Object.defineProperty(window.navigator,"wallets",{value:Object.freeze({push:r})})}catch(e){return console.error("window.navigator.wallets could not be set"),o}return r(...e),o})()),[n,s]=(0,te.useState)(()=>tr(r()));(0,te.useEffect)(()=>{let e=[i("register",(...e)=>s(t=>[...t,...tr(e)])),i("unregister",(...e)=>s(t=>t.filter(t=>e.some(e=>e===t.wallet))))];return()=>e.forEach(e=>e())},[i]);let a=function(e){let t=(0,te.useRef)(void 0);return(0,te.useEffect)(()=>{t.current=e}),t.current}(n);return(0,te.useEffect)(()=>{if(!a)return;let e=new Set(n);new Set(a.filter(t=>!e.has(t))).forEach(e=>e.destroy())},[a,n]),(0,te.useEffect)(()=>()=>n.forEach(e=>e.destroy()),[]),(0,te.useMemo)(()=>[...n,...e.filter(({name:e})=>!n.some(t=>t.name===e)||(t.has(e)||(t.add(e),console.warn(`${e} was registered as a Standard Wallet. The Wallet Adapter for ${e} can be removed from your app.`)),!1))],[n,e,t])}(t),c=(0,te.useMemo)(()=>{var e;if(!ta(a))return null;let t=a.find(e=>e.name===eR);return t?t:new eK({addressSelector:{select:async e=>e[0]},appIdentity:{uri:function(){let e=globalThis.location;if(e)return`${e.protocol}//${e.host}`}()},authorizationResultCache:function(){let e;try{e=window.localStorage}catch{}return{async clear(){if(e)try{e.removeItem(ez)}catch{}},async get(){if(e)try{let t=JSON.parse(e.getItem(ez));if(!t||!t.accounts)return t||void 0;{let e=t.accounts.map(e=>({...e,publicKey:"publicKey"in e?new Uint8Array(Object.values(e.publicKey)):ed.A.decode(e.address)}));return{...t,accounts:e}}}catch{}},async set(t){if(e)try{e.setItem(ez,JSON.stringify(t))}catch{}}}}(),cluster:(e=s?.rpcEndpoint)?/devnet/i.test(e)?"devnet":/testnet/i.test(e)?"testnet":"mainnet-beta":"mainnet-beta",onWalletNotFound:eG})},[a,s?.rpcEndpoint]),l=(0,te.useMemo)(()=>null==c||-1!==a.indexOf(c)?a:[c,...a],[a,c]),[h,u]=function(e,t){let r=(0,te.useState)(()=>{try{let t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch(e){"undefined"!=typeof window&&console.error(e)}return null}),i=r[0],n=(0,te.useRef)(!0);return(0,te.useEffect)(()=>{if(n.current){n.current=!1;return}try{null===i?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(i))}catch(e){"undefined"!=typeof window&&console.error(e)}},[i,e]),r}(i,0),d=(0,te.useMemo)(()=>l.find(e=>e.name===h)??null,[l,h]),f=(0,te.useCallback)(e=>{h!==e&&(d&&d.name!==eR&&d.disconnect(),u(e))},[d,u,h]);(0,te.useEffect)(()=>
499{if(d)return d.on("disconnect",e),()=>{d.off("disconnect",e)};function e(){m.current||u(null)}},[d,a,u,h]);let p=(0,te.useRef)(!1),g=(0,te.useMemo)(()=>{if(r&&d)return async()=>{(!0===r||await r(d))&&(p.current?await d.connect():await d.autoConnect())}},[r,d]),m=(0,te.useRef)(!1);(0,te.useEffect)(()=>{if(h===eR&&ta(a)){m.current=!1;return}function e(){m.current=!0}return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}},[a,h]);let y=(0,te.useCallback)(()=>{d&&f(null)},[d,f]),b=(0,te.useCallback)(e=>{p.current=!0,f(e)},[f]);return te.createElement(to,{wallets:l,adapter:d,isUnloadingRef:m,onAutoConnectRequest:g,onConnectError:y,onError:n,onSelectWallet:b},e)}},41953:(e,t,r)=>{let i=r(46342),n=i.getBCHDigit(1335);t.getEncodedBits=function(e,t){let r=e.bit<<3|t,s=r<<10;for(;i.getBCHDigit(s)-n>=0;)s^=1335<<i.getBCHDigit(s)-n;return(r<<10|s)^21522}},42307:(e,t,r)=>{"use strict";e.exports=function(e){return e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){for(var t=e.words,r=e.sigBytes-1,r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},e.pad.ZeroPadding}(r(16611),r(99229))},42937:(e,t,r)=>{"use strict";var i=r(48945).Buffer;e.exports=function(e){if(e.length>=255)throw TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==t[o])throw TypeError(s+" is ambiguous");t[o]=n}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function u(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return i.alloc(0);for(var r=0,n=0,s=0;e[r]===c;)n++,r++;for(var o=(e.length-r)*l+1>>>0,h=new Uint8Array(o);r<e.length;){var u=e.charCodeAt(r);if(u>255)return;var d=t[u];if(255===d)return;for(var f=0,p=o-1;(0!==d||f<s)&&-1!==p;p--,f++)d+=a*h[p]>>>0,h[p]=d%256>>>0,d=d/256>>>0;if(0!==d)throw Error("Non-zero carry");s=f,r++}for(var g=o-s;g!==o&&0===h[g];)g++;var m=i.allocUnsafe(n+(o-g));m.fill(0,0,n);for(var y=n;g!==o;)m[y++]=h[g++];return m}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=i.from(t)),!i.isBuffer(t))throw TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,n=0,s=0,o=t.length;s!==o&&0===t[s];)s++,r++;for(var l=(o-s)*h+1>>>0,u=new Uint8Array(l);s!==o;){for(var d=t[s],f=0,p=l-1;(0!==d||f<n)&&-1!==p;p--,f++)d+=256*u[p]>>>0,u[p]=d%a>>>0,d=d/a>>>0;if(0!==d)throw Error("Non-zero carry");n=f,s++}for(var g=l-n;g!==l&&0===u[g];)g++;for(var m=c.repeat(r);g<l;++g)m+=e.charAt(u[g]);return m},decodeUnsafe:u,decode:function(e){var t=u(e);if(t)return t;throw Error("Non-base"+a+" character")}}}},43757:(e,t,r)=>{"use strict";t.version=r(14537).rE,t.utils=r(78239),t.rand=r(66725),t.curve=r(23750),t.curves=r(13798),t.ec=r(82965),t.eddsa=r(10562)},43770:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},44006:(e,t,r)=>{let i=r(89158);function n(e){this.mode=i.BYTE,"string"==typeof e?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}n.getBitsLength=function(e){return 8*e},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(e){for(let t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)},e.exports=n},44016:(e,t,r)=>{"use strict";let i;r.d(t,{K:()=>uU});var n,s,o,a,c=r(45669),l=r(51470),h=r(36452),u=r(94040);!function(e){e.Mainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",e.Devnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",e.Deprecated_Mainnet="solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ",e.Deprecated_Devnet="solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K"}(o||(o={})),function(e){e.signTransaction="solana_signTransaction",e.signMessage="solana_signMessage",e.signAndSendTransaction="solana_signAndSendTransaction",e.signAndSendAllTransactions="solana_signAndSendAllTransactions",e.signAllTransactions="solana_signAllTransactions"}(a||(a={}));let d={Mainnet:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",Devnet:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",Deprecated_Mainnet:"solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ",Deprecated_Devnet:"solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K"};var f=r(51901),p=r(25223),g=r(16459),m=r.n(g),y=r(67878),b=r(5596),w=r(71018),v=r(60480),x=Object.defineProperty,E=(e,t,r)=>((e,t,r)=>t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class _ extends v.H{constructor(e){super(),this.opts=e,E(this,"protocol","wc"),E(this,"version",2)}}var I=Object.defineProperty;class A extends v.H{constructor(e,t){super(),this.core=e,this.logger=t,((e,t,r)=>((e,t,r)=>t in e?I(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r))(this,"records",new Map)}}class S{constructor(e,t){this.logger=e,this.core=t}}class C extends v.H{constructor(e,t){super(),this.relayer=e,this.logger=t}}class N extends v.H{constructor(e){super()}}
499class O{constructor(e,t,r,i){this.core=e,this.logger=t,this.name=r}}class P extends v.H{constructor(e,t){super(),this.relayer=e,this.logger=t}}class T extends v.H{constructor(e,t){super(),this.core=e,this.logger=t}}class M{constructor(e,t,r){this.core=e,this.logger=t,this.store=r}}class R{constructor(e,t){this.projectId=e,this.logger=t}}class k{constructor(e,t,r){this.core=e,this.logger=t,this.telemetryEnabled=r}}var D=Object.defineProperty,L=(e,t,r)=>((e,t,r)=>t in e?D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);m();class U{constructor(e){this.opts=e,L(this,"protocol","wc"),L(this,"version",2)}}g.EventEmitter;class B{constructor(e){this.client=e}}var j=r(5566),$=r(25042),z=r(20852),q=r(40800),H=r(26662),F=r(88955);let W="2.23.2",V={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${W}`};class K extends Error{constructor(e,t={}){let r=t.cause instanceof K?t.cause.details:t.cause?.message?t.cause.message:t.details,i=t.cause instanceof K&&t.cause.docsPath||t.docsPath,n=V.getDocsUrl?.({...t,docsPath:i});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: ${n}`]:[],...r?[`Details: ${r}`]:[],...V.version?[`Version: ${V.version}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=i,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=W}walk(e){return function e(t,r){return r?.(t)?t:t&&"object"==typeof t&&"cause"in t&&void 0!==t.cause?e(t.cause,r):r?null:t}(this,e)}}function G(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}class Y extends K{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function J(e,{dir:t,size:r=32}={}){return"string"==typeof e?function(e,{dir:t,size:r=32}={}){if(null===r)return e;let i=e.replace("0x","");if(i.length>2*r)throw new Y({size:Math.ceil(i.length/2),targetSize:r,type:"hex"});return`0x${i["right"===t?"padEnd":"padStart"](2*r,"0")}`}(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new Y({size:e.length,targetSize:r,type:"bytes"});let i=new Uint8Array(r);for(let n=0;n<r;n++){let s="right"===t;i[s?n:r-n-1]=e[s?n:e.length-n-1]}return i}(e,{dir:t,size:r})}class X extends K{constructor({max:e,min:t,signed:r,size:i,value:n}){super(`Number "${n}" is not in safe ${i?`${8*i}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class Q extends K{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function Z(e){return G(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function ee(e,{size:t}){if(Z(e)>t)throw new Q({givenSize:Z(e),maxSize:t})}function et(e,t={}){let{signed:r}=t;t.size&&ee(e,{size:t.size});let i=BigInt(e);if(!r)return i;let n=(e.length-2)/2;return i<=(1n<<8n*BigInt(n)-1n)-1n?i:i-BigInt(`0x${"f".padStart(2*n,"f")}`)-1n}let er=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ei(e,t={}){return"number"==typeof e||"bigint"==typeof e?es(e,t):"string"==typeof e?function(e,t={}){return en(eo.encode(e),t)}(e,t):"boolean"==typeof e?function(e,t={}){let r=`0x${Number(e)}`;return"number"==typeof t.size?(ee(r,{size:t.size}),J(r,{size:t.size})):r}(e,t):en(e,t)}function en(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=er[e[t]];let i=`0x${r}`;return"number"==typeof t.size?(ee(i,{size:t.size}),J(i,{dir:"right",size:t.size})):i}function es(e,t={}){let r,{signed:i,size:n}=t,s=BigInt(e);n?r=i?(1n<<8n*BigInt(n)-1n)-1n:2n**(8n*BigInt(n))-1n:"number"==typeof e&&(r=BigInt(Number.MAX_SAFE_INTEGER));let o="bigint"==typeof r&&i?-r-1n:0;if(r&&s>r||s<o){let t="bigint"==typeof e?"n":"";throw new X({max:r?`${r}${t}`:void 0,min:`${o}${t}`,signed:i,size:n,value:`${e}${t}`})}let a=`0x${(i&&s<0?(1n<<BigInt(8*n))+BigInt(s):s).toString(16)}`;return n?J(a,{size:n}):a}let eo=new TextEncoder,ea=new TextEncoder,ec={zero:48,nine:57,A:65,F:70,a:97,f:102};function el(e){return e>=ec.zero&&e<=ec.nine?e-ec.zero:e>=ec.A&&e<=ec.F?e-(ec.A-10):e>=ec.a&&e<=ec.f?e-(ec.a-10):void 0}function eh(e,t={}){let r=e;t.size&&(ee(r,{size:t.size}),r=J(r,{dir:"right",size:t.size}));let i=r.slice(2);i.length%2&&(i=`0${i}`);let n=i.length/2,s=new Uint8Array(n);for(let e=0,t=0;e<n;e++){let r=el(i.charCodeAt(t++)),n=el(i.charCodeAt(t++));if(void 0===r||void 0===n)throw new K(`Invalid byte sequence ("${i[t-2]}${i[t-1]}" in "${i}").`);s[e]=16*r+n}return s}function eu(e,t={}){let r=ea.encode(e);return"number"==typeof t.size?(ee(r,{size:t.size}),J(r,{dir:"right",size:t.size})):r}var ed=r(77946);let ef=BigInt(0x100000000-1),ep=BigInt(32);var eg=r(51826);let em=[],ey=[],eb=[],ew=BigInt(0),ev=BigInt(1),ex=BigInt(2),eE=BigInt(7),e_=BigInt(256),eI=BigInt(113);for(let e=0,t=ev,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],em.push(2*(5*i+r)),ey.push((e+1)*(e+2)/2%64);let n=ew;for(let e=0;e<7;e++)(t=(t<<ev^(t>>eE)*eI)%e_)&ex&&(n^=ev<<(ev<<BigInt(e))-ev);eb.push(n)}let[eA,eS]=function(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let n=0;n<e.length;n++){let{h:s,l:o}=function(e,t=!1){return t?{h:Number(e&ef),l:Number(e>>ep&ef)}:{h:0|Number(e>>ep&ef),l:0|Number(e&ef)}}(e[n],t);[r[n],i[n]]=[s,o]}return[r,i]}(eb,!0),eC=(e,t,r)=>r>32?((e,t,r)=>t<<r-32|e>>>64-r)(e,t,r):((e,t,r)=>e<<r|t>>>32-r)(e,t,r),eN=(e,t,r)=>r>32?((e,t,r)=>e<<r-32|t>>>64-r)(e,t,r):((e,t,r)=>t<<r|e>>>32-r)(e,t,r);class eO extends eg.Vw{constructor(e,t,r,i=!1,n=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,ed.Fe)(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,eg.DH)(this.state)}keccak(){eg.qv||(0,eg.Fc)(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let i=(t+8)%10,n=(t+2)%10,s=r[n],o=r[n+1],a=eC(s,o,1)^r[i],c=eN(s,o,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],n=e[3];for(let r=0;r<24;r++){let i=ey[r],s=eC(t,n,i),o=eN(t,n,i),a=em[r];t=e[a],n=e[a+1],e[a]=s,e[a+1]=o}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=eA[i],e[1]^=eS[i]}r.fill(0)}(this.state32,this.rounds),eg.qv||(0,eg.Fc)(this.state32),this.posOut=0,this.pos=0}update(e){(0,ed.CC)(this);let{blockLen:t,state:r}=this,i=(e=(0,eg.ZJ)(e)).length;for(let n=0;n<i;){let s=Math.min(t-this.pos,i-n);for(let t=0;t<s;t++)r[this.pos++]^=e[n++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:i}=this;e[r]^=t,(128&t)!=0&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){(0,ed.CC)(this,!1),(0,ed.DO)(e),this.finish();let t=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,ed.Fe)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,ed.Ht)(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new eO(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}let eP=(0,eg.ld)(()=>new eO(136,1,32));function eT(e,t){let r=eP(G(e,{strict:!1})?function(e,t={}){return"number"==typeof e||"bigint"==typeof e?eh(es(e,t)):"boolean"==typeof e?function(e,t={}){let r=new Uint8Array(1);return(r[0]=Number(e),"number"==typeof t.size)?(ee(r,{size:t.size}),J(r,{size:t.size})):r}(e,t):G(e)?eh(e,t):eu(e,t)}(e):e);return"bytes"===(t||"hex")?r:ei(r)}class eM extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=this.keys().next().value;e&&this.delete(e)}return this}}let eR=new eM(8192);async function ek({hash:e,signature:t}){let i=G(e)?e:ei(e),{secp256k1:n}=await r.e(5666).then(r.bind(r,35666)),s=(()=>
499{if("object"==typeof t&&"r"in t&&"s"in t){let{r:e,s:r,v:i,yParity:s}=t,o=eD(Number(s??i));return new n.Signature(et(e),et(r)).addRecoveryBit(o)}let e=G(t)?t:ei(t),r=eD(function(e,t={}){return Number(et(e,t))}(`0x${e.slice(130)}`));return n.Signature.fromCompact(e.substring(2,130)).addRecoveryBit(r)})().recoverPublicKey(i.substring(2)).toHex(!1);return`0x${s}`}function eD(e){if(0===e||1===e)return e;if(27===e)return 0;if(28===e)return 1;throw Error("Invalid yParityOrV value")}async function eL({hash:e,signature:t}){var r=await ek({hash:e,signature:t});let i=eT(`0x${r.substring(4)}`).substring(26);return function(e,t){if(eR.has(`${e}.undefined`))return eR.get(`${e}.${void 0}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),i=eT(eu(r),"bytes"),n=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)i[e>>1]>>4>=8&&n[e]&&(n[e]=n[e].toUpperCase()),(15&i[e>>1])>=8&&n[e+1]&&(n[e+1]=n[e+1].toUpperCase());let s=`0x${n.join("")}`;return eR.set(`${e}.${t}`,s),s}(`0x${i}`)}var eU=r(58222),eB=r(43757),ej=r(91074),e$=r(87358),ez=r(81029).Buffer;function eq(e){let[t,r]=e.split(":");return{namespace:t,reference:r}}function eH(e,t){return e.includes(":")?[e]:t.chains||[]}let eF={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"};function eW(){return"u">typeof e$&&"u">typeof e$.versions&&"u">typeof e$.versions.node}function eV(){return!(0,H.getDocument)()&&!!(0,H.getNavigator)()&&"ReactNative"===navigator.product}function eK(){return!eW()&&!!(0,H.getNavigator)()&&!!(0,H.getDocument)()}function eG(){return eV()?eF.reactNative:eW()?eF.node:eK()?eF.browser:eF.unknown}function eY(){var e;try{return eV()&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Application)?null==(e=r.g.Application)?void 0:e.applicationId:void 0}catch{return}}function eJ(){return(0,F.g)()||{name:"",description:"",url:"",icons:[""]}}function eX(e,t,i){let n=function(){if(eG()===eF.reactNative&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Platform)){let{OS:e,Version:t}=r.g.Platform;return[e,t].join("-")}let e=(0,q.o0)();if(null===e)return"unknown";let t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return"browser"===e.type?[t,e.name,e.version].join("-"):[t,e.version].join("-")}(),s=function(){var e;let t=eG();return t===eF.browser?[t,(null==(e=(0,H.getLocation)())?void 0:e.host)||"unknown"].join(":"):t}();return[[e,t].join("-"),["js",i].join("-"),n,s].join("/")}function eQ(e,t){return e.filter(e=>t.includes(e)).length===e.length}function eZ(e){return Object.fromEntries(e.entries())}function e0(e){return new Map(Object.entries(e))}function e1(e=j.FIVE_MINUTES,t){let r,i,n,s,o=(0,j.toMiliseconds)(e||j.FIVE_MINUTES);return{resolve:e=>{n&&r&&(clearTimeout(n),r(e),s=Promise.resolve(e))},reject:e=>{n&&i&&(clearTimeout(n),i(e))},done:()=>new Promise((e,a)=>{if(s)return e(s);n=setTimeout(()=>{let e=Error(t);s=Promise.reject(e),a(e)},o),r=e,i=a})}}function e2(e,t,r){return new Promise(async(i,n)=>{let s=setTimeout(()=>n(Error(r)),t);try{let t=await e;i(t)}catch(e){n(e)}clearTimeout(s)})}function e3(e,t){if("string"==typeof t&&t.startsWith(`${e}:`))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}if("id"===e.toLowerCase()){if("number"!=typeof t)throw Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw Error(`Unknown expirer target type: ${e}`)}function e8(e){let[t,r]=e.split(":"),i={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof r)i.topic=r;else if("id"===t&&Number.isInteger(Number(r)))i.id=Number(r);else throw Error(`Invalid target, expected id:number or topic:string, got ${t}:${r}`);return i}function e5(e,t){return(0,j.fromMiliseconds)((t||Date.now())+(0,j.toMiliseconds)(e))}function e6(e){return Date.now()>=(0,j.toMiliseconds)(e)}function e4(e,t){return`${e}${t?`:${t}`:""}`}function e9(e=[],t=[]){return[...new Set([...e,...t])]}async function e7({id:e,topic:t,wcDeepLink:i}){var n,s;try{if(!i)return;let o="string"==typeof i?JSON.parse(i):i,a=o?.href;if("string"!=typeof a)return;let c=function(e,t,r){let i=`requestId=${t}&sessionTopic=${r}`;e.endsWith("/")&&(e=e.slice(0,-1));let n=`${e}`;if(e.startsWith("https://t.me")){let t=e.includes("?")?"&startapp=":"?startapp=";n=`${n}${t}${function(e,t=!1){let r=ez.from(e).toString("base64");return t?r.replace(/[=]/g,""):r}(i,!0)}`}else n=`${n}/wc?${i}`;return n}(a,e,t),l=eG();if(l===eF.browser){let e;if(!(null!=(n=(0,H.getDocument)())&&n.hasFocus()))return void console.warn("Document does not have focus, skipping deeplink.");s=c,e="_self",!function(){try{return window.self!==window.top}catch{return!1}}()?("u">typeof window&&(window.TelegramWebviewProxy||window.Telegram||window.TelegramWebviewProxyProto)||s.startsWith("https://")||s.startsWith("http://"))&&(e="_blank"):e="_top",window.open(s,e,"noreferrer noopener")}else l===eF.reactNative&&"u">typeof(null==r.g?void 0:r.g.Linking)&&await r.g.Linking.openURL(c)}catch(e){console.error(e)}}async function te(e,t){let r="";try{if(eK()&&(r=localStorage.getItem(t)))return r;r=await e.getItem(t)}catch(e){console.error(e)}return r}function tt(e,t){if(!e.includes(t))return null;let r=e.split(/([&,?,=])/),i=r.indexOf(t);return r[i+2]}function tr(){return"u">typeof crypto&&null!=crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function ti(){return"u">typeof e$&&"true"===e$.env.IS_VITEST}function tn(e){return ez.from(e,"base64").toString("utf-8")}function ts(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function to(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function ta(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");ts(e.outputLen),ts(e.blockLen)}function tc(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function tl(e,t){to(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}let th=BigInt(0x100000000-1),tu=BigInt(32),td="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function tf(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function tp(e,t){return e<<32-t|e>>>t}let tg=68===new Uint8Array(new Uint32Array([0x11223344]).buffer)[0];function tm(e){for(let r=0;r<e.length;r++){var t;e[r]=(t=e[r])<<24&0xff000000|t<<8&0xff0000|t>>>8&65280|t>>>24&255}}function ty(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(e)),to(e),e}class tb{clone(){return this._cloneInto()}}function tw(e){let t=t=>e().update(ty(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function tv(e=32){if(td&&"function"==typeof td.getRandomValues)return td.getRandomValues(new Uint8Array(e));if(td&&"function"==typeof td.randomBytes)return td.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}let tx=[],tE=[],t_=[],tI=BigInt(0),tA=BigInt(1),tS=BigInt(2),tC=BigInt(7),tN=BigInt(256),tO=BigInt(113);for(let e=0,t=tA,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],tx.push(2*(5*i+r)),tE.push((e+1)*(e+2)/2%64);let n=tI;for(let e=0;e<7;e++)(t=(t<<tA^(t>>tC)*tO)%tN)&tS&&(n^=tA<<(tA<<BigInt(e))-tA);t_.push(n)}let[tP,tT]=function(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let n=0;n<e.length;n++){let{h:s,l:o}=function(e,t=!1){return t?{h:Number(e&th),l:Number(e>>tu&th)}:{h:0|Number(e>>tu&th),l:0|Number(e&th)}}(e[n],t);[r[n],i[n]]=[s,o]}return[r,i]}(t_,!0),tM=(e,t,r)=>r>32?((e,t,r)=>t<<r-32|e>>>64-r)(e,t,r):((e,t,r)=>e<<r|t>>>32-r)(e,t,r),tR=(e,t,r)=>r>32?((e,t,r)=>e<<r-32|t>>>64-r)(e,t,r):((e,t,r)=>t<<r|e>>>32-r)(e,t,r);class tk extends tb{constructor(e,t,r,i=!1,n=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ts(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}(this.state)}keccak(){tg||tm(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let i=(t+8)%10,n=(t+2)%10,s=r[n],o=r[n+1],a=tM(s,o,1)^r[i],c=tR(s,o,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],n=e[3];for(let r=0;r<24;r++){let i=tE[r],s=tM(t,n,i),o=tR(t,n,i),a=tx[r];t=e[a],n=e[a+1],e[a]=s,e[a+1]=o}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=tP[i],e[1]^=tT[i]}r.fill(0)}(this.state32,this.rounds),tg||tm(this.state32),this.posOut=0,this.pos=0}update(e){tc(this);let{blockLen:t,state:r}=this,i=(e=ty(e)).length;for(let n=0;n<i;){let s=Math.min(t-this.pos,i-n);for(let t=0;t<s;t++)r[this.pos++]^=e[n++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:i}=this;e[r]^=t,(128&t)!=0&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){tc(this,!1),to(e),this.finish();let t=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return ts(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(tl(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new tk(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}let tD=tw(()=>new tk(136,1,32));function tL(e){let t=`�Ethereum Signed Message: 500${e.length}`,r=new TextEncoder().encode(t+e);return"0x"+ez.from(tD(r)).toString("hex")}async function tU(e,t,r,i,n,s){switch(r.t){case"eip191":return await tB(e,t,r.s);case"eip1271":return await tj(e,t,r.s,i,n,s);default:throw Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}async function tB(e,t,r){return(await eL({hash:tL(t),signature:r})).toLowerCase()===e.toLowerCase()}async function tj(e,t,r,i,n,s){let o=eq(i);if(!o.namespace||!o.reference)throw Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${i}`);try{let o="0x1626ba7e",a=r.substring(2),c=tL(t).substring(2),l=o+c+"00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000041"+a,h=await fetch(`${s||"https://rpc.walletconnect.org/v1"}/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:Date.now()+Math.floor(1e3*Math.random()),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:l},"latest"]})}),{result:u}=await h.json();return!!u&&u.slice(0,o.length).toLowerCase()===o.toLowerCase()}catch(e){return console.error("isValidEip1271Signature: ",e),!1}}var t$=Object.defineProperty,tz=Object.defineProperties,tq=Object.getOwnPropertyDescriptors,tH=Object.getOwnPropertySymbols,tF=Object.prototype.hasOwnProperty,tW=Object.prototype.propertyIsEnumerable,tV=(e,t,r)=>t in e?t$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;let tK=e=>e?.split(":"),tG=e=>{let t=e&&tK(e);if(t)return t[2]+":"+t[3]},tY=e=>{let t=e&&tK(e);if(t)return t.pop()};async function tJ(e){let{cacao:t,projectId:r}=e,{s:i,p:n}=t,s=tX(n,n.iss),o=tY(n.iss);return await tU(o,s,i,tG(n.iss),r)}let tX=(e,t)=>{let r=`${e.domain} wants you to sign in with your Ethereum account:`,i=tY(t);if(!e.aud&&!e.uri)throw Error("Either `aud` or `uri` is required to construct the message");let n=e.statement||void 0,s=`URI: ${e.aud||e.uri}
500`,o=`Version: ${e.version}`,a=`Chain ID: ${(e=>{let t=e&&tK(e);if(t)return e.includes("did:pkh:")?t[3]:t[1]})(t)}`,c=`Nonce: ${e.nonce}`,l=`Issued At: ${e.iat}`,h=e.exp?`Expiration Time: ${e.exp}`:void 0,u=e.nbf?`Not Before: ${e.nbf}`:void 0,d=e.requestId?`Request ID: ${e.requestId}`:void 0,f=e.resources?`Resources:${e.resources.map(e=>` 501- ${e}`).join("")}`:void 0,p=t3(e.resources);return p&&(n=function(e="",t){tQ(t);let r="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(r))return e;let i=[],n=0;Object.keys(t.att).forEach(e=>{let r=Object.keys(t.att[e]).map(e=>({ability:e.split("/")[0],action:e.split("/")[1]}));r.sort((e,t)=>e.action.localeCompare(t.action));let s={};r.forEach(e=>{s[e.ability]||(s[e.ability]=[]),s[e.ability].push(e.action)});let o=Object.keys(s).map(t=>(n++,`(${n}) '${t}': '${s[t].join("', '")}' for '${e}'.`));i.push(o.join(", ").replace(".,","."))});let s=i.join(" "),o=`${r}${s}`;return`${e?e+" ":""}${o}`}(n,t0(p))),[r,i,"",n,"",s,o,a,c,l,h,u,d,f].filter(e=>null!=e).join(` 502`)};function tQ(e){if(!e)throw Error("No recap provided, value is undefined");if(!e.att)throw Error("No `att` property found");let t=Object.keys(e.att);if(!(null!=t&&t.length))throw Error("No resources found in `att` property");t.forEach(t=>{let r=e.att[t];if(Array.isArray(r)||"object"!=typeof r)throw Error(`Resource must be an object: ${t}`);if(!Object.keys(r).length)throw Error(`Resource object is empty: ${t}`);Object.keys(r).forEach(e=>{let t=r[e];if(!Array.isArray(t))throw Error(`Ability limits ${e} must be an array of objects, found: ${t}`);if(!t.length)throw Error(`Value of ${e} is empty array, must be an array with objects`);t.forEach(t=>{if("object"!=typeof t)throw Error(`Ability limits (${e}) must be an array of objects, found: ${t}`)})})})}function tZ(e){return tQ(e),`urn:recap:${ez.from(JSON.stringify(e)).toString("base64").replace(/=/g,"")}`}function t0(e){var t;let r=(t=e.replace("urn:recap:",""),JSON.parse(ez.from(t,"base64").toString("utf-8")));return tQ(r),r}function t1(e){var t;let r=t0(e);tQ(r);let i=null==(t=r.att)?void 0:t.eip155;return i?Object.keys(i).map(e=>e.split("/")[1]):[]}function t2(e){let t=t0(e);tQ(t);let r=[];return Object.values(t.att).forEach(e=>{Object.values(e).forEach(e=>{var t;null!=(t=e?.[0])&&t.chains&&r.push(e[0].chains)})}),[...new Set(r.flat())]}function t3(e){if(!e)return;let t=e?.[e.length-1];return t&&t.includes("urn:recap:")?t:void 0}function t8(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function t5(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function t6(e,...t){if(!t5(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function t4(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function t9(e){if("boolean"!=typeof e)throw Error(`boolean expected, not ${e}`)}let t7=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));if(68!==new Uint8Array(new Uint32Array([0x11223344]).buffer)[0])throw Error("Non little-endian hardware is not supported");function re(e){if("string"==typeof e)e=function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}(e);else if(t5(e))e=ri(e);else throw Error("Uint8Array expected, got "+typeof e);return e}function rt(e,t,r=!0){if(void 0===t)return new Uint8Array(e);if(t.length!==e)throw Error("invalid output length, expected "+e+", got: "+t.length);if(r&&t.byteOffset%4!=0)throw Error("invalid output, must be aligned");return t}function rr(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(0xffffffff),o=Number(r>>n&s),a=Number(r&s),c=4*!!i,l=4*!i;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)}function ri(e){return Uint8Array.from(e)}function rn(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}let rs=e=>Uint8Array.from(e.split("").map(e=>e.charCodeAt(0))),ro=rs("expand 16-byte k"),ra=rs("expand 32-byte k"),rc=t7(ro),rl=t7(ra);function rh(e,t){return e<<t|e>>>32-t}function ru(e){return e.byteOffset%4==0}
502let rd=0x100000000-1,rf=new Uint32Array,rp=(e,t)=>255&e[t++]|(255&e[t++])<<8;class rg{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t6(e=re(e),32);let t=rp(e,0),r=rp(e,2),i=rp(e,4),n=rp(e,6),s=rp(e,8),o=rp(e,10),a=rp(e,12),c=rp(e,14);this.r[0]=8191&t,this.r[1]=(t>>>13|r<<3)&8191,this.r[2]=(r>>>10|i<<6)&7939,this.r[3]=(i>>>7|n<<9)&8191,this.r[4]=(n>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|o<<2)&8191,this.r[7]=(o>>>11|a<<5)&8065,this.r[8]=(a>>>8|c<<8)&8191,this.r[9]=c>>>5&127;for(let t=0;t<8;t++)this.pad[t]=rp(e,16+2*t)}process(e,t,r=!1){let{h:i,r:n}=this,s=n[0],o=n[1],a=n[2],c=n[3],l=n[4],h=n[5],u=n[6],d=n[7],f=n[8],p=n[9],g=rp(e,t+0),m=rp(e,t+2),y=rp(e,t+4),b=rp(e,t+6),w=rp(e,t+8),v=rp(e,t+10),x=rp(e,t+12),E=rp(e,t+14),_=i[0]+(8191&g),I=i[1]+((g>>>13|m<<3)&8191),A=i[2]+((m>>>10|y<<6)&8191),S=i[3]+((y>>>7|b<<9)&8191),C=i[4]+((b>>>4|w<<12)&8191),N=i[5]+(w>>>1&8191),O=i[6]+((w>>>14|v<<2)&8191),P=i[7]+((v>>>11|x<<5)&8191),T=i[8]+((x>>>8|E<<8)&8191),M=i[9]+(E>>>5|2048*!r),R=0,k=0+_*s+5*p*I+5*f*A+5*d*S+5*u*C;R=k>>>13,k&=8191,k+=5*h*N+5*l*O+5*c*P+5*a*T+5*o*M,R+=k>>>13,k&=8191;let D=R+_*o+I*s+5*p*A+5*f*S+5*d*C;R=D>>>13,D&=8191,D+=5*u*N+5*h*O+5*l*P+5*c*T+5*a*M,R+=D>>>13,D&=8191;let L=R+_*a+I*o+A*s+5*p*S+5*f*C;R=L>>>13,L&=8191,L+=5*d*N+5*u*O+5*h*P+5*l*T+5*c*M,R+=L>>>13,L&=8191;let U=R+_*c+I*a+A*o+S*s+5*p*C;R=U>>>13,U&=8191,U+=5*f*N+5*d*O+5*u*P+5*h*T+5*l*M,R+=U>>>13,U&=8191;let B=R+_*l+I*c+A*a+S*o+C*s;R=B>>>13,B&=8191,B+=5*p*N+5*f*O+5*d*P+5*u*T+5*h*M,R+=B>>>13,B&=8191;let j=R+_*h+I*l+A*c+S*a+C*o;R=j>>>13,j&=8191,j+=N*s+5*p*O+5*f*P+5*d*T+5*u*M,R+=j>>>13,j&=8191;let $=R+_*u+I*h+A*l+S*c+C*a;R=$>>>13,$&=8191,$+=N*o+O*s+5*p*P+5*f*T+5*d*M,R+=$>>>13,$&=8191;let z=R+_*d+I*u+A*h+S*l+C*c;R=z>>>13,z&=8191,z+=N*a+O*o+P*s+5*p*T+5*f*M,R+=z>>>13,z&=8191;let q=R+_*f+I*d+A*u+S*h+C*l;R=q>>>13,q&=8191,q+=N*c+O*a+P*o+T*s+5*p*M,R+=q>>>13,q&=8191;let H=R+_*p+I*f+A*d+S*u+C*h;R=H>>>13,H&=8191,H+=N*l+O*c+P*a+T*o+M*s,R+=H>>>13,H&=8191,k=8191&(R=(R=(R<<2)+R|0)+k|0),R>>>=13,D+=R,i[0]=k,i[1]=D,i[2]=L,i[3]=U,i[4]=B,i[5]=j,i[6]=$,i[7]=z,i[8]=q,i[9]=H}finalize(){let{h:e,pad:t}=this,r=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let t=2;t<10;t++)e[t]+=i,i=e[t]>>>13,e[t]&=8191;e[0]+=5*i,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,r[0]=e[0]+5,i=r[0]>>>13,r[0]&=8191;for(let t=1;t<10;t++)r[t]=e[t]+i,i=r[t]>>>13,r[t]&=8191;r[9]-=8192;let n=(1^i)-1;for(let e=0;e<10;e++)r[e]&=n;n=~n;for(let t=0;t<10;t++)e[t]=e[t]&n|r[t];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let s=e[0]+t[0];e[0]=65535&s;for(let r=1;r<8;r++)s=(e[r]+t[r]|0)+(s>>>16)|0,e[r]=65535&s;rn(r)}update(e){t4(this);let{buffer:t,blockLen:r}=this,i=(e=re(e)).length;for(let n=0;n<i;){let s=Math.min(r-this.pos,i-n);if(s===r){for(;r<=i-n;n+=r)this.process(e,n);continue}t.set(e.subarray(n,n+s),this.pos),this.pos+=s,n+=s,this.pos===r&&(this.process(t,0,!1),this.pos=0)}return this}destroy(){rn(this.h,this.r,this.buffer,this.pad)}digestInto(e){t4(this),function(e,t){t6(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished=!0;let{buffer:t,h:r}=this,{pos:i}=this;if(i){for(t[i++]=1;i<16;i++)t[i]=0;this.process(t,0,!0)}this.finalize();let n=0;for(let t=0;t<8;t++)e[n++]=r[t]>>>0,e[n++]=r[t]>>>8;return e}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}}let rm=function(e){let t=(t,r)=>e(r).update(re(t)).digest(),r=e(new Uint8Array(32));return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}(e=>new rg(e)),ry=function(e,t){let{allowShortKeys:r,extendNonceFn:i,counterLength:n,counterRight:s,rounds:o}=function(e,t){if(null==t||"object"!=typeof t)throw Error("options must be defined");return Object.assign(e,t)}({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);
502if("function"!=typeof e)throw Error("core must be a function");return t8(n),t8(o),t9(s),t9(r),(t,a,c,l,h=0)=>{t6(t),t6(a),t6(c);let u=c.length;if(void 0===l&&(l=new Uint8Array(u)),t6(l),t8(h),h<0||h>=rd)throw Error("arx: counter overflow");if(l.length<u)throw Error(`arx: output (${l.length}) is shorter than data (${u})`);let d=[],f=t.length,p,g;if(32===f)d.push(p=ri(t)),g=rl;else if(16===f&&r)(p=new Uint8Array(32)).set(t),p.set(t,16),g=rc,d.push(p);else throw Error(`arx: invalid 32-byte key, got length=${f}`);ru(a)||d.push(a=ri(a));let m=t7(p);if(i){if(24!==a.length)throw Error("arx: extended nonce must be 24 bytes");i(g,m,t7(a.subarray(0,16)),m),a=a.subarray(16)}let y=16-n;if(y!==a.length)throw Error(`arx: nonce must be ${y} or 16 bytes`);if(12!==y){let e=new Uint8Array(12);e.set(a,s?0:12-a.length),a=e,d.push(a)}return function(e,t,r,i,n,s,o,a){let c=n.length,l=new Uint8Array(64),h=t7(l),u=ru(n)&&ru(s),d=u?t7(n):rf,f=u?t7(s):rf;for(let p=0;p<c;o++){if(e(t,r,i,h,o,a),o>=rd)throw Error("arx: counter overflow");let g=Math.min(64,c-p);if(u&&64===g){let e=p/4;if(p%4!=0)throw Error("arx: invalid block position");for(let t=0,r;t<16;t++)f[r=e+t]=d[r]^h[t];p+=64;continue}for(let e=0,t;e<g;e++)s[t=p+e]=n[t]^l[e];p+=g}}(e,g,m,t7(a),c,l,h,o),rn(...d),l}}(function(e,t,r,i,n,s=20){let o=e[0],a=e[1],c=e[2],l=e[3],h=t[0],u=t[1],d=t[2],f=t[3],p=t[4],g=t[5],m=t[6],y=t[7],b=r[0],w=r[1],v=r[2],x=o,E=a,_=c,I=l,A=h,S=u,C=d,N=f,O=p,P=g,T=m,M=y,R=n,k=b,D=w,L=v;for(let e=0;e<s;e+=2)O=O+(R=rh(R^(x=x+A|0),16))|0,x=x+(A=rh(A^O,12))|0,O=O+(R=rh(R^x,8))|0,A=rh(A^O,7),P=P+(k=rh(k^(E=E+S|0),16))|0,E=E+(S=rh(S^P,12))|0,P=P+(k=rh(k^E,8))|0,S=rh(S^P,7),T=T+(D=rh(D^(_=_+C|0),16))|0,_=_+(C=rh(C^T,12))|0,T=T+(D=rh(D^_,8))|0,C=rh(C^T,7),M=M+(L=rh(L^(I=I+N|0),16))|0,I=I+(N=rh(N^M,12))|0,M=M+(L=rh(L^I,8))|0,N=rh(N^M,7),T=T+(L=rh(L^(x=x+S|0),16))|0,x=x+(S=rh(S^T,12))|0,T=T+(L=rh(L^x,8))|0,S=rh(S^T,7),M=M+(R=rh(R^(E=E+C|0),16))|0,E=E+(C=rh(C^M,12))|0,M=M+(R=rh(R^E,8))|0,C=rh(C^M,7),O=O+(k=rh(k^(_=_+N|0),16))|0,_=_+(N=rh(N^O,12))|0,O=O+(k=rh(k^_,8))|0,N=rh(N^O,7),P=P+(D=rh(D^(I=I+A|0),16))|0,I=I+(A=rh(A^P,12))|0,P=P+(D=rh(D^I,8))|0,A=rh(A^P,7);let U=0;i[U++]=o+x|0,i[U++]=a+E|0,i[U++]=c+_|0,i[U++]=l+I|0,i[U++]=h+A|0,i[U++]=u+S|0,i[U++]=d+C|0,i[U++]=f+N|0,i[U++]=p+O|0,i[U++]=g+P|0,i[U++]=m+T|0,i[U++]=y+M|0,i[U++]=n+R|0,i[U++]=b+k|0,i[U++]=w+D|0,i[U++]=v+L|0},{counterRight:!1,counterLength:4,allowShortKeys:!1}),rb=new Uint8Array(16),rw=(e,t)=>{e.update(t);let r=t.length%16;r&&e.update(rb.subarray(r))},rv=new Uint8Array(32);function rx(e,t,r,i,n){let s=e(t,r,rv),o=rm.create(s);n&&rw(o,n),rw(o,i);let a=new Uint8Array(16),c=new DataView(a.buffer,a.byteOffset,a.byteLength);rr(c,0,BigInt(n?n.length:0),!0),rr(c,8,BigInt(i.length),!0),o.update(a);let l=o.digest();return rn(s,a),l}let rE=((e,t)=>{function r(i,...n){if(t6(i),void 0!==e.nonceLength){let t=n[0];if(!t)throw Error("nonce / iv required");e.varSizeNonce?t6(t):t6(t,e.nonceLength)}let s=e.tagLength;s&&void 0!==n[1]&&t6(n[1]);let o=t(i,...n),a=(e,t)=>{if(void 0!==t){if(2!==e)throw Error("cipher output not supported");t6(t)}},c=!1;return{encrypt(e,t){if(c)throw Error("cannot encrypt() twice with same key + nonce");return c=!0,t6(e),a(o.encrypt.length,t),o.encrypt(e,t)},decrypt(e,t){if(t6(e),s&&e.length<s)throw Error("invalid ciphertext length: smaller than tagLength="+s);return a(o.decrypt.length,t),o.decrypt(e,t)}}}return Object.assign(r,e),r})({blockSize:64,nonceLength:12,tagLength:16},(e=>(t,r,i)=>({encrypt(n,s){let o=n.length;(s=rt(o+16,s,!1)).set(n);let a=s.subarray(0,-16);e(t,r,a,a,1);let c=rx(e,t,r,a,i);return s.set(c,o),rn(c),s},decrypt(n,s){s=rt(n.length-16,s,!1);let o=n.subarray(0,-16),a=n.subarray(-16),c=rx(e,t,r,o,i);if(!function(e,t){if(e.length!==t.length)return!1;let r=0;for(let i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r}(a,c))throw Error("invalid tag");return s.set(n.subarray(0,-16)),e(t,r,s,s,1),rn(c),s}}))(ry));class r_ extends tb{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ta(e);let r=ty(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,n=new Uint8Array(i);n.set(r.length>i?e.create().update(r).digest():r);for(let e=0;e<n.length;e++)n[e]^=54;this.iHash.update(n),this.oHash=e.create();for(let e=0;e<n.length;e++)n[e]^=106;this.oHash.update(n),n.fill(0)}update(e){return tc(this),this.iHash.update(e),this}digestInto(e){tc(this),to(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:r,finished:i,destroyed:n,blockLen:s,outputLen:o}=this;return e.finished=i,e.destroyed=n,e.blockLen=s,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let rI=(e,t,r)=>new r_(e,t).update(r).digest();rI.create=(e,t)=>
502new r_(e,t);let rA=new Uint8Array([0]),rS=new Uint8Array;class rC extends tb{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=tf(this.buffer)}update(e){tc(this);let{view:t,buffer:r,blockLen:i}=this,n=(e=ty(e)).length;for(let s=0;s<n;){let o=Math.min(i-this.pos,n-s);if(o===i){let t=tf(e);for(;i<=n-s;s+=i)this.process(t,s);continue}r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){tc(this),tl(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:i,isLE:n}=this,{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(r,0),s=0);for(let e=s;e<i;e++)t[e]=0;(function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(0xffffffff),o=Number(r>>n&s),a=Number(r&s),c=4*!!i,l=4*!i;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)})(r,i-8,BigInt(8*this.length),n),this.process(r,0);let o=tf(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=a/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)o.setUint32(4*e,l[e],n)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:i,finished:n,destroyed:s,pos:o}=this;return e.length=i,e.pos=o,e.finished=n,e.destroyed=s,i%t&&e.buffer.set(r),e}}let rN=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),rO=new Uint32Array([0x6a09e66
5027,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),rP=new Uint32Array(64);class rT extends rC{constructor(){super(64,32,8,!1),this.A=0|rO[0],this.B=0|rO[1],this.C=0|rO[2],this.D=0|rO[3],this.E=0|rO[4],this.F=0|rO[5],this.G=0|rO[6],this.H=0|rO[7]}get(){let{A:e,B:t,C:r,D:i,E:n,F:s,G:o,H:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)rP[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=rP[e-15],r=rP[e-2],i=tp(t,7)^tp(t,18)^t>>>3,n=tp(r,17)^tp(r,19)^r>>>10;rP[e]=n+rP[e-7]+i+rP[e-16]|0}let{A:r,B:i,C:n,D:s,E:o,F:a,G:c,H:l}=this;for(let e=0;e<64;e++){var h,u,d,f;let t=l+(tp(o,6)^tp(o,11)^tp(o,25))+((h=o)&a^~h&c)+rN[e]+rP[e]|0,p=(tp(r,2)^tp(r,13)^tp(r,22))+((u=r)&(d=i)^u&(f=n)^d&f)|0;l=c,c=a,a=o,o=s+t|0,s=n,n=i,i=r,r=t+p|0}r=r+this.A|0,i=i+this.B|0,n=n+this.C|0,s=s+this.D|0,o=o+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,i,n,s,o,a,c,l)}roundClean(){rP.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let rM=tw(()=>new rT),rR=BigInt(0);function rk(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function rD(e){if(!rk(e))throw Error("Uint8Array expected")}let rL=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),rU={_0:48,_9:57,A:65,F:70,a:97,f:102};function rB(e){return e>=rU._0&&e<=rU._9?e-rU._0:e>=rU.A&&e<=rU.F?e-(rU.A-10):e>=rU.a&&e<=rU.f?e-(rU.a-10):void 0}function rj(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let i=new Uint8Array(r);for(let t=0,n=0;t<r;t++,n+=2){let r=rB(e.charCodeAt(n)),s=rB(e.charCodeAt(n+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[n]+e[n+1])+'" at index '+n);i[t]=16*r+s}return i}function r$(e){return rD(e),function(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?rR:BigInt("0x"+e)}(function(e){rD(e);let t="";for(let r=0;r<e.length;r++)t+=rL[e[r]];return t}(Uint8Array.from(e).reverse()))}function rz(e,t,r){let i;if("string"==typeof t)try{i=rj(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if(rk(t))i=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let n=i.length;if("number"==typeof r&&n!==r)throw Error(e+" of length "+r+" expected, got "+n);return i}let rq=e=>"bigint"==typeof e&&rR<=e;function rH(e,t,r,i){if(!(rq(t)&&rq(r)&&rq(i))||!(r<=t)||!(t<i))throw Error("expected valid "+e+": "+r+" <= n < "+i+", got "+t)}let rF={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||rk(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)},rW=BigInt(0),rV=BigInt(1);function rK(e,t){let r=e%t;return r>=rW?r:t+r}function rG(e,t,r){let i=e;for(;t-- >rW;)i*=i,i%=r;return i}BigInt(0),BigInt(1),BigInt(0),BigInt(1),BigInt(2),BigInt(8);let rY=BigInt(0),rJ=BigInt(1),rX=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);let rQ=BigInt(1),rZ=BigInt(2),r0=BigInt(3),r1=BigInt(5);BigInt(8);let r2=function(e){let t=(function(e,t,r={}){let i=(t,r,i)=>{let n=rF[r];if("function"!=typeof n)throw Error("invalid validator function");let s=e[t];if(!(i&&void 0===s)&&!n(s,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))i(e,r,!1);for(let[e,t]of Object.entries(r))i(e,t,!0)}(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})),{P:r}=t,i=e=>rK(e,r),n=t.montgomeryBits,s=Math.ceil(n/8),o=t.nByteLength,a=t.adjustScalarBytes||(e=>e),c=t.powPminus2||(e=>(function(e,t,r){if(t<rW)throw Error("invalid exponent, negatives unsupported");if(r<=rW)throw Error("invalid modulus");if(r===rV)return rW;let i=rV;for(;t>rW;)t&rV&&(i=i*e%r),e=e*e%r,t>>=rV;return i})(e,r-BigInt(2),r));function l(e,t,r){let n=i(e*(t-r));return[t=i(t-n),r=i(r+n)]}let h=(t.a-BigInt(2))/BigInt(4);function u(e){var t;return t=i(e),rj(t.toString(16).padStart(2*s,"0")).reverse()}function d(e,t){let d=function(e,t){rH("u",e,rY,r),rH("scalar",t,rY,r);let s=rJ,o=rY,a=e,u=rJ,d=rY,f;for(let r=BigInt(n-1);r>=rY;r--){let n=t>>r&rJ;d^=n,s=(f=l(d,s,a))[0],a=f[1],o=(f=l(d,o,u))[0],u=f[1],d=n;let c=s+o,p=i(c*c),g=s-o,m=i(g*g),y=p-m,b=a+u,w=i((a-u)*c),v=i(b*g),x=w+v,E=w-v;a=i(x*x),u=i(e*i(E*E)),s=i(p*m),o=i(y*(p+i(h*y)))}return s=(f=l(d,s,a))[0],a=f[1],o=(f=l(d,o,u))[0],u=f[1],i(s*c(o))}(function(e){let t=rz("u coordinate",e,s);return 32===o&&(t[31]&=127),r$(t)}(t),function(e){let t=rz("scalar",e),r=t.length;if(r!==s&&r!==o)throw Error("invalid scalar, expected "+(""+s+" or ")+o+" bytes, got "+r);return r$(a(t))}(e));if(d===rY)throw Error("invalid private or public key received");return u(d)}let f=u(t.Gu);function p(e){return d(e,f)}return{scalarMult:d,scalarMultBase:p,getSharedSecret:(e,t)=>d(e,t),getPublicKey:e=>p(e),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:f}}({P:rX,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{let{pow_p_5_8:t,b2:r}=function(e){let t=BigInt(10),r=BigInt(20),i=BigInt(40),n=BigInt(80),s=e*e%rX*e%rX,o=rG(s,rZ,rX)*s%rX,a=rG(o,rQ,rX)*e%rX,c=rG(a,r1,rX)*
502a%rX,l=rG(c,t,rX)*c%rX,h=rG(l,r,rX)*l%rX,u=rG(h,i,rX)*h%rX,d=rG(u,n,rX)*u%rX,f=rG(d,n,rX)*u%rX,p=rG(f,t,rX)*c%rX;return{pow_p_5_8:rG(p,rZ,rX)*e%rX,b2:s}}(e);return rK(rG(t,r0,rX)*r,rX)},adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},randomBytes:tv}),r3="base10",r8="base16",r5="base64pad",r6="base64url",r4="utf8";function r9(){let e=tv(32);return(0,eU.dI)(e,r8)}function r7(e){let t=rM((0,eU.sH)(e,r8));return(0,eU.dI)(t,r8)}function ie(e){let t=rM((0,eU.sH)(e,r4));return(0,eU.dI)(t,r8)}function it(e){return(0,eU.sH)(`${e}`,r3)}function ir(e){return Number((0,eU.dI)(e,r3))}function ii(e){let{encoding:t=r5}=e;if(2===ir(e.type))return(0,eU.dI)((0,eU.xW)([e.type,e.sealed]),t);if(1===ir(e.type)){if(typeof e.senderPublicKey>"u")throw Error("Missing sender public key for type 1 envelope");return(0,eU.dI)((0,eU.xW)([e.type,e.senderPublicKey,e.iv,e.sealed]),t)}return(0,eU.dI)((0,eU.xW)([e.type,e.iv,e.sealed]),t)}function is(e){let{encoded:t,encoding:r=r5}=e,i=(0,eU.sH)(t,r),n=i.slice(0,1);if(1===ir(n)){let e=i.slice(1,33),t=i.slice(33,45);return{type:n,sealed:i.slice(45),iv:t,senderPublicKey:e}}if(2===ir(n))return{type:n,sealed:i.slice(1),iv:tv(12)};let s=i.slice(1,13);return{type:n,sealed:i.slice(13),iv:s}}function io(e){let t=e?.type||0;if(1===t){if(typeof e?.senderPublicKey>"u")throw Error("missing sender public key");if(typeof e?.receiverPublicKey>"u")throw Error("missing receiver public key")}return{type:t,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function ia(e){return 1===e.type&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}function ic(e){return e?.relay||{protocol:"irn"}}function il(e){let t=ej.CG[e];if(typeof t>"u")throw Error(`Relay Protocol not supported: ${e}`);return t}function ih(e){var t;if(!e.includes("wc:")){let t=tn(e);null!=t&&t.includes("wc:")&&(e=t)}let r=(e=(e=e.includes("wc://")?e.replace("wc://",""):e).includes("wc:")?e.replace("wc:",""):e).indexOf(":"),i=-1!==e.indexOf("?")?e.indexOf("?"):void 0,n=e.substring(0,r),s=e.substring(r+1,i).split("@"),o=new URLSearchParams("u">typeof i?e.substring(i):""),a={};o.forEach((e,t)=>{a[t]=e});let c="string"==typeof a.methods?a.methods.split(","):void 0;return{protocol:n,topic:(t=s[0]).startsWith("//")?t.substring(2):t,version:parseInt(s[1],10),symKey:a.symKey,relay:function(e,t="-"){let r={},i="relay"+t;return Object.keys(e).forEach(t=>{if(t.startsWith(i)){let n=t.replace(i,""),s=e[t];r[n]=s}}),r}(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function iu(e){let t=new URLSearchParams,r=function(e,t="-"){let r={};return Object.keys(e).forEach(i=>{e[i]&&(r["relay"+t+i]=e[i])}),r}(e.relay);Object.keys(r).sort().forEach(e=>{t.set(e,r[e])}),t.set("symKey",e.symKey),e.expiryTimestamp&&t.set("expiryTimestamp",e.expiryTimestamp.toString()),e.methods&&t.set("methods",e.methods.join(","));let i=t.toString();return`${e.protocol}:${e.topic}@${e.version}?${i}`}function id(e,t,r){return`${e}?wc_ev=${r}&topic=${t}`}function ip(e){let t=[];return e.forEach(e=>{let[r,i]=e.split(":");t.push(`${r}:${i}`)}),t}function ig(e){return e.includes(":")}function im(e){return ig(e)?e.split(":")[0]:e}function iy(e,t){let r=function(e){let t={};return e?.forEach(e=>{var r;let[i,n]=e.split(":");t[i]||(t[i]={accounts:[],chains:[],events:[],methods:[]}),t[i].accounts.push(e),null==(r=t[i].chains)||r.push(`${i}:${n}`)}),t}(t=t.map(e=>e.replace("did:pkh:","")));for(let[t,i]of Object.entries(r))i.methods?i.methods=e9(i.methods,e):i.methods=e,i.events=["chainChanged","accountsChanged"];return r}Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;let ib={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},iw={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function iv(e,t){let{message:r,code:i}=iw[e];return{message:t?`${r} ${t}`:r,code:i}}function ix(e,t){let{message:r,code:i}=ib[e];return{message:t?`${r} ${t}`:r,code:i}}function iE(e,t){return!!Array.isArray(e)&&(!("u">typeof t)||!e.length||e.every(t))}function i_(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function iI(e){return typeof e>"u"}function iA(e,t){return!!(t&&iI(e))||"string"==typeof e&&!!e.trim().length}function iS(e,t){return!!(t&&iI(e))||"number"==typeof e&&!isNaN(e)}function iC(e){return!!(iA(e,!1)&&e.includes(":"))&&2===e.split(":").length}function iN(e){let t=!0;return iE(e)?e.length&&(t=e.every(e=>
502iA(e,!1))):t=!1,t}function iO(e,t){let r=null;return Object.values(e).forEach(e=>{var i;let n;if(r)return;let s=(i=`${t}, namespace`,n=null,iN(e?.methods)?iN(e?.events)||(n=ix("UNSUPPORTED_EVENTS",`${i}, events should be an array of strings or empty array for no events`)):n=ix("UNSUPPORTED_METHODS",`${i}, methods should be an array of strings or empty array for no methods`),n);s&&(r=s)}),r}function iP(e,t){let r=null;if(e&&i_(e)){let i,n=iO(e,t);n&&(r=n);let s=(i=null,Object.values(e).forEach(e=>{var r,n;let s;if(i)return;let o=(r=e?.accounts,n=`${t} namespace`,s=null,iE(r)?r.forEach(e=>{s||function(e){if(iA(e,!1)&&e.includes(":")){let t=e.split(":");if(3===t.length){let e=t[0]+":"+t[1];return!!t[2]&&iC(e)}}return!1}(e)||(s=ix("UNSUPPORTED_ACCOUNTS",`${n}, account ${e} should be a string and conform to "namespace:chainId:address" format`))}):s=ix("UNSUPPORTED_ACCOUNTS",`${n}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),s);o&&(i=o)}),i);s&&(r=s)}else r=iv("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return r}function iT(e){return iA(e.protocol,!0)}function iM(e){return"u">typeof e}function iR(e,t){return!(!iC(t)||!(function(e){let t=[];return Object.values(e).forEach(e=>{t.push(...ip(e.accounts))}),t})(e).includes(t))}function ik(e,t,r){let i=null,n=function(e){let t={};return Object.keys(e).forEach(r=>{var i;r.includes(":")?t[r]=e[r]:null==(i=e[r].chains)||i.forEach(i=>{t[i]={methods:e[r].methods,events:e[r].events}})}),t}(e),s=function(e){let t={};return Object.keys(e).forEach(r=>{if(r.includes(":"))t[r]=e[r];else{let i=ip(e[r].accounts);i?.forEach(i=>{t[i]={accounts:e[r].accounts.filter(e=>e.includes(`${i}:`)),methods:e[r].methods,events:e[r].events}})}}),t}(t),o=Object.keys(n),a=Object.keys(s),c=iD(Object.keys(e)),l=iD(Object.keys(t)),h=c.filter(e=>!l.includes(e));return h.length&&(i=iv("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. 503 Required: ${h.toString()} 504 Received: ${Object.keys(t).toString()}`)),eQ(o,a)||(i=iv("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. 505 Required: ${o.toString()} 506 Approved: ${a.toString()}`)),Object.keys(t).forEach(e=>{if(!e.includes(":")||i)return;let n=ip(t[e].accounts);n.includes(e)||(i=iv("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${e} 507 Required: ${e} 508 Approved: ${n.toString()}`))}),o.forEach(e=>{i||(eQ(n[e].methods,s[e].methods)?eQ(n[e].events,s[e].events)||(i=iv("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${e}`)):i=iv("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${e}`))}),i}function iD(e){return[...new Set(e.map(e=>e.includes(":")?e.split(":")[0]:e))]}function iL(){let e=eG();return new Promise(t=>{switch(e){case eF.browser:t(eK()&&navigator?.onLine);break;case eF.reactNative:t(iU());break;case eF.node:default:t(!0)}})}async function iU(){if(eV()&&"u">typeof r.g&&null!=r.g&&r.g.NetInfo){let e=await (null==r.g?void 0:r.g.NetInfo.fetch());return e?.isConnected}return!0}let iB={};class ij{static get(e){return iB[e]}static set(e,t){iB[e]=t}static delete(e){delete iB[e]}}var i$=r(4871),iz=r(50155),iq=r(11419),iH=r(15168),iF=r.n(iH);let iW="core",iV=`wc@2:${iW}:`,iK={logger:"error"},iG={database:":memory:"},iY="client_ed25519_seed",iJ=j.ONE_DAY,iX=j.SIX_HOURS,iQ="wss://relay.walletconnect.org",iZ={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},i0={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},i1="2.19.0",i2={link_mode:"link_mode",relay:"relay"},i3="WALLETCONNECT_LINK_MODE_APPS",i8={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},i5=1e3*j.FIVE_SECONDS,i6={wc_pairingDelete:{req:{ttl:j.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:j.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:j.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:j.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:j.ONE_DAY,prompt:!1,tag:0},res:{ttl:j.ONE_DAY,prompt:!1,tag:0}}},i4={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},i9={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},i7={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},ne="https://verify.walletconnect.org",nt=`${ne}/v3`,nr=["https://verify.walletconnect.com",ne],ni={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},nn={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},ns={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},no={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},na={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"}
508,nc={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"};var nl=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==r[o])throw TypeError(s+" is ambiguous");r[o]=n}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function u(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[0]){for(var i=0,n=0;e[t]===c;)i++,t++;for(var s=(e.length-t)*l+1>>>0,o=new Uint8Array(s);e[t];){var h=r[e.charCodeAt(t)];if(255===h)return;for(var u=0,d=s-1;(0!==h||u<n)&&-1!==d;d--,u++)h+=a*o[d]>>>0,o[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw Error("Non-zero carry");n=u,t++}if(" "!==e[t]){for(var f=s-n;f!==s&&0===o[f];)f++;for(var p=new Uint8Array(i+(s-f)),g=i;f!==s;)p[g++]=o[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*h+1>>>0,l=new Uint8Array(o);n!==s;){for(var u=t[n],d=0,f=o-1;(0!==u||d<i)&&-1!==f;f--,d++)u+=256*l[f]>>>0,l[f]=u%a>>>0,u=u/a>>>0;if(0!==u)throw Error("Non-zero carry");i=d,n++}for(var p=o-i;p!==o&&0===l[p];)p++;for(var g=c.repeat(r);p<o;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:u,decode:function(e){var r=u(e);if(r)return r;throw Error(`Non-${t} character`)}}};let nh=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error("Unknown type, must be binary type")};class nu{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class nd{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return np(this,e)}}class nf{constructor(e){this.decoders=e}or(e){return np(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}let np=(e,t)=>new nf({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});
508class ng{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new nu(e,t,r),this.decoder=new nd(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let nm=({name:e,prefix:t,encode:r,decode:i})=>new ng(e,t,r,i),ny=({prefix:e,name:t,alphabet:r})=>{let{encode:i,decode:n}=nl(r,t);return nm({prefix:e,name:t,encode:i,decode:e=>nh(n(e))})},nb=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>nm({prefix:t,name:e,encode:e=>((e,t,r)=>{let i="="===t[t.length-1],n=(1<<r)-1,s="",o=0,a=0;for(let i=0;i<e.length;++i)for(a=a<<8|e[i],o+=8;o>r;)o-=r,s+=t[n&a>>o];if(o&&(s+=t[n&a<<r-o]),i)for(;s.length*r&7;)s+="=";return s})(e,i,r),decode:t=>((e,t,r,i)=>{let n={};for(let e=0;e<t.length;++e)n[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;let o=new Uint8Array(s*r/8|0),a=0,c=0,l=0;for(let t=0;t<s;++t){let s=n[e[t]];if(void 0===s)throw SyntaxError(`Non-${i} character`);c=c<<r|s,(a+=r)>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw SyntaxError("Unexpected end of data");return o})(t,i,r,e)});var nw=Object.freeze({__proto__:null,identity:nm({prefix:"\0",name:"identity",encode:e=>new TextDecoder().decode(e),decode:e=>new TextEncoder().encode(e)})}),nv=Object.freeze({__proto__:null,base2:nb({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})}),nx=Object.freeze({__proto__:null,base8:nb({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})}),nE=Object.freeze({__proto__:null,base10:ny({prefix:"9",name:"base10",alphabet:"0123456789"})}),n_=Object.freeze({__proto__:null,base16:nb({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper:nb({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});let nI=nb({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),nA=nb({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),nS=nb({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),nC=nb({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),nN=nb({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),nO=nb({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),nP=nb({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5});var nT=Object.freeze({__proto__:null,base32:nI,base32upper:nA,base32pad:nS,base32padupper:nC,base32hex:nN,base32hexupper:nO,base32hexpad:nP,base32hexpadupper:nb({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z:nb({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}),nM=Object.freeze({__proto__:null,base36:ny({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper:ny({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})}),nR=Object.freeze({__proto__:null,base58btc:ny({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr:ny({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});let nk=nb({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),nD=nb({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6});var nL=Object.freeze({__proto__:null,base64:nk,base64pad:nD,base64url:nb({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad:nb({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});let nU=Array.from("\uD83D\uDE80\uD83E\uDE90â\uD83D\uDEF0\uD83C\uDF0C\uD83C\uDF11\uD83C\uDF12\uD83C\uDF13\uD83C\uDF14\uD83C\uDF15\uD83C\uDF16\uD83C\uDF17\uD83C\uDF18\uD83C\uDF0D\uD83C\uDF0F\uD83C\uDF0E\uD83D\uDC09â\uD83D\uDCBB\uD83D\uDDA5\uD83D\uDCBE\uD83D\uDCBF\uD83D\uDE02â¤\uD83D\uDE0D\uD83E\uDD23\uD83D\uDE0A\uD83D\uDE4F\uD83D\uDC95\uD83D\uDE2D\uD83D\uDE18\uD83D\uDC4D\uD83D\uDE05\uD83D\uDC4F\uD83D\uDE01\uD83D\uDD25\uD83E\uDD70\uD83D\uDC94\uD83D\uDC96\uD83D\uDC99\uD83D\uDE22\uD83E\uDD14\uD83D\uDE06\uD83D\uDE44\uD83D\uDCAA\uD83D\uDE09âº\uD83D\uDC4C\uD83E\uDD17\uD83D\uDC9C\uD83D\uDE14\uD83D\uDE0E\uD83D\uDE07\uD83C\uDF39\uD83E\uDD26\uD83C\uDF89\uD83D\uDC9Eââ¨\uD83E\uDD37\uD83D\uDE31\uD83D\uDE0C\uD83C\uDF38\uD83D\uDE4C\uD83D\uDE0B\uD83D\uDC97\uD83D\uDC9A\uD83D\uDE0F\uD83D\uDC9B\uD83D\uDE42\uD83D\uDC93\uD83E\uDD29\uD83D\uDE04\uD83D\uDE00\uD83D\uDDA4\uD83D\uDE03\uD83D\uDCAF\uD83D\uDE48\uD83D\uDC47\uD83C\uDFB6\uD83D\uDE12\uD83E\uDD2Dâ£\uD83D\uDE1C\uD83D\uDC8B\uD83D\uDC40\uD83D\uDE2A\uD83D\uDE11\uD83D\uDCA5\uD83D\uDE4B\uD83D\uDE1E\uD83D\uDE29\uD83D\uDE21\uD83E\uDD2A\uD83D\uDC4A\uD83E\uDD73\uD83D\uDE25\uD83E\uDD24\uD83D\uDC49\uD83D\uDC83\uD83D\uDE33â\uD83D\uDE1A\uD83D\uDE1D\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE2C\uD83D\uDE43\uD83C\uDF40\uD83C\uDF37\uD83D\uDE3B\uD83D\uDE13ââ
\uD83E\uDD7A\uD83C\uDF08\uD83D\uDE08\uD83E\uDD18\uD83D\uDCA6â\uD83D\uDE23\uD83C\uDFC3\uD83D\uDC90â¹\uD83C\uDF8A\uD83D\uDC98\uD83D\uDE20â\uD83D\uDE15\uD83C\uDF3A\uD83C\uDF82\uD83C\uDF3B\uD83D\uDE10\uD83D\uDD95\uD83D\uDC9D\uD83D\uDE4A\uD83D\uDE39\uD83D\uDDE3\uD83D\uDCAB\uD83D\uDC80\uD83D\uDC51\uD83C\uDFB5\uD83E\uDD1E\uD83D\uDE1B\uD83D\uDD34\uD83D\uDE24\uD83C\uDF3C\uD83D\uDE2Bâ½\uD83E\uDD19â\uD83C\uDFC6\uD83E\uDD2B\uD83D\uDC48\uD83D\uDE2E\uD83D\uDE46\uD83C\uDF7B\uD83C\uDF43\uD83D\uDC36\uD83D\uDC81\uD83D\uDE32\uD83C\uDF3F\uD83E\uDDE1\uD83C\uDF81â¡\uD83C\uDF1E\uD83C\uDF88ââ\uD83D\uDC4B\uD83D\uDE30\uD83E\uDD28\uD83D\uDE36\uD83E\uDD1D\uD83D\uDEB6\uD83D\uDCB0\uD83C\uDF53\uD83D\uDCA2\uD83E\uDD1F\uD83D\uDE41\uD83D\uDEA8\uD83D\uDCA8\uD83E\uDD2Câ\uD83C\uDF80\uD83C\uDF7A\uD83E\uDD13\uD83D\uDE19\uD83D\uDC9F\uD83C\uDF31\uD83D\uDE16\uD83D\uDC76\uD83E\uDD74â¶â¡â\uD83D\uDC8E\uD83D\uDCB8â¬\uD83D\uDE28\uD83C\uDF1A\uD83E\uDD8B\uD83D\uDE37\uD83D\uDD7Aâ \uD83D\uDE45\uD83D\uDE1F\uD83D\uDE35\uD83D\uDC4E\uD83E\uDD32\uD83E\uDD20\uD83E\uDD27\uD83D\uDCCC\uD83D\uDD35\uD83D\uDC85\uD83E\uDDD0\uD83D\uDC3E\uD83C\uDF52\uD83D\uDE17\uD83E\uDD11\uD83C\uDF0A\uD83E\uDD2F\uD83D\uDC37â\uD83D\uDCA7\uD83D\uDE2F\uD83D\uDC86\uD83D\uDC46\uD83C\uDFA4\uD83D\uDE47\uD83C\uDF51â\uD83C\uDF34\uD83D\uDCA3\uD83D\uDC38\uD83D\uDC8C\uD83D\uDCCD\uD83E\uDD40\uD83E\uDD22\uD83D\uDC45\uD83D\uDCA1\uD83D\uDCA9\uD83D\uDC50\uD83D\uDCF8\uD83D\uDC7B\uD83E\uDD10\uD83E\uDD2E\uD83C\uDFBC\uD83E\uDD75\uD83D\uDEA9\uD83C\uDF4E\uD83C\uDF4A\uD83D\uDC7C\uD83D\uDC8D\uD83D\uDCE3\uD83E\uDD42"),nB=nU.reduce((e,t,r)=>(e[r]=t,e),[]),nj=nU.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);var n$=Object.freeze({__proto__:null,base256emoji:nm({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>
508e+=nB[t],"")},decode:function(e){let t=[];for(let r of e){let e=nj[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}})});function nz(e,t,r){t=t||[],r=r||0;for(var i=r;e>=0x80000000;)t[r++]=255&e|128,e/=128;for(;-128&e;)t[r++]=255&e|128,e>>>=7;return t[r]=0|e,nz.bytes=r-i+1,t}var nq={encode:nz,encodingLength:function(e){return e<128?1:e<16384?2:e<2097152?3:e<0x10000000?4:e<0x800000000?5:e<0x40000000000?6:e<0x2000000000000?7:e<0x100000000000000?8:e<0x8000000000000000?9:10}};let nH=(e,t,r=0)=>(nq.encode(e,t,r),t),nF=e=>nq.encodingLength(e),nW=(e,t)=>{let r=t.byteLength,i=nF(e),n=i+nF(r),s=new Uint8Array(n+r);return nH(e,s,0),nH(r,s,i),s.set(t,n),new nV(e,r,t,s)};class nV{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}let nK=({name:e,code:t,encode:r})=>new nG(e,t,r);class nG{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?nW(this.code,t):t.then(e=>nW(this.code,e))}throw Error("Unknown type, must be binary type")}}let nY=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));var nJ=Object.freeze({__proto__:null,sha256:nK({name:"sha2-256",code:18,encode:nY("SHA-256")}),sha512:nK({name:"sha2-512",code:19,encode:nY("SHA-512")})}),nX=Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:nh,digest:e=>nW(0,nh(e))}});new TextEncoder,new TextDecoder;let nQ={...nw,...nv,...nx,...nE,...n_,...nT,...nM,...nR,...nL,...n$};function nZ(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}({...nJ,...nX});let n0=nZ("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),n1=nZ("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{let t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),n2={utf8:n0,"utf-8":n0,hex:nQ.base16,latin1:n1,ascii:n1,binary:n1,...nQ};var n3=Object.defineProperty,n8=(e,t,r)=>((e,t,r)=>t in e?n3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class n5{constructor(e,t){this.core=e,this.logger=t,n8(this,"keychain",new Map),n8(this,"name","keychain"),n8(this,"version","0.3"),n8(this,"initialized",!1),n8(this,"storagePrefix",iV),n8(this,"init",async()=>{if(!this.initialized){let e=await this.getKeyChain();"u">typeof e&&(this.keychain=e),this.initialized=!0}}),n8(this,"has",e=>(this.isInitialized(),this.keychain.has(e))),n8(this,"set",async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()}),n8(this,"get",e=>{this.isInitialized();let t=this.keychain.get(e);if(typeof t>"u"){let{message:t}=iv("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}),n8(this,"del",async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()}),this.core=e,this.logger=(0,w.U5)(t,this.name)}get context(){return(0,w.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,eZ(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?e0(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=iv("NOT_INITIALIZED",this.name);throw Error(e)}}}var n6=Object.defineProperty,n4=(e,t,r)=>((e,t,r)=>t in e?n6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class n9{constructor(e,t,r){this.core=e,this.logger=t,n4(this,"name","crypto"),n4(this,"keychain"),n4(this,"randomSessionIdentifier",r9()),n4(this,"initialized",!1),n4(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),n4(this,"hasKeys",e=>(this.isInitialized(),this.keychain.has(e))),n4(this,"getClientId",async()=>{this.isInitialized();let e=await this.getClientSeed(),t=z.TZ(e);return z.UF(t.publicKey)}),n4(this,"generateKeyPair",()=>{this.isInitialized();let e=function(){let e=r2.utils.randomPrivateKey(),t=r2.getPublicKey(e);return{privateKey:(0,eU.dI)(e,r8),publicKey:(0,eU.dI)(t,r8)}}();return this.setPrivateKey(e.publicKey,e.privateKey)}),n4(this,"signJWT",async e=>{this.isInitialized();let t=await this.getClientSeed(),r=z.TZ(t),i=this.randomSessionIdentifier;return await z.FA(i,e,iJ,r)}),n4(this,"generateSharedKey",(e,t,r)=>{this.isInitialized();let i=function(e,t){var r;let i,n=r2.getSharedSecret((0,eU.sH)(e,r8),(0,eU.sH)(t,r8)),s=(i=void 0,function(e,t,r,i=32){if(ta(e),ts(i),i>255*e.outputLen)throw Error("Length should be <= 255*HashLen");let n=Math.ceil(i/e.outputLen);void 0===r&&(r=rS);let s=new Uint8Array(n*e.outputLen),o=rI.create(e,t),a=o._cloneInto(),c=new Uint8Array(o.outputLen);for(let t=0;t<n;t++)rA[0]=t+1,a.update(0===t?rS:c).update(r).update(rA).digestInto(c),s.set(c,e.outputLen*t),o._cloneInto(a);return o.destroy(),a.destroy(),c.fill(0),rA.fill(0),s.slice(0,i)}(rM,(r=void 0,ta(rM),void 0===r&&(r=new Uint8Array(rM.outputLen)),rI(rM,ty(r),t
508y(n))),i,32));return(0,eU.dI)(s,r8)}(this.getPrivateKey(e),t);return this.setSymKey(i,r)}),n4(this,"setSymKey",async(e,t)=>{this.isInitialized();let r=t||r7(e);return await this.keychain.set(r,e),r}),n4(this,"deleteKeyPair",async e=>{this.isInitialized(),await this.keychain.del(e)}),n4(this,"deleteSymKey",async e=>{this.isInitialized(),await this.keychain.del(e)}),n4(this,"encode",async(e,t,r)=>{this.isInitialized();let i=io(r),n=(0,$.h)(t);if(2===i.type)return function(e,t){let r=it(2),i=tv(12);return ii({type:r,sealed:(0,eU.sH)(e,r4),iv:i,encoding:t})}(n,r?.encoding);if(ia(i)){let t=i.senderPublicKey,r=i.receiverPublicKey;e=await this.generateSharedKey(t,r)}let s=this.getSymKey(e),{type:o,senderPublicKey:a}=i;return function(e){let t=it("u">typeof e.type?e.type:0);if(1===ir(t)&&typeof e.senderPublicKey>"u")throw Error("Missing sender public key for type 1 envelope");let r="u">typeof e.senderPublicKey?(0,eU.sH)(e.senderPublicKey,r8):void 0,i="u">typeof e.iv?(0,eU.sH)(e.iv,r8):tv(12);return ii({type:t,sealed:rE((0,eU.sH)(e.symKey,r8),i).encrypt((0,eU.sH)(e.message,r4)),iv:i,senderPublicKey:r,encoding:e.encoding})}({type:o,symKey:s,message:n,senderPublicKey:a,encoding:r?.encoding})}),n4(this,"decode",async(e,t,r)=>{this.isInitialized();let i=function(e,t){let r=is({encoded:e,encoding:t?.encoding});return io({type:ir(r.type),senderPublicKey:"u">typeof r.senderPublicKey?(0,eU.dI)(r.senderPublicKey,r8):void 0,receiverPublicKey:t?.receiverPublicKey})}(t,r);if(2===i.type){let e=function(e,t){let{sealed:r}=is({encoded:e,encoding:t});return(0,eU.dI)(r,r4)}(t,r?.encoding);return(0,$.j)(e)}if(ia(i)){let t=i.receiverPublicKey,r=i.senderPublicKey;e=await this.generateSharedKey(t,r)}try{let i=this.getSymKey(e),n=function(e){let t=(0,eU.sH)(e.symKey,r8),{sealed:r,iv:i}=is(e),n=rE(t,i).decrypt(r);if(null===n)throw Error("Failed to decrypt");return(0,eU.dI)(n,r4)}({symKey:i,encoded:t,encoding:r?.encoding});return(0,$.j)(n)}catch(t){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(t)}}),n4(this,"getPayloadType",(e,t=r5)=>ir(is({encoded:e,encoding:t}).type)),n4(this,"getPayloadSenderPublicKey",(e,t=r5)=>{let r=is({encoded:e,encoding:t});return r.senderPublicKey?(0,eU.dI)(r.senderPublicKey,r8):void 0}),this.core=e,this.logger=(0,w.U5)(t,this.name),this.keychain=r||new n5(this.core,this.logger)}get context(){return(0,w.oI)(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(iY)}
508catch{e=r9(),await this.keychain.set(iY,e)}return function(e,t="utf8"){let r=n2[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?globalThis.Buffer.from(e,"utf8"):r.decoder.decode(`${r.prefix}${e}`)}(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=iv("NOT_INITIALIZED",this.name);throw Error(e)}}}var n7=Object.defineProperty,se=(e,t,r)=>((e,t,r)=>t in e?n7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class st extends S{constructor(e,t){super(e,t),this.logger=e,this.core=t,se(this,"messages",new Map),se(this,"name","messages"),se(this,"version","0.3"),se(this,"initialized",!1),se(this,"storagePrefix",iV),se(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let e=await this.getRelayerMessages();"u">typeof e&&(this.messages=e),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}finally{this.initialized=!0}}}),se(this,"set",async(e,t)=>{this.isInitialized();let r=ie(t),i=this.messages.get(e);return typeof i>"u"&&(i={}),"u">typeof i[r]||(i[r]=t,this.messages.set(e,i),await this.persist()),r}),se(this,"get",e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t}),se(this,"has",(e,t)=>(this.isInitialized(),"u">typeof this.get(e)[ie(t)])),se(this,"del",async e=>{this.isInitialized(),this.messages.delete(e),await this.persist()}),this.logger=(0,w.U5)(e,this.name),this.core=t}get context(){return(0,w.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,eZ(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?e0(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=iv("NOT_INITIALIZED",this.name);throw Error(e)}}}var sr=Object.defineProperty,si=Object.defineProperties,sn=Object.getOwnPropertyDescriptors,ss=Object.getOwnPropertySymbols,so=Object.prototype.hasOwnProperty,sa=Object.prototype.propertyIsEnumerable,sc=(e,t,r)=>t in e?sr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sl=(e,t)=>{for(var r in t||(t={}))so.call(t,r)&&sc(e,r,t[r]);if(ss)for(var r of ss(t))sa.call(t,r)&&sc(e,r,t[r]);return e},sh=(e,t)=>si(e,sn(t)),su=(e,t,r)=>sc(e,"symbol"!=typeof t?t+"":t,r);class sd extends C{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,su(this,"events",new g.EventEmitter),su(this,"name","publisher"),su(this,"queue",new Map),su(this,"publishTimeout",(0,j.toMiliseconds)(j.ONE_MINUTE)),su(this,"initialPublishTimeout",(0,j.toMiliseconds)(15*j.ONE_SECOND)),su(this,"needsTransportRestart",!1),su(this,"publish",async(e,t,r)=>{var i;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}});let n=r?.ttl||iX,s=ic(r),o=r?.prompt||!1,a=r?.tag||0,c=r?.id||(0,iz.getBigIntRpcId)().toString(),l={topic:e,message:t,opts:{ttl:n,relay:s,prompt:o,tag:a,id:c,attestation:r?.attestation,tvf:r?.tvf}},h=`Failed to publish payload, please try again. id:${c} tag:${a}`;try{let i=new Promise(async i=>{let s=({id:e})=>{l.opts.id===e&&(this.removeRequestFromQueue(e),this.relayer.events.removeListener(iZ.publish,s),i(l))};this.relayer.events.on(iZ.publish,s);let h=e2(new Promise((i,s)=>{this.rpcPublish({topic:e,message:t,ttl:n,prompt:o,tag:a,id:c,attestation:r?.attestation,tvf:r?.tvf}).then(i).catch(e=>{this.logger.warn(e,e?.message),s(e)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${c} tag:${a}`);try{await h,this.events.removeListener(iZ.publish,s)}catch(e){this.queue.set(c,sh(sl({},l),{attempt:1})),this.logger.warn(e,e?.message)}});this.logger.trace({type:"method",method:"publish",params:{id:c,topic:e,message:t,opts:r}}),await e2(i,this.publishTimeout,h)}catch(e){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(e),null!=(i=r?.internal)&&i.throwOnFailedPublish)throw e}finally{this.queue.delete(c)}}),su(this,"on",(e,t)=>{this.events.on(e,t)}),su(this,"once",(e,t)=>{this.events.once(e,t)}),su(this,"off",(e,t)=>{this.events.off(e,t)}),su(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),this.relayer=e,this.logger=(0,w.U5)(t,this.name),this.registerEventListeners()}get context(){return(0,w.oI)(this.logger)}async rpcPublish(e){var t,r,i,n;let{topic:s,message:o,ttl:a=iX,prompt:c,tag:l,id:h,attestation:u,tvf:d}=e,f={method:il(ic().protocol).publish,params:sl({topic:s,message:o,ttl:a,prompt:c,tag:l,attestation:u},d),id:h};iI(null==(t=f.params)?void 0:t.prompt)&&(null==(r=f.params)||delete r.prompt),iI(null==(i=f.params)?void 0:i.tag)&&(null==(n=f.params)||delete n.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:f});let p=await this.relayer.request(f);return this.relayer.events.emit(iZ.publish,e),this.logger.debug("Successfully Published Payload"),p}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,t)=>{let r=e.attempt+1;this.queue.set(t,sh(sl({},e),{attempt:r}));let{topic:i,message:n,opts:s,attestation:o}=e;this.logger.warn({},`Publisher: queue->publishing: ${e.opts.id}, tag: ${e.opts.tag}, attempt: ${r}`),await this.rpcPublish(sh(sl({},e),{topic:i,message:n,ttl:s.ttl,prompt:s.prompt,tag:s.tag,id:s.id,attestation:o,tvf:s.tvf})),this.logger.warn({},`Publisher: queue->published: ${e.opts.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(y.li.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(iZ.connection_stalled);return}this.checkQueue()}),this.relayer.on(iZ.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}var sf=Object.defineProperty,sp=(e,t,r)=>((e,t,r)=>t in e?sf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class sg{constructor(){sp(this,"map",new Map),sp(this,"set",(e,t)=>{let r=this.get(e);this.exists(e,t)||this.map.set(e,[...r,t])}),sp(this,"get",e=>this.map.get(e)||[]),sp(this,"exists",(e,t)=>this.get(e).includes(t)),sp(this,"delete",(e,t)=>{if(typeof t>"u")return void this.map.delete(e);
508if(!this.map.has(e))return;let r=this.get(e);if(!this.exists(e,t))return;let i=r.filter(e=>e!==t);if(!i.length)return void this.map.delete(e);this.map.set(e,i)}),sp(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var sm=Object.defineProperty,sy=Object.defineProperties,sb=Object.getOwnPropertyDescriptors,sw=Object.getOwnPropertySymbols,sv=Object.prototype.hasOwnProperty,sx=Object.prototype.propertyIsEnumerable,sE=(e,t,r)=>t in e?sm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,s_=(e,t)=>{for(var r in t||(t={}))sv.call(t,r)&&sE(e,r,t[r]);if(sw)for(var r of sw(t))sx.call(t,r)&&sE(e,r,t[r]);return e},sI=(e,t)=>sy(e,sb(t)),sA=(e,t,r)=>sE(e,"symbol"!=typeof t?t+"":t,r);class sS extends P{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,sA(this,"subscriptions",new Map),sA(this,"topicMap",new sg),sA(this,"events",new g.EventEmitter),sA(this,"name","subscription"),sA(this,"version","0.3"),sA(this,"pending",new Map),sA(this,"cached",[]),sA(this,"initialized",!1),sA(this,"pendingSubscriptionWatchLabel","pending_sub_watch_label"),sA(this,"pollingInterval",20),sA(this,"storagePrefix",iV),sA(this,"subscribeTimeout",(0,j.toMiliseconds)(j.ONE_MINUTE)),sA(this,"initialSubscribeTimeout",(0,j.toMiliseconds)(15*j.ONE_SECOND)),sA(this,"clientId"),sA(this,"batchSubscribeTopicsLimit",500),sA(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),sA(this,"subscribe",async(e,t)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{let r=ic(t),i={topic:e,relay:r,transportType:t?.transportType};this.pending.set(e,i);let n=await this.rpcSubscribe(e,r,t);return"string"==typeof n&&(this.onSubscribe(n,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}})),n}catch(e){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(e),e}}),sA(this,"unsubscribe",async(e,t)=>{this.isInitialized(),"u">typeof t?.id?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)}),sA(this,"isSubscribed",async e=>{if(this.topics.includes(e))return!0;let t=`${this.pendingSubscriptionWatchLabel}_${e}`;return await new Promise((r,i)=>{let n=new j.Watch;n.start(t);let s=setInterval(()=>{(!this.pending.has(e)&&this.topics.includes(e)||this.cached.some(t=>t.topic===e))&&(clearInterval(s),n.stop(t),r(!0)),n.elapsed(t)>=i5&&(clearInterval(s),n.stop(t),i(Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)}),sA(this,"on",(e,t)=>{this.events.on(e,t)}),sA(this,"once",(e,t)=>{this.events.once(e,t)}),sA(this,"off",(e,t)=>{this.events.off(e,t)}),sA(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),sA(this,"start",async()=>{await this.onConnect()}),sA(this,"stop",async()=>{await this.onDisconnect()}),sA(this,"restart",async()=>{await this.restore(),await this.onRestart()}),sA(this,"checkPending",async()=>{if(0===this.pending.size&&(!this.initialized||!this.relayer.connected))return;let e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e)}),sA(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(y.li.pulse,async()=>{await this.checkPending()}),this.events.on(i8.created,async e=>{let t=i8.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(i8.deleted,async e=>{let t=i8.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}),this.relayer=e,this.logger=(0,w.U5)(t,this.name),this.clientId=""}get context(){return(0,w.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(e,t){let r=!1;try{r=this.getSubscription(e).topic===t}catch{}return r}reset(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){let r=this.topicMap.get(e);await Promise.all(r.map(async r=>await this.unsubscribeById(e,r,t)))}async unsubscribeById(e,t,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}});try{let i=ic(r);await this.restartToComplete({topic:e,id:t,relay:i}),await this.rpcUnsubscribe(e,t,i);let n=ix("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,n),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}})}catch(e){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(e),e}}async rpcSubscribe(e,t,r){var i;r&&r?.transportType!==i2.relay||await this.restartToComplete({topic:e,id:e,relay:t});let n={method:il(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let s=null==(i=r?.internal)?void 0:i.throwOnFailedPublish;
508try{let t=await this.getSubscriptionId(e);if(r?.transportType===i2.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(n).catch(e=>this.logger.warn(e))},(0,j.toMiliseconds)(j.ONE_SECOND)),t;let i=new Promise(async t=>{let r=i=>{i.topic===e&&(this.events.removeListener(i8.created,r),t(i.id))};this.events.on(i8.created,r);try{let i=await e2(new Promise((e,t)=>{this.relayer.request(n).catch(e=>{this.logger.warn(e,e?.message),t(e)}).then(e)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(i8.created,r),t(i)}catch{}}),o=await e2(i,this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!o&&s)throw Error(`Subscribing to ${e} failed, please try again`);return o?t:null}catch(e){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(iZ.connection_stalled),s)throw e}return null}async rpcBatchSubscribe(e){if(!e.length)return;let t={method:il(e[0].relay.protocol).batchSubscribe,params:{topics:e.map(e=>e.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{await await e2(new Promise(e=>{this.relayer.request(t).catch(e=>this.logger.warn(e)).then(e)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(iZ.connection_stalled)}}async rpcBatchFetchMessages(e){let t;if(!e.length)return;let r={method:il(e[0].relay.protocol).batchFetchMessages,params:{topics:e.map(e=>e.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{t=await await e2(new Promise((e,t)=>{this.relayer.request(r).catch(e=>{this.logger.warn(e),t(e)}).then(e)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(iZ.connection_stalled)}return t}rpcUnsubscribe(e,t,r){let i={method:il(r.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,t){this.setSubscription(e,sI(s_({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(e=>{this.setSubscription(e.id,s_({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(e,t,r){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,r),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,s_({},t)),this.topicMap.set(t.topic,e),this.events.emit(i8.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let t=this.subscriptions.get(e);if(!t){let{message:t}=iv("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});let r=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(r.topic,e),this.events.emit(i8.deleted,sI(s_({},r),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(i8.sync)}async onRestart(){if(this.cached.length){let e=[...this.cached],t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<t;r++){let t=e.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(t)}}this.events.emit(i8.resubscribed)}async restore(){try{let e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){let{message:e}=iv("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){e.length&&(await this.rpcBatchSubscribe(e),this.onBatchSubscribe(await Promise.all(e.map(async e=>sI(s_({}
508,e),{id:await this.getSubscriptionId(e.topic)})))))}async batchFetchMessages(e){var t;if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);let r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(await (t=(0,j.toMiliseconds)(j.ONE_SECOND),new Promise(e=>setTimeout(e,t))),await this.relayer.handleBatchMessageEvents(r.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){let{message:e}=iv("NOT_INITIALIZED",this.name);throw Error(e)}}async restartToComplete(e){this.relayer.connected||this.relayer.connecting||(this.cached.push(e),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(e){return ie(e+await this.getClientId())}}var sC=Object.defineProperty,sN=Object.getOwnPropertySymbols,sO=Object.prototype.hasOwnProperty,sP=Object.prototype.propertyIsEnumerable,sT=(e,t,r)=>t in e?sC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sM=(e,t)=>{for(var r in t||(t={}))sO.call(t,r)&&sT(e,r,t[r]);if(sN)for(var r of sN(t))sP.call(t,r)&&sT(e,r,t[r]);return e},sR=(e,t,r)=>sT(e,"symbol"!=typeof t?t+"":t,r);class sk extends N{constructor(e){super(e),sR(this,"protocol","wc"),sR(this,"version",2),sR(this,"core"),sR(this,"logger"),sR(this,"events",new g.EventEmitter),sR(this,"provider"),sR(this,"messages"),sR(this,"subscriber"),sR(this,"publisher"),sR(this,"name","relayer"),sR(this,"transportExplicitlyClosed",!1),sR(this,"initialized",!1),sR(this,"connectionAttemptInProgress",!1),sR(this,"relayUrl"),sR(this,"projectId"),sR(this,"packageName"),sR(this,"bundleId"),sR(this,"hasExperiencedNetworkDisruption",!1),sR(this,"pingTimeout"),sR(this,"heartBeatTimeout",(0,j.toMiliseconds)(j.THIRTY_SECONDS+j.FIVE_SECONDS)),sR(this,"reconnectTimeout"),sR(this,"connectPromise"),sR(this,"reconnectInProgress",!1),sR(this,"requestsInFlight",[]),sR(this,"connectTimeout",(0,j.toMiliseconds)(15*j.ONE_SECOND)),sR(this,"request",async e=>{var t,r;this.logger.debug("Publishing Request Payload");let i=e.id||(0,iz.getBigIntRpcId)().toString();await this.toEstablishConnection();try{this.logger.trace({id:i,method:e.method,topic:null==(t=e.params)?void 0:t.topic},"relayer.request - publishing...");let n=`${i}:${(null==(r=e.params)?void 0:r.tag)||""}`;this.requestsInFlight.push(n);let s=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(e=>e!==n),s}catch(e){throw this.logger.debug(`Failed to Publish Request: ${i}`),e}}),sR(this,"resetPingTimeout",()=>{if(eW())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,t,r;this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)||r.terminate()},this.heartBeatTimeout)}catch(e){this.logger.warn(e,e?.message)}}),sR(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),sR(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected \uD83D\uDEDC"),this.startPingTimeout(),this.events.emit(iZ.connect)}),sR(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected \uD83D\uDED1"),this.requestsInFlight=[],this.onProviderDisconnect()}),sR(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(iZ.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),sR(this,"registerProviderListeners",()=>{this.provider.on(i0.payload,this.onPayloadHandler),this.provider.on(i0.connect,this.onConnectHandler),this.provider.on(i0.disconnect,this.onDisconnectHandler),this.provider.on(i0.error,this.onProviderErrorHandler)}),this.core=e.core,this.logger="u">typeof e.logger&&"string"!=typeof e.logger?(0,w.U5)(e.logger,this.name):(0,w.h6)((0,w.iP)({level:e.logger||"error"})),this.messages=new st(this.logger,e.core),this.subscriber=new sS(this,this.logger),this.publisher=new sd(this,this.logger),this.relayUrl=e?.relayUrl||iQ,this.projectId=e.projectId,eV()&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Platform)&&(null==r.g?void 0:r.g.Platform.OS)==="android"?this.packageName=eY():eV()&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Platform)&&(null==r.g?void 0:r.g.Platform.OS)==="ios"&&(this.bundleId=eY()),this.provider={}}
508async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.hasAnyTopics)try{await this.transportOpen()}catch(e){this.logger.warn(e,e?.message)}}get context(){return(0,w.oI)(this.logger)}get connected(){var e,t,r;return(null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.readyState)===1}get connecting(){var e,t,r;return(null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.readyState)===0||void 0!==this.connectPromise}async publish(e,t,r){this.isInitialized(),await this.publisher.publish(e,t,r),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:i2.relay})}async subscribe(e,t){var r,i,n;this.isInitialized(),null!=t&&t.transportType&&t?.transportType!=="relay"||await this.toEstablishConnection();let s=typeof(null==(r=t?.internal)?void 0:r.throwOnFailedPublish)>"u"||(null==(i=t?.internal)?void 0:i.throwOnFailedPublish),o=(null==(n=this.subscriber.topicMap.get(e))?void 0:n[0])||"",a,c=t=>{t.topic===e&&(this.subscriber.off(i8.created,c),a())};return await Promise.all([new Promise(e=>{a=e,this.subscriber.on(i8.created,c)}),new Promise(async(r,i)=>{o=await this.subscriber.subscribe(e,sM({internal:{throwOnFailedPublish:s}},t)).catch(e=>{s&&i(e)})||o,r()})]),o}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(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await e2(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){if(!this.subscriber.hasAnyTopics)return void this.logger.warn("Starting WS connection skipped because the client has no topics to work with.");if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(t,r)=>{await this.connect(e).then(t).catch(r).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(e){this.logger.debug({},"Restarting transport..."),this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await iL())throw Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0)return void this.logger.trace("Batch message events is empty. Ignoring...");let t=e.sort((e,t)=>e.publishedAt-t.publishedAt);for(let e of(this.logger.debug(`Batch of ${t.length} message events sorted`),t))try{await this.onMessageEvent(e)}catch(e){this.logger.warn(e,"Error while processing batch message event: "+e?.message)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){let{topic:r}=e;if(!t.sessionExists){let e=e5(j.FIVE_MINUTES);await this.core.pairing.pairings.set(r,{topic:r,expiry:e,relay:{protocol:"irn"},active:!1})}this.events.emit(iZ.message,e),await this.recordMessageEvent(e)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let t=1;for(;t<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${t}...`),await this.createProvider(),await new Promise(async(e,t)=>{let r=()=>{t(Error("Connection interrupted while trying to subscribe"))};this.provider.once(i0.disconnect,r),await e2(new Promise((e,t)=>
508{this.provider.connect().then(e).catch(t)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(e=>{t(e)}).finally(()=>{this.provider.off(i0.disconnect,r),clearTimeout(this.reconnectTimeout)}),await new Promise(async(e,t)=>{let r=()=>{t(Error("Connection interrupted while trying to subscribe"))};this.provider.once(i0.disconnect,r),await this.subscriber.start().then(e).catch(t).finally(()=>{this.provider.off(i0.disconnect,r)})}),this.hasExperiencedNetworkDisruption=!1,e()})}catch(e){await this.subscriber.stop(),this.logger.warn({},e.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${t}`);break}await new Promise(e=>setTimeout(e,(0,j.toMiliseconds)(+t))),t++}}startPingTimeout(){var e,t,r,i,n;if(eW())try{null!=(t=null==(e=this.provider)?void 0:e.connection)&&t.socket&&(null==(n=null==(i=null==(r=this.provider)?void 0:r.connection)?void 0:i.socket)||n.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(e){this.logger.warn(e,e?.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new i$.F(new iq.A(function({protocol:e,version:t,relayUrl:r,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:o,bundleId:a,packageName:c}){let l=r.split("?"),h=eX(e,t,i),u=function(e,t){let r=new URLSearchParams(e);for(let e of Object.keys(t).sort())if(t.hasOwnProperty(e)){let i=t[e];void 0!==i&&r.set(e,i)}return r.toString()}(l[1]||"",{auth:n,ua:h,projectId:s,useOnCloseEvent:o||void 0,packageName:c||void 0,bundleId:a||void 0});return l[0]+"?"+u}({sdkVersion:i1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:t,message:r}=e;await this.messages.set(t,r)}async shouldIgnoreMessageEvent(e){let{topic:t,message:r}=e;if(!r||0===r.length)return this.logger.warn(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.warn(`Ignoring message for non-subscribed topic ${t}`),!0;let i=this.messages.has(t,r);return i&&this.logger.warn(`Ignoring duplicate message: ${r}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),(0,iz.isJsonRpcRequest)(e)){if(!e.method.endsWith("_subscription"))return;let t=e.params,{topic:r,message:i,publishedAt:n,attestation:s}=t.data,o={topic:r,message:i,publishedAt:n,transportType:i2.relay,attestation:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(sM({type:"event",event:t.id},o)),this.events.emit(t.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else(0,iz.isJsonRpcResponse)(e)&&this.events.emit(iZ.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(iZ.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let t=(0,iz.formatJsonRpcResult)(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(i0.payload,this.onPayloadHandler),this.provider.off(i0.connect,this.onConnectHandler),this.provider.off(i0.disconnect,this.onDisconnectHandler),this.provider.off(i0.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await iL();var t,i,n=async t=>{e!==t&&(e=t,t?await this.transportOpen().catch(e=>this.logger.error(e,e?.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))};switch(eG()){case eF.browser:t=n,!eV()&&eK()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)));break;case eF.reactNative:i=n,eV()&&"u">typeof r.g&&null!=r.g&&r.g.NetInfo&&r.g?.NetInfo.addEventListener(e=>i(e?.isConnected));case eF.node:}}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(iZ.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e,e?.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},(0,j.toMiliseconds)(.1)))))}isInitialized(){if(!this.initialized){let{message:e}=iv("NOT_INITIALIZED",this.name);throw Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),this.connected||await this.connect()}}var sD=Object.defineProperty,sL=Object.getOwnPropertySymbols,sU=Object.prototype.hasOwnProperty,sB=Object.prototype.propertyIsEnumerable,sj=(e,t,r)=>t in e?sD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,s$=(e,t)=>
508{for(var r in t||(t={}))sU.call(t,r)&&sj(e,r,t[r]);if(sL)for(var r of sL(t))sB.call(t,r)&&sj(e,r,t[r]);return e},sz=(e,t,r)=>sj(e,"symbol"!=typeof t?t+"":t,r);class sq extends O{constructor(e,t,r,i=iV,n){super(e,t,r,i),this.core=e,this.logger=t,this.name=r,sz(this,"map",new Map),sz(this,"version","0.3"),sz(this,"cached",[]),sz(this,"initialized",!1),sz(this,"getKey"),sz(this,"storagePrefix",iV),sz(this,"recentlyDeleted",[]),sz(this,"recentlyDeletedLimit",200),sz(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>{this.getKey&&null!==e&&!iI(e)?this.map.set(this.getKey(e),e):function(e){var t;return null==(t=e?.proposer)?void 0:t.publicKey}(e)?this.map.set(e.id,e):e?.topic&&this.map.set(e.topic,e)}),this.cached=[],this.initialized=!0)}),sz(this,"set",async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),await this.persist())}),sz(this,"get",e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e))),sz(this,"getAll",e=>(this.isInitialized(),e?this.values.filter(t=>Object.keys(e).every(r=>iF()(t[r],e[r]))):this.values)),sz(this,"update",async(e,t)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});let r=s$(s$({},this.getData(e)),t);this.map.set(e,r),await this.persist()}),sz(this,"delete",async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),this.addToRecentlyDeleted(e),await this.persist())}),this.logger=(0,w.U5)(t,this.name),this.storagePrefix=i,this.getKey=n}get context(){return(0,w.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){let{message:t}=iv("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(t),Error(t)}let{message:t}=iv("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),Error(t)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:e}=iv("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=iv("NOT_INITIALIZED",this.name);throw Error(e)}}}var sH=Object.defineProperty,sF=(e,t,r)=>((e,t,r)=>t in e?sH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class sW{constructor(e,t){this.core=e,this.logger=t,sF(this,"name","pairing"),sF(this,"version","0.3"),sF(this,"events",new(m())),sF(this,"pairings"),sF(this,"initialized",!1),sF(this,"storagePrefix",iV),sF(this,"ignoredPayloadTypes",[1]),sF(this,"registeredMethods",[]),sF(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),sF(this,"register",({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]}),sF(this,"create",async e=>{this.isInitialized();let t=r9(),r=await this.core.crypto.setSymKey(t),i=e5(j.FIVE_MINUTES),n={protocol:"irn"},s={topic:r,expiry:i,relay:n,active:!1,methods:e?.methods},o=iu({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:t,relay:n,expiryTimestamp:i,methods:e?.methods});return this.events.emit(i4.create,s),this.core.expirer.set(r,i),await this.pairings.set(r,s),await this.core.relayer.subscribe(r,{transportType:e?.transportType}),{topic:r,uri:o}}),sF(this,"pair",async e=>{let t;this.isInitialized();let r=this.core.eventClient.createEvent({properties:{topic:e?.uri,trace:[ni.pairing_started]}});this.isValidPair(e,r);let{topic:i,symKey:n,relay:s,expiryTimestamp:o,methods:a}=ih(e.uri);if(r.props.properties.topic=i,r.addTrace(ni.pairing_uri_validation_success),r.addTrace(ni.pairing_uri_not_expired),this.pairings.keys.includes(i)){if(t=this.pairings.get(i),r.addTrace(ni.existing_pairing),t.active)throw r.setError(nn.active_pairing_already_exists),Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);r.addTrace(ni.pairing_not_expired)}let c=o||e5(j.FIVE_MINUTES),l={topic:i,relay:s,expiry:c,active:!1,methods:a};this.core.expirer.set(i,c),await this.pairings.set(i,l),r.addTrace(ni.store_new_pairing),e.activatePairing&&await this.activate({topic:i}),this.events.emit(i4.create,l),r.addTrace(ni.emit_inactive_pairing),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(n,i),r.addTrace(ni.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{r.setError(nn.no_internet_connection)}try{await this.core.relayer.subscribe(i,{relay:s})}catch(e){throw r.setError(nn.subscribe_pairing_topic_failure),e}return r.addTrace(ni.subscribe_pairing_topic_success),l}),sF(this,"activate",async({topic:e})=>{this.isInitialized();let t=e5(j.FIVE_MINUTES);this.core.expirer.set(e,t),await this.pairings.update(e,{active:!0,expiry:t})}),sF(this,"ping",async e=>{this.isInitialized(),await this.isValidPing(e),this.logger.warn("ping() is deprecated and will be removed in the next major release.");let{topic:t}=e;if(this.pairings.keys.includes(t)){let e=await this.sendRequest(t,"wc_pairingPing",{}),{done:r,resolve:i,reject:n}=e1();this.events.once(e4("pairing_ping",e),({error:e})=>{e?n(e):i()}),await r()}}),sF(this,"updateExpiry",async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})}),sF(this,"updateMetadata",async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})}),sF(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),sF(this,"disconnect",async e=>{this.isInitialized(),await this.isValidDisconnect(e);let{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,"wc_pairingDelete",ix("USER_DISCONNECTED")),await this.deletePairing(t))}),sF(this,"formatUriFromPairing",e=>{this.isInitialized();let{topic:t,relay:r,expiry:i,methods:n}=e,s=this.core.crypto.keychain.get(t);return iu({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:s,relay:r,expiryTimestamp:i,methods:n})}),sF(this,"sendRequest",async(e,t,r)=>{let i=(0,iz.formatJsonRpcRequest)(t,r),n=await this.core.crypto.encode(e,i),s=i6[t].req;return this.core.history.set(e,i),this.core.relayer.publish(e,n,s),i.id}),sF(this,"sendResult",async(e,t,r)=>{let i=(0,iz.formatJsonRpcResult)(e,r),n=await this.core.crypto.encode(t,i),s=i6[(await this.core.history.get(t,e)).request.method].res;await this.core.relayer.publish(t,n,s),await this.core.history.resolve(i)}),sF(this,"sendError",async(e,t,r)=>{let i=(0,iz.formatJsonRpcError)(e,r),n=await this.core.crypto.encode(t,i),s=(await this.core.history.get(t,e)).request.method,o=i6[s]?i6[s].res:i6.unregistered_method.res;await this.core.relayer.publish(t,n,o),await this.core.history.resolve(i)}),sF(this,"deletePairing",async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,ix("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])}),sF(this,"cleanup",async()=>{let e=this.pairings.getAll().filter(e=>e6(e.expiry));await Promise.all(e.map(e=>this.deletePairing(e.topic)))}),sF(this,"onRelayEventRequest",e=>{let{topic:t,payload:r}=e;switch(r.method){case"wc_pairingPing":return this.onPairingPingRequest(t,r);case"wc_pairingDelete":return this.onPairingDeleteRequest(t,r);default:return this.onUnknownRpcMethodRequest(t,r)}}),sF(this,"onRelayEventResponse",async e=>{let{topic:t,payload:r}=e,i=(await this.core.history.get(t,r.id)).request.method;return"wc_pairingPing"===i?this.onPairingPingResponse(t,r):this.onUnknownRpcMethodResponse(i)}),sF(this,"onPairingPingRequest",async(e,t)=>{let{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult(r,e,!0),this.events.emit(i4.ping,{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}}),sF(this,"onPairingPingResponse",(e,t)=>{let{id:r}=t;setTimeout(()=>{(0,iz.isJsonRpcResult)(t)?this.events.emit(e4("pairing_ping",r),{}):(0,iz.isJsonRpcError)(t)&&this.events.emit(e4("pairing_ping",r),{error:t.error})},500)}),sF(this,"onPairingDeleteRequest",async(e,t)=>{let{id:r}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit(i4.delete,{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}}),sF(this,"onUnknownRpcMethodRequest",async(e,t)=>{let{id:r,method:i}=t;try{if(this.registeredMethods.includes(i))return;let t=ix("WC_METHOD_UNSUPPORTED",i);await this.sendError(r,e,t),this.logger.error(t)}catch(t){await this.sendError(r,e,t),this.logger.error(t)}}),sF(this,"onUnknownRpcMethodResponse",e=>{this.registeredMethods.includes(e)||this.logger.error(ix("WC_METHOD_UNSUPPORTED",e))}),sF(this,"isValidPair",(e,t)=>{var r;if(!iM(e)){let{message:r}=iv("MISSING_OR_INVALID",`pair() params: ${e}`);throw t.setError(nn.malformed_pairing_uri),Error(r)}if(!function(e){function t(e){try{return"u">typeof new URL(e)}catch{return!1}}try{if(iA(e,!1)){if(t(e))return!0;let r=tn(e);return t(r)}}catch{}return!1}(e.uri)){let{message:r}=iv("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw t.setError(nn.malformed_pairing_uri),Error(r)}let i=ih(e?.uri);if(!(null!=(r=i?.relay)&&r.protocol)){let{message:e}=iv("MISSING_OR_INVALID","pair() uri#relay-protocol");throw t.setError(nn.malformed_pairing_uri),Error(e)}if(!(null!=i&&i.symKey)){let{message:e}=iv("MISSING_OR_INVALID","pair() uri#symKey");throw t.setError(nn.malformed_pairing_uri),Error(e)}if(null!=i&&i.expiryTimestamp&&(0,j.toMiliseconds)(i?.expiryTimestamp)<Date.now()){t.setError(nn.pairing_expired);let{message:e}=iv("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw Error(e)}}),sF(this,"isValidPing",async e=>{if(!iM(e)){let{message:t}=iv("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)}),sF(this,"isValidDisconnect",async e=>{if(!iM(e)){let{message:t}=iv("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)}),sF(this,"isValidPairingTopic",async e=>{if(!iA(e,!1)){let{message:t}=iv("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.pairings.keys.includes(e)){let{message:t}=iv("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if(e6(this.pairings.get(e).expiry)){await this.deletePairing(e);let{message:t}=iv("EXPIRED",`pairing topic: ${e}`);throw Error(t)}}),this.core=e,this.logger=(0,w.U5)(t,this.name),this.pairings=new sq(this.core,this.logger,this.name,this.storagePrefix)}get context(){return(0,w.oI)(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=iv("NOT_INITIALIZED",this.name);throw Error(e)}}registerRelayerEvents(){this.core.relayer.on(iZ.message,async e=>{let{topic:t,message:r,transportType:i}=e;if(!this.pairings.keys.includes(t)||i===i2.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))return;let n=await this.core.crypto.decode(t,r);try{(0,iz.isJsonRpcRequest)(n)?(this.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):(0,iz.isJsonRpcResponse)(n)&&(await this.core.history.resolve(n),await this.onRelayEventResponse({topic:t,payload:n}),this.core.history.delete(t,n.id))}catch(e){this.logger.error(e)}})}registerExpirerEvents(){this.core.expirer.on(i7.expired,async e=>{let{topic:t}=e8(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(i4.expire,{topic:t}))})}}var sV=Object.defineProperty,sK=(e,t,r)=>((e,t,r)=>t in e?sV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class sG extends A{constructor(e,t){super(e,t),this.core=e,this.logger=t,sK(this,"records",new Map),sK(this,"events",new g.EventEmitter),sK(this,"name","history"),sK(this,"version","0.3"),sK(this,"cac
508hed",[]),sK(this,"initialized",!1),sK(this,"storagePrefix",iV),sK(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>this.records.set(e.id,e)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),sK(this,"set",(e,t,r)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:r}),this.records.has(t.id))return;let i={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:r,expiry:e5(j.THIRTY_DAYS)};this.records.set(i.id,i),this.persist(),this.events.emit(i9.created,i)}),sK(this,"resolve",async e=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;let t=await this.getRecord(e.id);typeof t.response>"u"&&(t.response=(0,iz.isJsonRpcError)(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.persist(),this.events.emit(i9.updated,t))}),sK(this,"get",async(e,t)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),await this.getRecord(t))),sK(this,"delete",(e,t)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach(r=>{r.topic===e&&("u">typeof t&&r.id!==t||(this.records.delete(r.id),this.events.emit(i9.deleted,r)))}),this.persist()}),sK(this,"exists",async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e)),sK(this,"on",(e,t)=>{this.events.on(e,t)}),sK(this,"once",(e,t)=>{this.events.once(e,t)}),sK(this,"off",(e,t)=>{this.events.off(e,t)}),sK(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),this.logger=(0,w.U5)(t,this.name)}get context(){return(0,w.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(t=>{if("u">typeof t.response)return;let r={topic:t.topic,request:(0,iz.formatJsonRpcRequest)(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(r)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let t=this.records.get(e);if(!t){let{message:t}=iv("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(i9.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:e}=iv("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(i9.created,e=>{let t=i9.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(i9.updated,e=>{let t=i9.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(i9.deleted,e=>{let t=i9.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(y.li.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{(0,j.toMiliseconds)(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(i9.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=iv("NOT_INITIALIZED",this.name);throw Error(e)}}}var sY=Object.defineProperty,sJ=(e,t,r)=>((e,t,r)=>t in e?sY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class sX extends T{constructor(e,t){super(e,t),this.core=e,this.logger=t,sJ(this,"expirations",new Map),sJ(this,"events",new g.EventEmitter),sJ(this,"name","expirer"),sJ(this,"version","0.3"),sJ(this,"cac
508hed",[]),sJ(this,"initialized",!1),sJ(this,"storagePrefix",iV),sJ(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>this.expirations.set(e.target,e)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),sJ(this,"has",e=>{try{let t=this.formatTarget(e);return"u">typeof this.getExpiration(t)}catch{return!1}}),sJ(this,"set",(e,t)=>{this.isInitialized();let r=this.formatTarget(e),i={target:r,expiry:t};this.expirations.set(r,i),this.checkExpiry(r,i),this.events.emit(i7.created,{target:r,expiration:i})}),sJ(this,"get",e=>{this.isInitialized();let t=this.formatTarget(e);return this.getExpiration(t)}),sJ(this,"del",e=>{if(this.isInitialized(),this.has(e)){let t=this.formatTarget(e),r=this.getExpiration(t);this.expirations.delete(t),this.events.emit(i7.deleted,{target:t,expiration:r})}}),sJ(this,"on",(e,t)=>{this.events.on(e,t)}),sJ(this,"once",(e,t)=>{this.events.once(e,t)}),sJ(this,"off",(e,t)=>{this.events.off(e,t)}),sJ(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),this.logger=(0,w.U5)(t,this.name)}get context(){return(0,w.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if("string"==typeof e)return e3("topic",e);if("number"==typeof e)return e3("id",e);let{message:t}=iv("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(i7.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:e}=iv("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let t=this.expirations.get(e);if(!t){let{message:t}=iv("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(t),Error(t)}return t}checkExpiry(e,t){let{expiry:r}=t;(0,j.toMiliseconds)(r)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(i7.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(y.li.pulse,()=>this.checkExpirations()),this.events.on(i7.created,e=>{let t=i7.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(i7.expired,e=>{let t=i7.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(i7.deleted,e=>{let t=i7.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=iv("NOT_INITIALIZED",this.name);throw Error(e)}}}var sQ=Object.defineProperty,sZ=(e,t,r)=>((e,t,r)=>t in e?sQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class s0 extends M{constructor(e,t,r){super(e,t,r),this.core=e,this.logger=t,this.store=r,sZ(this,"name","verify-api"),sZ(this,"abortController"),sZ(this,"isDevEnv"),sZ(this,"verifyUrlV3",nt),sZ(this,"storagePrefix",iV),sZ(this,"version",2),sZ(this,"publicKey"),sZ(this,"fetchPromise"),sZ(this,"init",async()=>{var e;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&(0,j.toMiliseconds)(null==(e=this.publicKey)?void 0:e.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),sZ(this,"register",async e=>{if(!eK()||this.isDevEnv)return;let t=window.location.origin,{id:r,decryptedId:i}=e,n=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${t}&id=${r}&decryptedId=${i}`;try{let e=(0,H.getDocument)(),t=this.startAbortTimer(5*j.ONE_SECOND),i=await new Promise((i,s)=>{let o=()=>{window.removeEventListener("message",c),e.body.removeChild(a),s("attestation aborted")};this.abortController.signal.addEventListener("abort",o);let a=e.createElement("iframe");a.src=n,a.style.display="none",a.addEventListener("error",o,{signal:this.abortController.signal});let c=n=>{if(n.data&&"string"==typeof n.data)try{let s=JSON.parse(n.data);if("verify_attestation"===s.type){if((0,z.Cq)(s.attestation).payload.id!==r)return;clearInterval(t),e.body.removeChild(a),this.abortController.signal.removeEventListener("abort",o),window.removeEventListener("message",c),i(null===s.attestation?"":s.attestation)}}catch(e){this.logger.warn(e)}};e.body.appendChild(a),window.addEventListener("message",c,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",i),i}catch(e){this.logger.warn(e)}return""}),sZ(this,"resolve",async e=>{if(this.isDevEnv)return"";let{attestationId:t,hash:r,encryptedId:i}=e;if(""===t)return void this.logger.debug("resolve: attestationId is empty, skipping");if(t){if((0,z.Cq)(t).payload.id!==i)return;let e=await this.isValidJwtAttestation(t);
508if(e)return e.isVerified?e:void this.logger.warn("resolve: jwt attestation: origin url not verified")}if(!r)return;let n=this.getVerifyUrl(e?.verifyUrl);return this.fetchAttestation(r,n)}),sZ(this,"fetchAttestation",async(e,t)=>{this.logger.debug(`resolving attestation: ${e} from url: ${t}`);let r=this.startAbortTimer(5*j.ONE_SECOND),i=await fetch(`${t}/attestation/${e}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(r),200===i.status?await i.json():void 0}),sZ(this,"getVerifyUrl",e=>{let t=e||ne;return nr.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: ${ne}`),t=ne),t}),sZ(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);let e=this.startAbortTimer(j.FIVE_SECONDS),t=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(e),await t.json()}catch(e){this.logger.warn(e)}}),sZ(this,"persistPublicKey",async e=>{this.logger.debug("persisting public key to local storage",e),await this.store.setItem(this.storeKey,e),this.publicKey=e}),sZ(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),sZ(this,"isValidJwtAttestation",async e=>{let t=await this.getPublicKey();try{if(t)return this.validateAttestation(e,t)}catch(e){this.logger.error(e),this.logger.warn("error validating attestation")}let r=await this.fetchAndPersistPublicKey();try{if(r)return this.validateAttestation(e,r)}catch(e){this.logger.error(e),this.logger.warn("error validating attestation")}}),sZ(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),sZ(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async e=>{let t=await this.fetchPublicKey();t&&(await this.persistPublicKey(t),e(t))});let e=await this.fetchPromise;return this.fetchPromise=void 0,e}),sZ(this,"validateAttestation",(e,t)=>{let r=function(e,t){let[r,i,n]=e.split("."),s=ez.from(function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4;return r>0&&(t+="=".repeat(4-r)),t}(n),"base64");if(64!==s.length)throw Error("Invalid signature length");let o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),c=rM(`${r}.${i}`),l=new eB.ec("p256").keyFromPublic({x:ez.from(t.x,"base64").toString("hex"),y:ez.from(t.y,"base64").toString("hex")},"hex"),h=(0,eU.dI)(c,r8);if(!l.verify(h,{r:o,s:a}))throw Error("Invalid signature");return(0,z.Cq)(e).payload}(e,t.publicKey),i={hasExpired:(0,j.toMiliseconds)(r.exp)<Date.now(),payload:r};if(i.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),Error("JWT attestation expired");return{origin:i.payload.origin,isScam:i.payload.isScam,isVerified:i.payload.isVerified}}),this.logger=(0,w.U5)(t,this.name),this.abortController=new AbortController,this.isDevEnv=ti(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return(0,w.oI)(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),(0,j.toMiliseconds)(e))}}var s1=Object.defineProperty,s2=(e,t,r)=>((e,t,r)=>t in e?s1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class s3 extends R{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,s2(this,"context","echo"),s2(this,"registerDeviceToken",async e=>{let{clientId:t,token:r,notificationType:i,enableEncrypted:n=!1}=e,s=`https://echo.walletconnect.com/${this.projectId}/clients`;await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:t,type:i,token:r,always_raw:n})})}),this.logger=(0,w.U5)(t,this.context)}}var s8=Object.defineProperty,s5=Object.getOwnPropertySymbols,s6=Object.prototype.hasOwnProperty,s4=Object.prototype.propertyIsEnumerable,s9=(e,t,r)=>t in e?s8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,s7=(e,t)=>{for(var r in t||(t={}))s6.call(t,r)&&s9(e,r,t[r]);if(s5)for(var r of s5(t))s4.call(t,r)&&s9(e,r,t[r]);return e},oe=(e,t,r)=>s9(e,"symbol"!=typeof t?t+"":t,r);class ot extends k{constructor(e,t,r=!0){super(e,t,r),this.core=e,this.logger=t,oe(this,"context","event-client"),oe(this,"storagePrefix",iV),oe(this,"storageVersion",.1),oe(this,"events",new Map),oe(this,"shouldPersist",!1),oe(this,"init",async()=>
508{if(!ti())try{let e={eventId:tr(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:eX(this.core.relayer.protocol,this.core.relayer.version,i1)}}};await this.sendEvent([e])}catch(e){this.logger.warn(e)}}),oe(this,"createEvent",e=>{let{event:t="ERROR",type:r="",properties:{topic:i,trace:n}}=e,s=tr(),o=this.core.projectId||"",a=s7({eventId:s,timestamp:Date.now(),props:{event:t,type:r,properties:{topic:i,trace:n}},bundleId:o,domain:this.getAppDomain()},this.setMethods(s));return this.telemetryEnabled&&(this.events.set(s,a),this.shouldPersist=!0),a}),oe(this,"getEvent",e=>{let{eventId:t,topic:r}=e;if(t)return this.events.get(t);let i=Array.from(this.events.values()).find(e=>e.props.properties.topic===r);if(i)return s7(s7({},i),this.setMethods(i.eventId))}),oe(this,"deleteEvent",e=>{let{eventId:t}=e;this.events.delete(t),this.shouldPersist=!0}),oe(this,"setEventListeners",()=>{this.core.heartbeat.on(y.li.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(e=>{(0,j.fromMiliseconds)(Date.now())-(0,j.fromMiliseconds)(e.timestamp)>86400&&(this.events.delete(e.eventId),this.shouldPersist=!0)})})}),oe(this,"setMethods",e=>({addTrace:t=>this.addTrace(e,t),setError:t=>this.setError(e,t)})),oe(this,"addTrace",(e,t)=>{let r=this.events.get(e);r&&(r.props.properties.trace.push(t),this.events.set(e,r),this.shouldPersist=!0)}),oe(this,"setError",(e,t)=>{let r=this.events.get(e);r&&(r.props.type=t,r.timestamp=Date.now(),this.events.set(e,r),this.shouldPersist=!0)}),oe(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),oe(this,"restore",async()=>{try{let e=await this.core.storage.getItem(this.storageKey)||[];if(!e.length)return;e.forEach(e=>{this.events.set(e.eventId,s7(s7({},e),this.setMethods(e.eventId)))})}catch(e){this.logger.warn(e)}}),oe(this,"submit",async()=>{if(!this.telemetryEnabled||0===this.events.size)return;let e=[];for(let[t,r]of this.events)r.props.type&&e.push(r);if(0!==e.length)try{if((await this.sendEvent(e)).ok)for(let t of e)this.events.delete(t.eventId),this.shouldPersist=!0}catch(e){this.logger.warn(e)}}),oe(this,"sendEvent",async e=>{let t=this.getAppDomain()?"":"&sp=desktop";return await fetch(`https://pulse.walletconnect.org/batch?projectId=${this.core.projectId}&st=events_sdk&sv=js-${i1}${t}`,{method:"POST",body:JSON.stringify(e)})}),oe(this,"getAppDomain",()=>eJ().url),this.logger=(0,w.U5)(t,this.context),this.telemetryEnabled=r,r?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var or=Object.defineProperty,oi=Object.getOwnPropertySymbols,on=Object.prototype.hasOwnProperty,os=Object.prototype.propertyIsEnumerable,oo=(e,t,r)=>t in e?or(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,oa=(e,t)=>{for(var r in t||(t={}))on.call(t,r)&&oo(e,r,t[r]);if(oi)for(var r of oi(t))os.call(t,r)&&oo(e,r,t[r]);return e},oc=(e,t,r)=>oo(e,"symbol"!=typeof t?t+"":t,r);class ol extends _{constructor(e){var t;super(e),oc(this,"protocol","wc"),oc(this,"version",2),oc(this,"name",iW),oc(this,"relayUrl"),oc(this,"projectId"),oc(this,"customStoragePrefix"),oc(this,"events",new g.EventEmitter),oc(this,"logger"),oc(this,"heartbeat"),oc(this,"relayer"),oc(this,"crypto"),oc(this,"storage"),oc(this,"history"),oc(this,"expirer"),oc(this,"pairing"),oc(this,"verify"),oc(this,"echoClient"),oc(this,"linkModeSupportedApps"),oc(this,"eventClient"),oc(this,"initialized",!1),oc(this,"logChunkController"),oc(this,"on",(e,t)=>this.events.on(e,t)),oc(this,"once",(e,t)=>this.events.once(e,t)),oc(this,"off",(e,t)=>this.events.off(e,t)),oc(this,"removeListener",(e,t)=>this.events.removeListener(e,t)),oc(this,"dispatchEnvelope",({topic:e,message:t,sessionExists:r})=>{if(!e||!t)return;let i={topic:e,message:t,publishedAt:Date.now(),transportType:i2.link_mode};this.relayer.onLinkMessageEvent(i,{sessionExists:r})}),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||iQ,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let r=(0,w.iP)({level:"string"==typeof e?.logger&&e.logger?e.logger:iK.logger,name:iW}),{logger:i,chunkLoggerController:n}=(0,w.D5)({opts:r,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=n,null!=(t=this.logChunkController)&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var e,t;null!=(e=this.logChunkController)&&e.downloadLogsBlobInBrowser&&(null==(t=this.logChunkController)||t.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=(0,w.U5)(i,this.name),this.heartbeat=new y.VH,this.crypto=new n9(this,this.logger,e?.keychain),this.history=new sG(this,this.logger),this.expirer=new sX(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new b.A(oa(oa({},iG),e?.storageOptions)),this.relayer=new sk({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new sW(this,this.logger),this.verify=new s0(this,this.logger,this.storage),this.echoClient=new s3(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new ot(this,this.logger,e?.telemetryEnabled)}static async init(e){let t=new ol(e);await t.initialize();let r=await t.crypto.getClientId();return await t.storage.setItem("WALLETCONNECT_CLIENT_ID",r),t}get context(){return(0,w.oI)(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return null==(e=this.logChunkController)?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(i3,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(
508),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(i3)||[],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}}}let oh="client",ou=`wc@2:${oh}:`,od={name:oh,logger:"error"},of="WALLETCONNECT_DEEPLINK_CHOICE",op="Proposal expired",og=j.SEVEN_DAYS,om={wc_sessionPropose:{req:{ttl:j.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:j.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:j.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:j.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:j.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:j.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:j.ONE_DAY,prompt:!1,tag:1104},res:{ttl:j.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:j.ONE_DAY,prompt:!1,tag:1106},res:{ttl:j.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:j.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:j.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:j.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:j.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:j.ONE_DAY,prompt:!1,tag:1112},res:{ttl:j.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:j.ONE_DAY,prompt:!1,tag:1114},res:{ttl:j.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:j.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:j.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:j.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:j.FIVE_MINUTES,prompt:!1,tag:1119}}},oy={min:j.FIVE_MINUTES,max:j.SEVEN_DAYS},ob={idle:"IDLE",active:"ACTIVE"},ow={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"}},ov=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],ox="[email protected]:auth:",oE=`${ox}:PUB_KEY`;var o_=Object.defineProperty,oI=Object.defineProperties,oA=Object.getOwnPropertyDescriptors,oS=Object.getOwnPropertySymbols,oC=Object.prototype.hasOwnProperty,oN=Object.prototype.propertyIsEnumerable,oO=(e,t,r)=>t in e?o_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,oP=(e,t)=>{for(var r in t||(t={}))oC.call(t,r)&&oO(e,r,t[r]);if(oS)for(var r of oS(t))oN.call(t,r)&&oO(e,r,t[r]);return e},oT=(e,t)=>oI(e,oA(t)),oM=(e,t,r)=>oO(e,"symbol"!=typeof t?t+"":t,r);class oR extends B{constructor(e){super(e),oM(this,"name","engine"),oM(this,"events",new(m())),oM(this,"initialized",!1),oM(this,"requestQueue",{state:ob.idle,queue:[]}),oM(this,"sessionRequestQueue",{state:ob.idle,queue:[]}),oM(this,"requestQueueDelay",j.ONE_SECOND),oM(this,"expectedPairingMethodMap",new Map),oM(this,"recentlyDeletedMap",new Map),oM(this,"recentlyDeletedLimit",200),oM(this,"relayMessageCache",[]),oM(this,"pendingSessions",new Map),oM(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(om)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},(0,j.toMiliseconds)(this.requestQueueDelay)))}),oM(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();let t=oT(oP({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);let{pairingTopic:r,requiredNamespaces:i,optionalNamespaces:n,sessionProperties:s,relays:o}=t,a=r,c,l=!1;try{if(a){let e=this.client.core.pairing.pairings.get(a);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),l=e.active}}catch(e){throw this.client.logger.error(`connect() -> pairing.get(${a}) failed`),e}if(!a||!l){let{topic:e,uri:t}=await this.client.core.pairing.create();a=e,c=t}if(!a){let{message:e}=iv("NO_MATCHING_KEY",`connect() pairing topic: ${a}`);throw Error(e)}let h=await this.client.core.crypto.generateKeyPair(),u=om.wc_sessionPropose.req.ttl||j.FIVE_MINUTES,d=e5(u),f=oT(oP({requiredNamespaces:i,optionalNamespaces:n,relays:o??[{protocol:"irn"}],proposer:{publicKey:h,metadata:this.client.metadata},expiryTimestamp:d,pairingTopic:a},s&&{sessionProperties:s}),{id:(0,iz.payloadId)()}),p=e4("session_connect",f.id),{reject:g,resolve:m,done:y}=e1(u,op),b=({id:e})=>{e===f.id&&(this.client.events.off("proposal_expire",b),this.pendingSessions.delete(f.id),this.events.emit(p,{error:{message:op,code:0}}))};return this.client.events.on("proposal_expire",b),this.events.once(p,({error:e,session:t})=>{this.client.events.off("proposal_expire",b),e?g(e):t&&m(t)}),await this.sendRequest({topic:a,method:"wc_sessionPropose",params:f,throwOnFailedPublish:!0,clientRpcId:f.id}),await this.setProposal(f.id,f),{uri:c,approval:y}}),oM(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(e){throw this.client.logger.error("pair() failed"),e}}),oM(this,"approve",async e=>{var t,r,i;let n=this.client.core.eventClient.createEvent({properties:{topic:null==(t=e?.id)?void 0:t.toString(),trace:[ns.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(e){throw n.setError(no.no_internet_connection),e}try{await this.isValidProposalId(e?.id)}catch(t){throw this.client.logger.error(`approve() -> proposal.get(${e?.id}) failed`),n.setError(no.proposal_not_found),t}try{await this.isValidApprove(e)}catch(e){throw this.client.logger.error("approve() -> isValidApprove() failed"),n.setError(no.session_approve_namespace_validation_failure),e}let{id:s,relayProtocol:o,namespaces:a,sessionProperties:c,sessionConfig:l}=e,h=this.client.proposal.get(s);this.client.core.eventClient.deleteEvent({eventId:n.eventId});let{pairingTopic:u,proposer:d,requiredNamespaces:f,optionalNamespaces:p}=h,g=null==(r=this.client.core.eventClient)?void 0:r.getEvent({topic:u});g||(g=null==(i=this.client.core.eventClient)?void 0:i.createEvent({type:ns.session_approve_started,properties:{topic:u,trace:[ns.session_approve_started,ns.session_namespaces_validation_success]}}));let m=await this.client.core.crypto.generateKeyPair(),y=d.publicKey,b=await this.client.core.crypto.generateSharedKey(m,y),w=oP(oP({relay:{protocol:o??"irn"},namespaces:a,controller:{publicKey:m,metadata:this.client.metadata},expiry:e5(og)},c&&{sessionProperties:c}),l&&{sessionConfig:l}),v=i2.relay;g.addTrace(ns.subscribing_session_topic);try{await this.client.core.relayer.subscribe(b,{transportType:v})}catch(e){throw g.setError(no.subscribe_session_topic_failure),e}g.addTrace(ns.subscribe_session_topic_success);let x=oT(oP({},w),{topic:b,requiredNamespaces:f,optionalNamespaces:p,pairingTopic:u,acknowledged:!1,self:w.controller,peer:{publicKey:d.publicKey,metadata:d.metadata},controller:m,transportType:i2.relay});await this.client.session.set(b,x),g.addTrace(ns.store_session);try{g.addTrace(ns.publishing_session_settle),await this.sendRequest({topic:b,method:"wc_sessionSettle",params:w,throwOnFailedPublish:!0}).catch(e=>{throw g?.setError(no.session_settle_publish_failure),e}),g.addTrace(ns.session_settle_publish_success),g.addTrace(ns.publishing_session_approve),await this.sendResult({id:s,topic:u,result:{relay:{protocol:o??"irn"},responderPublicKey:m},throwOnFailedPublish:!0}).catch(e=>{throw g?.setError(no.session_approve_publish_failure),e}),g.addTrace(ns.session_approve_publish_success)}catch(e){throw this.client.logger.error(e),this.client.session.delete(b,ix("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(b),e}return this.client.core.eventClient.deleteEvent({eventId:g.eventId}),await this.client.core.pairing.updateMetadata({topic:u,metadata:d.metadata}),await this.client.proposal.delete(s,ix("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}),await this.setExpiry(b,e5(og)),{topic:b,acknowledged:()=>Promise.resolve(this.client.session.get(b))}}),oM(this,"reject",async e=>{let t;this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(e){throw this.client.logger.error("reject() -> isValidReject() failed"),e}let{id:r,reason:i}=e;try{t=this.client.proposal.get(r).pairingTopic}catch(e){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),e}
508t&&(await this.sendError({id:r,topic:t,error:i,rpcOpts:om.wc_sessionPropose.reject}),await this.client.proposal.delete(r,ix("USER_DISCONNECTED")))}),oM(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(e){throw this.client.logger.error("update() -> isValidUpdate() failed"),e}let{topic:t,namespaces:r}=e,{done:i,resolve:n,reject:s}=e1(),o=(0,iz.payloadId)(),a=(0,iz.getBigIntRpcId)().toString(),c=this.client.session.get(t).namespaces;return this.events.once(e4("session_update",o),({error:e})=>{e?s(e):n()}),await this.client.session.update(t,{namespaces:r}),await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:r},throwOnFailedPublish:!0,clientRpcId:o,relayRpcId:a}).catch(e=>{this.client.logger.error(e),this.client.session.update(t,{namespaces:c}),s(e)}),{acknowledged:i}}),oM(this,"extend",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(e){throw this.client.logger.error("extend() -> isValidExtend() failed"),e}let{topic:t}=e,r=(0,iz.payloadId)(),{done:i,resolve:n,reject:s}=e1();return this.events.once(e4("session_extend",r),({error:e})=>{e?s(e):n()}),await this.setExpiry(t,e5(og)),this.sendRequest({topic:t,method:"wc_sessionExtend",params:{},clientRpcId:r,throwOnFailedPublish:!0}).catch(e=>{s(e)}),{acknowledged:i}}),oM(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(e){throw this.client.logger.error("request() -> isValidRequest() failed"),e}let{chainId:t,request:r,topic:i,expiry:n=om.wc_sessionRequest.req.ttl}=e,s=this.client.session.get(i);s?.transportType===i2.relay&&await this.confirmOnlineStateOrThrow();let o=(0,iz.payloadId)(),a=(0,iz.getBigIntRpcId)().toString(),{done:c,resolve:l,reject:h}=e1(n,"Request expired. Please try again.");this.events.once(e4("session_request",o),({error:e,result:t})=>{e?h(e):l(t)});let u="wc_sessionRequest",d=this.getAppLinkIfEnabled(s.peer.metadata,s.transportType);if(d)return await this.sendRequest({clientRpcId:o,relayRpcId:a,topic:i,method:u,params:{request:oT(oP({},r),{expiryTimestamp:e5(n)}),chainId:t},expiry:n,throwOnFailedPublish:!0,appLink:d}).catch(e=>h(e)),this.client.events.emit("session_request_sent",{topic:i,request:r,chainId:t,id:o}),await c();let f={request:oT(oP({},r),{expiryTimestamp:e5(n)}),chainId:t},p=this.shouldSetTVF(u,f);return await Promise.all([new Promise(async e=>{await this.sendRequest(oP({clientRpcId:o,relayRpcId:a,topic:i,method:u,params:f,expiry:n,throwOnFailedPublish:!0},p&&{tvf:this.getTVFParams(o,f)})).catch(e=>h(e)),this.client.events.emit("session_request_sent",{topic:i,request:r,chainId:t,id:o}),e()}),new Promise(async e=>{var t;if(!(null!=(t=s.sessionConfig)&&t.disableDeepLink)){let e=await te(this.client.core.storage,of);await e7({id:o,topic:i,wcDeepLink:e})}e()}),c()]).then(e=>e[2])}),oM(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);let{topic:t,response:r}=e,{id:i}=r,n=this.client.session.get(t);n.transportType===i2.relay&&await this.confirmOnlineStateOrThrow();let s=this.getAppLinkIfEnabled(n.peer.metadata,n.transportType);(0,iz.isJsonRpcResult)(r)?await this.sendResult({id:i,topic:t,result:r.result,throwOnFailedPublish:!0,appLink:s}):(0,iz.isJsonRpcError)(r)&&await this.sendError({id:i,topic:t,error:r.error,appLink:s}),this.cleanupAfterResponse(e)}),oM(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(e){throw this.client.logger.error("ping() -> isValidPing() failed"),e}let{topic:t}=e;if(this.client.session.keys.includes(t)){let e=(0,iz.payloadId)(),r=(0,iz.getBigIntRpcId)().toString(),{done:i,resolve:n,reject:s}=e1();this.events.once(e4("session_ping",e),({error:e})=>{e?s(e):n()}),await Promise.all([this.sendRequest({topic:t,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:e,relayRpcId:r}),i()])}else this.client.core.pairing.pairings.keys.includes(t)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:t}))}),oM(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);let{topic:t,event:r,chainId:i}=e,n=(0,iz.getBigIntRpcId)().toString(),s=(0,iz.payloadId)();await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:r,chainId:i},throwOnFailedPublish:!0,relayRpcId:n,clientRpcId:s})}),oM(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);let{topic:t}=e;if(this.client.session.keys.includes(t))await this.sendRequest({topic:t,method:"wc_sessionDelete",params:ix("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:t,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(t))await this.client.core.pairing.disconnect({topic:t});else{let{message:e}=iv("MISMATCHED_TOPIC",`Session or pairing topic not found: ${t}`);throw Error(e)}}),oM(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(t=>(function(e,t){let{requiredNamespaces:r}=t,i=Object.keys(e.namespaces),n=Object.keys(r),s=!0;return!!eQ(n,i)&&(i.forEach(t=>{let{accounts:i,methods:n,events:o}=e.namespaces[t],a=ip(i),c=r[t];eQ(eH(t,c),a)&&eQ(c.methods,n)&&eQ(c.events,o)||(s=!1)}),s)})(t,e)))),oM(this,"getPendingSessionRequests",()=>
508this.client.pendingRequest.getAll()),oM(this,"authenticate",async(e,t)=>{var r,i,n;let s;this.isInitialized(),this.isValidAuthenticate(e);let o=t&&this.client.core.linkModeSupportedApps.includes(t)&&(null==(r=this.client.metadata.redirect)?void 0:r.linkMode),a=o?i2.link_mode:i2.relay;a===i2.relay&&await this.confirmOnlineStateOrThrow();let{chains:c,statement:l="",uri:h,domain:u,nonce:d,type:f,exp:p,nbf:g,methods:m=[],expiry:y}=e,b=[...e.resources||[]],{topic:w,uri:v}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:a});this.client.logger.info({message:"Generated new pairing",pairing:{topic:w,uri:v}});let x=await this.client.core.crypto.generateKeyPair(),E=r7(x);if(await Promise.all([this.client.auth.authKeys.set(oE,{responseTopic:E,publicKey:x}),this.client.auth.pairingTopics.set(E,{topic:E,pairingTopic:w})]),await this.client.core.relayer.subscribe(E,{transportType:a}),this.client.logger.info(`sending request to new pairing topic: ${w}`),m.length>0){let{namespace:e}=eq(c[0]),t=tZ(function(e,t,r,i={}){return r?.sort((e,t)=>e.localeCompare(t)),{att:{[e]:function(e,t,r={}){return Object.assign({},...(t=t?.sort((e,t)=>e.localeCompare(t))).map(t=>({[`${e}/${t}`]:[r]})))}(t,r,i)}}}(e,"request",m));t3(b)&&(i=t,n=b.pop(),t=tZ(function(e,t){tQ(e),tQ(t);let r=Object.keys(e.att).concat(Object.keys(t.att)).sort((e,t)=>e.localeCompare(t)),i={att:{}};return r.forEach(r=>{var n,s;Object.keys((null==(n=e.att)?void 0:n[r])||{}).concat(Object.keys((null==(s=t.att)?void 0:s[r])||{})).sort((e,t)=>e.localeCompare(t)).forEach(n=>{var s,o;i.att[r]=tz(((e,t)=>{for(var r in t||(t={}))tF.call(t,r)&&tV(e,r,t[r]);if(tH)for(var r of tH(t))tW.call(t,r)&&tV(e,r,t[r]);return e})({},i.att[r]),tq({[n]:(null==(s=e.att[r])?void 0:s[n])||(null==(o=t.att[r])?void 0:o[n])}))})}),i}(t0(i),t0(n)))),b.push(t)}let _=y&&y>om.wc_sessionAuthenticate.req.ttl?y:om.wc_sessionAuthenticate.req.ttl,I={authPayload:{type:f??"caip122",chains:c,statement:l,aud:h,domain:u,version:"1",nonce:d,iat:new Date().toISOString(),exp:p,nbf:g,resources:b},requester:{publicKey:x,metadata:this.client.metadata},expiryTimestamp:e5(_)},A={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:c,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},relays:[{protocol:"irn"}],pairingTopic:w,proposer:{publicKey:x,metadata:this.client.metadata},expiryTimestamp:e5(om.wc_sessionPropose.req.ttl),id:(0,iz.payloadId)()},{done:S,resolve:C,reject:N}=e1(_,"Request expired"),O=(0,iz.payloadId)(),P=e4("session_connect",A.id),T=e4("session_request",O),M=async({error:e,session:t})=>{this.events.off(T,R),e?N(e):t&&C({session:t})},R=async e=>{var r,i,n;let s;if(await this.deletePendingAuthRequest(O,{message:"fulfilled",code:0}),e.error){let t=ix("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return e.error.code===t.code?void 0:(this.events.off(P,M),N(e.error.message))}await this.deleteProposal(A.id),this.events.off(P,M);let{cacaos:o,responder:c}=e.result,l=[],h=[];for(let e of o){await tJ({cacao:e,projectId:this.client.core.projectId})||(this.client.logger.error(e,"Signature verification failed"),N(ix("SESSION_SETTLEMENT_FAILED","Signature verification failed")));let{p:t}=e,r=t3(t.resources),i=[tG(t.iss)],n=tY(t.iss);if(r){let e=t1(r),t=t2(r);l.push(...e),i.push(...t)}for(let e of i)h.push(`${e}:${n}`)}let u=await this.client.core.crypto.generateSharedKey(x,c.publicKey);l.length>0&&(s={topic:u,acknowledged:!0,self:{publicKey:x,metadata:this.client.metadata},peer:c,controller:c.publicKey,expiry:e5(og),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:w,namespaces:iy([...new Set(l)],[...new Set(h)]),transportType:a},await this.client.core.relayer.subscribe(u,{transportType:a}),await this.client.session.set(u,s),w&&await this.client.core.pairing.updateMetadata({topic:w,metadata:c.metadata}),s=this.client.session.get(u)),null!=(r=this.client.metadata.redirect)&&r.linkMode&&null!=(i=c.metadata.redirect)&&i.linkMode&&null!=(n=c.metadata.redirect)&&n.universal&&t&&(this.client.core.addLinkModeSupportedApp(c.metadata.redirect.universal),this.client.session.update(u,{transportType:i2.link_mode})),C({auths:o,session:s})};this.events.once(P,M),this.events.once(T,R);try{if(o){let e=(0,iz.formatJsonRpcRequest)("wc_sessionAuthenticate",I,O);this.client.core.history.set(w,e);let r=await this.client.core.crypto.encode("",e,{type:2,encoding:r6});s=id(t,w,r)}else await Promise.all([this.sendRequest({topic:w,method:"wc_sessionAuthenticate",params:I,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:O}),this.sendRequest({topic:w,method:"wc_sessionPropose",params:A,expiry:om.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:A.id})])}catch(e){throw this.events.off(P,M),this.events.off(T,R),e}return await this.setProposal(A.id,A),await this.setAuthRequest(O,{request:oT(oP({},I),{verifyContext:{}}),pairingTopic:w,transportType:a}),{uri:s??v,response:S}}),oM(this,"approveSessionAuthenticate",async e=>{let t,{id:r,auths:i}=e,n=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[na.authenticated_session_approve_started]}});try{this.isInitialized()}catch(e){throw n.setError(nc.no_internet_connection),e}let s=this.getPendingAuthRequest(r);if(!s)throw n.setError(nc.authenticated_session_pending_request_not_found),Error(`Could not find pending auth request with id ${r}`);let o=s.transportType||i2.relay;o===i2.relay&&await this.confirmOnlineStateOrThrow();let a=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=r7(a),h={type:1,receiverPublicKey:a,senderPublicKey:c},u=[],d=[];for(let e of i){if(!await tJ({cacao:e,projectId:this.client.core.projectId})){n.setError(nc.invalid_cacao);let e=ix("SESSION_SETTLEMENT_FAILED","Signature verification failed");
508throw await this.sendError({id:r,topic:l,error:e,encodeOpts:h}),Error(e.message)}n.addTrace(na.cacaos_verified);let{p:t}=e,i=t3(t.resources),s=[tG(t.iss)],o=tY(t.iss);if(i){let e=t1(i),t=t2(i);u.push(...e),s.push(...t)}for(let e of s)d.push(`${e}:${o}`)}let f=await this.client.core.crypto.generateSharedKey(c,a);if(n.addTrace(na.create_authenticated_session_topic),u?.length>0){t={topic:f,acknowledged:!0,self:{publicKey:c,metadata:this.client.metadata},peer:{publicKey:a,metadata:s.requester.metadata},controller:a,expiry:e5(og),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:s.pairingTopic,namespaces:iy([...new Set(u)],[...new Set(d)]),transportType:o},n.addTrace(na.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:o})}catch(e){throw n.setError(nc.subscribe_authenticated_session_topic_failure),e}n.addTrace(na.subscribe_authenticated_session_topic_success),await this.client.session.set(f,t),n.addTrace(na.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:s.pairingTopic,metadata:s.requester.metadata})}n.addTrace(na.publishing_authenticated_session_approve);try{await this.sendResult({topic:l,id:r,result:{cacaos:i,responder:{publicKey:c,metadata:this.client.metadata}},encodeOpts:h,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(s.requester.metadata,o)})}catch(e){throw n.setError(nc.authenticated_session_approve_publish_failure),e}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:s.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:n.eventId}),{session:t}}),oM(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();let{id:t,reason:r}=e,i=this.getPendingAuthRequest(t);if(!i)throw Error(`Could not find pending auth request with id ${t}`);i.transportType===i2.relay&&await this.confirmOnlineStateOrThrow();let n=i.requester.publicKey,s=await this.client.core.crypto.generateKeyPair(),o=r7(n);await this.sendError({id:t,topic:o,error:r,encodeOpts:{type:1,receiverPublicKey:n,senderPublicKey:s},rpcOpts:om.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(i.requester.metadata,i.transportType)}),await this.client.auth.requests.delete(t,{message:"rejected",code:0}),await this.client.proposal.delete(t,ix("USER_DISCONNECTED"))}),oM(this,"formatAuthMessage",e=>{this.isInitialized();let{request:t,iss:r}=e;return tX(t,r)}),oM(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(0!==this.relayMessageCache.length)for(;this.relayMessageCache.length>0;)try{let e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)}),oM(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{let t=this.client.core.pairing.pairings.get(e.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter(r=>{var i,n;return(null==(i=r.peerMetadata)?void 0:i.url)&&(null==(n=r.peerMetadata)?void 0:n.url)===e.peer.metadata.url&&r.topic&&r.topic!==t.topic});if(0===r.length)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map(e=>this.client.core.pairing.disconnect({topic:e.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(e){this.client.logger.error(e)}}),oM(this,"deleteSession",async e=>{var t;let{topic:r,expirerHasDeleted:i=!1,emitEvent:n=!0,id:s=0}=e,{self:o}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await this.client.session.delete(r,ix("USER_DISCONNECTED")),this.addToRecentlyDeleted(r,"session"),this.client.core.crypto.keychain.has(o.publicKey)&&await this.client.core.crypto.deleteKeyPair(o.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),i||this.client.core.expirer.del(r),this.client.core.storage.removeItem(of).catch(e=>this.client.logger.warn(e)),this.getPendingSessionRequests().forEach(e=>{e.topic===r&&this.deletePendingSessionRequest(e.id,ix("USER_DISCONNECTED"))}),r===(null==(t=this.sessionRequestQueue.queue[0])?void 0:t.topic)&&(this.sessionRequestQueue.state=ob.idle),n&&this.client.events.emit("session_delete",{id:s,topic:r})}),oM(this,"deleteProposal",async(e,t)=>{if(t)try{let t=this.client.proposal.get(e),r=this.client.core.eventClient.getEvent({topic:t.pairingTopic});r?.setError(no.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,ix("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),oM(this,"deletePendingSessionRequest",async(e,t,r=!1)=>
508{await Promise.all([this.client.pendingRequest.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(t=>t.id!==e),r&&(this.sessionRequestQueue.state=ob.idle,this.client.events.emit("session_request_expire",{id:e}))}),oM(this,"deletePendingAuthRequest",async(e,t,r=!1)=>{await Promise.all([this.client.auth.requests.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)])}),oM(this,"setExpiry",async(e,t)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,t),await this.client.session.update(e,{expiry:t}))}),oM(this,"setProposal",async(e,t)=>{this.client.core.expirer.set(e,e5(om.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,t)}),oM(this,"setAuthRequest",async(e,t)=>{let{request:r,pairingTopic:i,transportType:n=i2.relay}=t;this.client.core.expirer.set(e,r.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:r.authPayload,requester:r.requester,expiryTimestamp:r.expiryTimestamp,id:e,pairingTopic:i,verifyContext:r.verifyContext,transportType:n})}),oM(this,"setPendingSessionRequest",async e=>{let{id:t,topic:r,params:i,verifyContext:n}=e,s=i.request.expiryTimestamp||e5(om.wc_sessionRequest.req.ttl);this.client.core.expirer.set(t,s),await this.client.pendingRequest.set(t,{id:t,topic:r,params:i,verifyContext:n})}),oM(this,"sendRequest",async e=>{let t,i,{topic:n,method:s,params:o,expiry:a,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:h,appLink:u,tvf:d}=e,f=(0,iz.formatJsonRpcRequest)(s,o,l),p=!!u;try{let e=p?r6:r5;t=await this.client.core.crypto.encode(n,f,{encoding:e})}catch(e){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),e}if(ov.includes(s)){let e=ie(JSON.stringify(f)),r=ie(t);i=await this.client.core.verify.register({id:r,decryptedId:e})}let g=om[s].req;if(g.attestation=i,a&&(g.ttl=a),c&&(g.id=c),this.client.core.history.set(n,f),p){let e=id(u,n,t);await r.g.Linking.openURL(e,this.client.name)}else{let e=om[s].req;a&&(e.ttl=a),c&&(e.id=c),e.tvf=oT(oP({},d),{correlationId:f.id}),h?(e.internal=oT(oP({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,t,e)):this.client.core.relayer.publish(n,t,e).catch(e=>this.client.logger.error(e))}return f.id}),oM(this,"sendResult",async e=>{let t,i,n,{id:s,topic:o,result:a,throwOnFailedPublish:c,encodeOpts:l,appLink:h}=e,u=(0,iz.formatJsonRpcResult)(s,a),d=h&&"u">typeof(null==r.g?void 0:r.g.Linking);try{let e=d?r6:r5;t=await this.client.core.crypto.encode(o,u,oT(oP({},l||{}),{encoding:e}))}catch(e){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${o} failed`),e}try{let e=(i=await this.client.core.history.get(o,s)).request;try{this.shouldSetTVF(e.method,e.params)&&(n=this.getTVFParams(s,e.params,a))}catch(e){this.client.logger.warn("sendResult() -> getTVFParams() failed",e)}}catch(e){throw this.client.logger.error(`sendResult() -> history.get(${o}, ${s}) failed`),e}if(d){let e=id(h,o,t);await r.g.Linking.openURL(e,this.client.name)}else{let e=om[i.request.method].res;e.tvf=oT(oP({},n),{correlationId:s}),c?(e.internal=oT(oP({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(o,t,e)):this.client.core.relayer.publish(o,t,e).catch(e=>this.client.logger.error(e))}await this.client.core.history.resolve(u)}),oM(this,"sendError",async e=>{let t,i,{id:n,topic:s,error:o,encodeOpts:a,rpcOpts:c,appLink:l}=e,h=(0,iz.formatJsonRpcError)(n,o),u=l&&"u">typeof(null==r.g?void 0:r.g.Linking);try{let e=u?r6:r5;t=await this.client.core.crypto.encode(s,h,oT(oP({},a||{}),{encoding:e}))}catch(e){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),e}try{i=await this.client.core.history.get(s,n)}catch(e){throw this.client.logger.error(`sendError() -> history.get(${s}, ${n}) failed`),e}if(u){let e=id(l,s,t);await r.g.Linking.openURL(e,this.client.name)}else{let e=i.request.method,r=c||om[e].res;this.client.core.relayer.publish(s,t,r)}await this.client.core.history.resolve(h)}),oM(this,"cleanup",async()=>{let e=[],t=[];
508this.client.session.getAll().forEach(t=>{let r=!1;e6(t.expiry)&&(r=!0),this.client.core.crypto.keychain.has(t.topic)||(r=!0),r&&e.push(t.topic)}),this.client.proposal.getAll().forEach(e=>{e6(e.expiryTimestamp)&&t.push(e.id)}),await Promise.all([...e.map(e=>this.deleteSession({topic:e})),...t.map(e=>this.deleteProposal(e))])}),oM(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),oM(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===ob.active)return void this.client.logger.info("Request queue already active, skipping...");for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=ob.active;let e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(e){this.client.logger.warn(e)}}this.requestQueue.state=ob.idle}),oM(this,"processRequest",async e=>{let{topic:t,payload:r,attestation:i,transportType:n,encryptedId:s}=e,o=r.method;if(!this.shouldIgnorePairingRequest({topic:t,requestMethod:o}))switch(o){case"wc_sessionPropose":return await this.onSessionProposeRequest
508({topic:t,payload:r,attestation:i,encryptedId:s});case"wc_sessionSettle":return await this.onSessionSettleRequest(t,r);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(t,r);case"wc_sessionExtend":return await this.onSessionExtendRequest(t,r);case"wc_sessionPing":return await this.onSessionPingRequest(t,r);case"wc_sessionDelete":return await this.onSessionDeleteRequest(t,r);case"wc_sessionRequest":return await this.onSessionRequest({topic:t,payload:r,attestation:i,encryptedId:s,transportType:n});case"wc_sessionEvent":return await this.onSessionEventRequest(t,r);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:t,payload:r,attestation:i,encryptedId:s,transportType:n});default:return this.client.logger.info(`Unsupported request method ${o}`)}}),oM(this,"onRelayEventResponse",async e=>{let{topic:t,payload:r,transportType:i}=e,n=(await this.client.core.history.get(t,r.id)).request.method;switch(n){case"wc_sessionPropose":return this.onSessionProposeResponse(t,r,i);case"wc_sessionSettle":return this.onSessionSettleResponse(t,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,r);case"wc_sessionExtend":return this.onSessionExtendResponse(t,r);case"wc_sessionPing":return this.onSessionPingResponse(t,r);case"wc_sessionRequest":return this.onSessionRequestResponse(t,r);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(t,r);default:return this.client.logger.info(`Unsupported response method ${n}`)}}),oM(this,"onRelayEventUnknownPayload",e=>{let{topic:t}=e,{message:r}=iv("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw Error(r)}),oM(this,"shouldIgnorePairingRequest",e=>{let{topic:t,requestMethod:r}=e,i=this.expectedPairingMethodMap.get(t);return!(!i||i.includes(r))&&!!(i.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),oM(this,"onSessionProposeRequest",async e=>{let{topic:t,payload:r,attestation:i,encryptedId:n}=e,{params:s,id:o}=r;try{let e=this.client.core.eventClient.getEvent({topic:t});0===this.client.events.listenerCount("session_proposal")&&(console.warn("No listener for session_proposal event"),e?.setError(nn.proposal_listener_not_found)),this.isValidConnect(oP({},r.params));let a=s.expiryTimestamp||e5(om.wc_sessionPropose.req.ttl),c=oP({id:o,pairingTopic:t,expiryTimestamp:a},s);await this.setProposal(o,c);let l=await this.getVerifyContext({attestationId:i,hash:ie(JSON.stringify(r)),encryptedId:n,metadata:c.proposer.metadata});e?.addTrace(ni.emit_session_proposal),this.client.events.emit("session_proposal",{id:o,params:c,verifyContext:l})}catch(e){await this.sendError({id:o,topic:t,error:e,rpcOpts:om.wc_sessionPropose.autoReject}),this.client.logger.error(e)}}),oM(this,"onSessionProposeResponse",async(e,t,r)=>{let{id:i}=t;if((0,iz.isJsonRpcResult)(t)){let{result:n}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:n});let s=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:s});let o=s.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:o});let a=n.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:a});let c=await this.client.core.crypto.generateSharedKey(o,a);this.pendingSessions.set(i,{sessionTopic:c,pairingTopic:e,proposalId:i,publicKey:o});let l=await this.client.core.relayer.subscribe(c,{transportType:r});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:l}),await this.client.core.pairing.activate({topic:e})}else if((0,iz.isJsonRpcError)(t)){await this.client.proposal.delete(i,ix("USER_DISCONNECTED"));let e=e4("session_connect",i);if(0===this.events.listenerCount(e))throw Error(`emitting ${e} without any listeners, 954`);this.events.emit(e,{error:t.error})}}),oM(this,"onSessionSettleRequest",async(e,t)=>{let{id:r,params:i}=t;try{this.isValidSessionSettleRequest(i);let{relay:r,controller:n,expiry:s,namespaces:o,sessionProperties:a,sessionConfig:c}=t.params,l=[...this.pendingSessions.values()].find(t=>t.sessionTopic===e);if(!l)return this.client.logger.error(`Pending session not found for topic ${e}`);let h=this.client.proposal.get(l.proposalId),u=oT(oP(oP({topic:e,relay:r,expiry:s,namespaces:o,acknowledged:!0,pairingTopic:l.pairingTopic,requiredNamespaces:h.requiredNamespaces,optionalNamespaces:h.optionalNamespaces,controller:n.publicKey,self:{publicKey:l.publicKey,metadata:this.client.metadata},peer:{publicKey:n.publicKey,metadata:n.metadata}},a&&{sessionProperties:a}),c&&{sessionConfig:c}
508),{transportType:i2.relay});await this.client.session.set(u.topic,u),await this.setExpiry(u.topic,u.expiry),await this.client.core.pairing.updateMetadata({topic:l.pairingTopic,metadata:u.peer.metadata}),this.client.events.emit("session_connect",{session:u}),this.events.emit(e4("session_connect",l.proposalId),{session:u}),this.pendingSessions.delete(l.proposalId),this.deleteProposal(l.proposalId,!1),this.cleanupDuplicatePairings(u),await this.sendResult({id:t.id,topic:e,result:!0,throwOnFailedPublish:!0})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),oM(this,"onSessionSettleResponse",async(e,t)=>{let{id:r}=t;(0,iz.isJsonRpcResult)(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(e4("session_approve",r),{})):(0,iz.isJsonRpcError)(t)&&(await this.client.session.delete(e,ix("USER_DISCONNECTED")),this.events.emit(e4("session_approve",r),{error:t.error}))}),oM(this,"onSessionUpdateRequest",async(e,t)=>{let{params:r,id:i}=t;try{let t=`${e}_session_update`,n=ij.get(t);if(n&&this.isRequestOutOfSync(n,i)){this.client.logger.warn(`Discarding out of sync request - ${i}`),this.sendError({id:i,topic:e,error:ix("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(oP({topic:e},r));try{ij.set(t,i),await this.client.session.update(e,{namespaces:r.namespaces}),await this.sendResult({id:i,topic:e,result:!0,throwOnFailedPublish:!0})}catch(e){throw ij.delete(t),e}this.client.events.emit("session_update",{id:i,topic:e,params:r})}catch(t){await this.sendError({id:i,topic:e,error:t}),this.client.logger.error(t)}}),oM(this,"isRequestOutOfSync",(e,t)=>t.toString().slice(0,-3)<e.toString().slice(0,-3)),oM(this,"onSessionUpdateResponse",(e,t)=>{let{id:r}=t,i=e4("session_update",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);(0,iz.isJsonRpcResult)(t)?this.events.emit(e4("session_update",r),{}):(0,iz.isJsonRpcError)(t)&&this.events.emit(e4("session_update",r),{error:t.error})}),oM(this,"onSessionExtendRequest",async(e,t)=>{let{id:r}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,e5(og)),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:r,topic:e})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),oM(this,"onSessionExtendResponse",(e,t)=>{let{id:r}=t,i=e4("session_extend",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);(0,iz.isJsonRpcResult)(t)?this.events.emit(e4("session_extend",r),{}):(0,iz.isJsonRpcError)(t)&&this.events.emit(e4("session_extend",r),{error:t.error})}),oM(this,"onSessionPingRequest",async(e,t)=>{let{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:r,topic:e})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),oM(this,"onSessionPingResponse",(e,t)=>{let{id:r}=t,i=e4("session_ping",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);setTimeout(()=>{(0,iz.isJsonRpcResult)(t)?this.events.emit(e4("session_ping",r),{}):(0,iz.isJsonRpcError)(t)&&this.events.emit(e4("session_ping",r),{error:t.error})},500)}),oM(this,"onSessionDeleteRequest",async(e,t)=>{let{id:r}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),Promise.all([new Promise(t=>{this.client.core.relayer.once(iZ.publish,async()=>{t(await this.deleteSession({topic:e,id:r}))})}),this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:ix("USER_DISCONNECTED")})]).catch(e=>this.client.logger.error(e))}catch(e){this.client.logger.error(e)}}),oM(this,"onSessionRequest",async e=>{var t,r,i;let{topic:n,payload:s,attestation:o,encryptedId:a,transportType:c}=e,{id:l,params:h}=s;try{await this.isValidRequest(oP({topic:n},h));let e=this.client.session.get(n),s=await this.getVerifyContext({attestationId:o,hash:ie(JSON.stringify((0,iz.formatJsonRpcRequest)("wc_sessionRequest",h,l))),encryptedId:a,metadata:e.peer.metadata,transportType:c}
508),u={id:l,topic:n,params:h,verifyContext:s};await this.setPendingSessionRequest(u),c===i2.link_mode&&null!=(t=e.peer.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(null==(r=e.peer.metadata.redirect)?void 0:r.universal),null!=(i=this.client.signConfig)&&i.disableRequestQueue?this.emitSessionRequest(u):(this.addSessionRequestToSessionRequestQueue(u),this.processSessionRequestQueue())}catch(e){await this.sendError({id:l,topic:n,error:e}),this.client.logger.error(e)}}),oM(this,"onSessionRequestResponse",(e,t)=>{let{id:r}=t,i=e4("session_request",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);(0,iz.isJsonRpcResult)(t)?this.events.emit(e4("session_request",r),{result:t.result}):(0,iz.isJsonRpcError)(t)&&this.events.emit(e4("session_request",r),{error:t.error})}),oM(this,"onSessionEventRequest",async(e,t)=>{let{id:r,params:i}=t;try{let t=`${e}_session_event_${i.event.name}`,n=ij.get(t);if(n&&this.isRequestOutOfSync(n,r))return void this.client.logger.info(`Discarding out of sync request - ${r}`);this.isValidEmit(oP({topic:e},i)),this.client.events.emit("session_event",{id:r,topic:e,params:i}),ij.set(t,r)}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),oM(this,"onSessionAuthenticateResponse",(e,t)=>{let{id:r}=t;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:t}),(0,iz.isJsonRpcResult)(t)?this.events.emit(e4("session_request",r),{result:t.result}):(0,iz.isJsonRpcError)(t)&&this.events.emit(e4("session_request",r),{error:t.error})}),oM(this,"onSessionAuthenticateRequest",async e=>{var t;let{topic:r,payload:i,attestation:n,encryptedId:s,transportType:o}=e;try{let{requester:e,authPayload:a,expiryTimestamp:c}=i.params,l=await this.getVerifyContext({attestationId:n,hash:ie(JSON.stringify(i)),encryptedId:s,metadata:e.metadata,transportType:o}),h={requester:e,pairingTopic:r,id:i.id,authPayload:a,verifyContext:l,expiryTimestamp:c};await this.setAuthRequest(i.id,{request:h,pairingTopic:r,transportType:o}),o===i2.link_mode&&null!=(t=e.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(e.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:r,params:i.params,id:i.id,verifyContext:l})}catch(s){this.client.logger.error(s);let e=i.params.requester.publicKey,t=await this.client.core.crypto.generateKeyPair(),n=this.getAppLinkIfEnabled(i.params.requester.metadata,o);await this.sendError({id:i.id,topic:r,error:s,encodeOpts:{type:1,receiverPublicKey:e,senderPublicKey:t},rpcOpts:om.wc_sessionAuthenticate.autoReject,appLink:n})}}),oM(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),oM(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ob.idle,this.processSessionRequestQueue()},(0,j.toMiliseconds)(this.requestQueueDelay))}),oM(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:t})=>{let r=this.client.core.history.pending;r.length>0&&r.filter(t=>t.topic===e&&"wc_sessionRequest"===t.request.method).forEach(e=>{let r=e4("session_request",e.request.id);if(0===this.events.listenerCount(r))throw Error(`emitting ${r} without any listeners`);this.events.emit(e4("session_request",e.request.id),{error:t})})}),oM(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===ob.active)return void this.client.logger.info("session request queue is already active.");let e=this.sessionRequestQueue.queue[0];if(!e)return void this.client.logger.info("session request queue is empty.");try{this.sessionRequestQueue.state=ob.active,this.emitSessionRequest(e)}catch(e){this.client.logger.error(e)}}),oM(this,"emitSessionRequest",e=>{this.client.events.emit("session_request",e)}),oM(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;let t=this.client.proposal.getAll().find(t=>t.pairingTopic===e.topic);
508t&&this.onSessionProposeRequest({topic:e.topic,payload:(0,iz.formatJsonRpcRequest)("wc_sessionPropose",{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties},t.id)})}),oM(this,"isValidConnect",async e=>{if(!iM(e)){let{message:t}=iv("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw Error(t)}let{pairingTopic:t,requiredNamespaces:r,optionalNamespaces:i,sessionProperties:n,relays:s}=e;if(iI(t)||await this.isValidPairingTopic(t),!function(e,t){let r=!1;return t&&!e?r=!0:e&&iE(e)&&e.length&&e.forEach(e=>{r=iT(e)}),r}(s,!0)){let{message:e}=iv("MISSING_OR_INVALID",`connect() relays: ${s}`);throw Error(e)}iI(r)||0===i_(r)||this.validateNamespaces(r,"requiredNamespaces"),iI(i)||0===i_(i)||this.validateNamespaces(i,"optionalNamespaces"),iI(n)||this.validateSessionProps(n,"sessionProperties")}),oM(this,"validateNamespaces",(e,t)=>{let r=function(e,t,r){let i=null;if(e&&i_(e)){let n,s=iO(e,t);s&&(i=s);let o=(n=null,Object.entries(e).forEach(([e,i])=>{var s,o;let a;if(n)return;let c=(s=eH(e,i),o=`${t} ${r}`,a=null,iE(s)&&s.length?s.forEach(e=>{a||iC(e)||(a=ix("UNSUPPORTED_CHAINS",`${o}, chain ${e} should be a string and conform to "namespace:chainId" format`))}):iC(e)||(a=ix("UNSUPPORTED_CHAINS",`${o}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),a);c&&(n=c)}),n);o&&(i=o)}else i=iv("MISSING_OR_INVALID",`${t}, ${r} should be an object with data`);return i}(e,"connect()",t);if(r)throw Error(r.message)}),oM(this,"isValidApprove",async e=>{if(!iM(e))throw Error(iv("MISSING_OR_INVALID",`approve() params: ${e}`).message);let{id:t,namespaces:r,relayProtocol:i,sessionProperties:n}=e;this.checkRecentlyDeleted(t),await this.isValidProposalId(t);let s=this.client.proposal.get(t),o=iP(r,"approve()");if(o)throw Error(o.message);let a=ik(s.requiredNamespaces,r,"approve()");if(a)throw Error(a.message);if(!iA(i,!0)){let{message:e}=iv("MISSING_OR_INVALID",`approve() relayProtocol: ${i}`);throw Error(e)}iI(n)||this.validateSessionProps(n,"sessionProperties")}),oM(this,"isValidReject",async e=>{if(!iM(e)){let{message:t}=iv("MISSING_OR_INVALID",`reject() params: ${e}`);throw Error(t)}let{id:t,reason:r}=e;if(this.checkRecentlyDeleted(t),await this.isValidProposalId(t),!function(e){return!(!e||"object"!=typeof e||!e.code||!iS(e.code,!1)||!e.message||!iA(e.message,!1))}(r)){let{message:e}=iv("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw Error(e)}}),oM(this,"isValidSessionSettleRequest",e=>{if(!iM(e)){let{message:t}=iv("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw Error(t)}
508let{relay:t,controller:r,namespaces:i,expiry:n}=e;if(!iT(t)){let{message:e}=iv("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw Error(e)}let s=function(e,t){let r=null;return iA(e?.publicKey,!1)||(r=iv("MISSING_OR_INVALID",`${t} controller public key should be a string`)),r}(r,"onSessionSettleRequest()");if(s)throw Error(s.message);let o=iP(i,"onSessionSettleRequest()");if(o)throw Error(o.message);if(e6(n)){let{message:e}=iv("EXPIRED","onSessionSettleRequest()");throw Error(e)}}),oM(this,"isValidUpdate",async e=>{if(!iM(e)){let{message:t}=iv("MISSING_OR_INVALID",`update() params: ${e}`);throw Error(t)}let{topic:t,namespaces:r}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);let i=this.client.session.get(t),n=iP(r,"update()");if(n)throw Error(n.message);let s=ik(i.requiredNamespaces,r,"update()");if(s)throw Error(s.message)}),oM(this,"isValidExtend",async e=>{if(!iM(e)){let{message:t}=iv("MISSING_OR_INVALID",`extend() params: ${e}`);throw Error(t)}let{topic:t}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t)}),oM(this,"isValidRequest",async e=>{if(!iM(e)){let{message:t}=iv("MISSING_OR_INVALID",`request() params: ${e}`);throw Error(t)}let{topic:t,request:r,chainId:i,expiry:n}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);let{namespaces:s}=this.client.session.get(t);if(!iR(s,i)){let{message:e}=iv("MISSING_OR_INVALID",`request() chainId: ${i}`);throw Error(e)}if(!function(e){return!(iI(e)||!iA(e.method,!1))}(r)){let{message:e}=iv("MISSING_OR_INVALID",`request() ${JSON.stringify(r)}`);throw Error(e)}if(!function(e,t,r){return!!iA(r,!1)&&(function(e,t){let r=[];return Object.values(e).forEach(e=>{ip(e.accounts).includes(t)&&r.push(...e.methods)}),r})(e,t).includes(r)}(s,i,r.method)){let{message:e}=iv("MISSING_OR_INVALID",`request() method: ${r.method}`);throw Error(e)}if(n&&!function(e,t){return iS(e,!1)&&e<=t.max&&e>=t.min}(n,oy)){let{message:e}=iv("MISSING_OR_INVALID",`request() expiry: ${n}. Expiry must be a number (in seconds) between ${oy.min} and ${oy.max}`);throw Error(e)}}),oM(this,"isValidRespond",async e=>{var t;if(!iM(e)){let{message:t}=iv("MISSING_OR_INVALID",`respond() params: ${e}`);throw Error(t)}let{topic:r,response:i}=e;try{await this.isValidSessionTopic(r)}catch(r){throw null!=(t=e?.response)&&t.id&&this.cleanupAfterResponse(e),r}if(!function(e){return!(iI(e)||iI(e.result)&&iI(e.error)||!iS(e.id,!1)||!iA(e.jsonrpc,!1))}(i)){let{message:e}=iv("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw Error(e)}}),oM(this,"isValidPing",async e=>{if(!iM(e)){let{message:t}=iv("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)}),oM(this,"isValidEmit",async e=>{if(!iM(e)){let{message:t}=iv("MISSING_OR_INVALID",`emit() params: ${e}`);throw Error(t)}let{topic:t,event:r,chainId:i}=e;await this.isValidSessionTopic(t);let{namespaces:n}=this.client.session.get(t);if(!iR(n,i)){let{message:e}=iv("MISSING_OR_INVALID",`emit() chainId: ${i}`);throw Error(e)}if(!function(e){return!(iI(e)||!iA(e.name,!1))}(r)||!function(e,t,r){return!!iA(r,!1)&&(function(e,t){let r=[];return Object.values(e).forEach(e=>{ip(e.accounts).includes(t)&&r.push(...e.events)}),r})(e,t).includes(r)}(n,i,r.name)){let{message:e}=iv("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw Error(e)}}),oM(this,"isValidDisconnect",async e=>{if(!iM(e)){let{message:t}=iv("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)}),oM(this,"isValidAuthenticate",e=>{let{chains:t,uri:r,domain:i,nonce:n}=e;if(!Array.isArray(t)||0===t.length)throw Error("chains is required and must be a non-empty array");if(!iA(r,!1))throw Error("uri is required parameter");if(!iA(i,!1))throw Error("domain is required parameter");if(!iA(n,!1))throw Error("nonce is required parameter");if([...new Set(t.map(e=>eq(e).namespace))].length>1)throw Error("Multi-namespace requests are not supported. Please request single namespace only.");let{namespace:s}=eq(t[0]);if("eip155"!==s)throw Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),oM(this,"getVerifyContext",async e=>{let{attestationId:t,hash:r,encryptedId:i,metadata:n,transportType:s}=e,o={verified:{verifyUrl:n.verifyUrl||ne,validation:"UNKNOWN",origin:n.url||""}};try{if(s===i2.link_mode){let e=this.getAppLinkIfEnabled(n,s);return o.verified.validation=e&&new URL(e).origin===new URL(n.url).origin?"VALID":"INVALID",o}let e=await this.client.core.verify.resolve({attestationId:t,hash:r,encryptedId:i,verifyUrl:n.verifyUrl});e&&(o.verified.origin=e.origin,o.verified.isScam=e.isScam,o.verified.validation=e.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(e){this.client.logger.warn(e)}return this.client.logger.debug(`Verify context: ${JSON.stringify(o)}`),o}),oM(this,"validateSessionProps",(e,t)=>
508{Object.values(e).forEach(e=>{if(!iA(e,!1)){let{message:r}=iv("MISSING_OR_INVALID",`${t} must be in Record<string, string> format. Received: ${JSON.stringify(e)}`);throw Error(r)}})}),oM(this,"getPendingAuthRequest",e=>{let t=this.client.auth.requests.get(e);return"object"==typeof t?t:void 0}),oM(this,"addToRecentlyDeleted",(e,t)=>{if(this.recentlyDeletedMap.set(e,t),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let e=0,t=this.recentlyDeletedLimit/2;for(let r of this.recentlyDeletedMap.keys()){if(e++>=t)break;this.recentlyDeletedMap.delete(r)}}}),oM(this,"checkRecentlyDeleted",e=>{let t=this.recentlyDeletedMap.get(e);if(t){let{message:r}=iv("MISSING_OR_INVALID",`Record was recently deleted - ${t}: ${e}`);throw Error(r)}}),oM(this,"isLinkModeEnabled",(e,t)=>{var i,n,s,o,a,c,l,h,u;return!!e&&t===i2.link_mode&&(null==(n=null==(i=this.client.metadata)?void 0:i.redirect)?void 0:n.linkMode)===!0&&(null==(o=null==(s=this.client.metadata)?void 0:s.redirect)?void 0:o.universal)!==void 0&&(null==(c=null==(a=this.client.metadata)?void 0:a.redirect)?void 0:c.universal)!==""&&(null==(l=e?.redirect)?void 0:l.universal)!==void 0&&(null==(h=e?.redirect)?void 0:h.universal)!==""&&(null==(u=e?.redirect)?void 0:u.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&"u">typeof(null==r.g?void 0:r.g.Linking)}),oM(this,"getAppLinkIfEnabled",(e,t)=>{var r;return this.isLinkModeEnabled(e,t)?null==(r=e?.redirect)?void 0:r.universal:void 0}),oM(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;let t=tt(e,"topic")||"",r=decodeURIComponent(tt(e,"wc_ev")||""),i=this.client.session.keys.includes(t);i&&this.client.session.update(t,{transportType:i2.link_mode}),this.client.core.dispatchEnvelope({topic:t,message:r,sessionExists:i})}),oM(this,"registerLinkModeListeners",async()=>{var e;if(ti()||eV()&&null!=(e=this.client.metadata.redirect)&&e.linkMode){let e=null==r.g?void 0:r.g.Linking;if("u">typeof e){e.addEventListener("url",this.handleLinkModeMessage,this.client.name);let t=await e.getInitialURL();t&&setTimeout(()=>{this.handleLinkModeMessage({url:t})},50)}}}),oM(this,"shouldSetTVF",(e,t)=>{if(!t||"wc_sessionRequest"!==e)return!1;let{request:r}=t;return Object.keys(ow).includes(r.method)}),oM(this,"getTVFParams",(e,t,r)=>{var i,n;try{let s=t.request.method,o=this.extractTxHashesFromResult(s,r);return oT(oP({correlationId:e,rpcMethods:[s],chainId:t.chainId},this.isValidContractData(t.request.params)&&{contractAddresses:[null==(n=null==(i=t.request.params)?void 0:i[0])?void 0:n.to]}),{txHashes:o})}catch(e){this.client.logger.warn("Error getting TVF params",e)}return{}}),oM(this,"isValidContractData",e=>{var t;if(!e)return!1;try{let r=e?.data||(null==(t=e?.[0])?void 0:t.data);if(!r.startsWith("0x"))return!1;let i=r.slice(2);return!!/^[0-9a-fA-F]*$/.test(i)&&i.length%2==0}catch{}return!1}),oM(this,"extractTxHashesFromResult",(e,t)=>{try{let r=ow[e];if("string"==typeof t)return[t];let i=t[r.key];if(iE(i))return i;if("string"==typeof i)return[i]}catch(e){this.client.logger.warn("Error extracting tx hashes from result",e)}return[]})}isInitialized(){if(!this.initialized){let{message:e}=iv("NOT_INITIALIZED",this.name);throw Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(iZ.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){let{topic:t,message:r,attestation:i,transportType:n}=e,{publicKey:s}=this.client.auth.authKeys.keys.includes(oE)?this.client.auth.authKeys.get(oE):{responseTopic:void 0,publicKey:void 0},o=await this.client.core.crypto.decode(t,r,{receiverPublicKey:s,encoding:n===i2.link_mode?r6:r5});try{(0,iz.isJsonRpcRequest)(o)?(this.client.core.history.set(t,o),this.onRelayEventRequest({topic:t,payload:o,attestation:i,transportType:n,encryptedId:ie(r)})):(0,iz.isJsonRpcResponse)(o)?(await this.client.core.history.resolve(o),await this.onRelayEventResponse({topic:t,payload:o,transportType:n}),this.client.core.history.delete(t,o.id)):this.onRelayEventUnknownPayload({topic:t,payload:o,transportType:n})}catch(e){this.client.logger.error(e)}}registerExpirerEvents(){this.client.core.expirer.on(i7.expired,async e=>
508{let{topic:t,id:r}=e8(e.target);return r&&this.client.pendingRequest.keys.includes(r)?await this.deletePendingSessionRequest(r,iv("EXPIRED"),!0):r&&this.client.auth.requests.keys.includes(r)?await this.deletePendingAuthRequest(r,iv("EXPIRED"),!0):void(t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r})))})}registerPairingEvents(){this.client.core.pairing.events.on(i4.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(i4.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!iA(e,!1)){let{message:t}=iv("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:t}=iv("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if(e6(this.client.core.pairing.pairings.get(e).expiry)){let{message:t}=iv("EXPIRED",`pairing topic: ${e}`);throw Error(t)}}async isValidSessionTopic(e){if(!iA(e,!1)){let{message:t}=iv("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){let{message:t}=iv("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw Error(t)}if(e6(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});let{message:t}=iv("EXPIRED",`session topic: ${e}`);throw Error(t)}if(!this.client.core.crypto.keychain.has(e)){let{message:t}=iv("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(iA(e,!1)){let{message:t}=iv("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw Error(t)}else{let{message:t}=iv("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw Error(t)}}async isValidProposalId(e){if("number"!=typeof e){let{message:t}=iv("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw Error(t)}if(!this.client.proposal.keys.includes(e)){let{message:t}=iv("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw Error(t)}if(e6(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);let{message:t}=iv("EXPIRED",`proposal id: ${e}`);throw Error(t)}}}class ok extends sq{constructor(e,t){super(e,t,"proposal",ou),this.core=e,this.logger=t}}class oD extends sq{constructor(e,t){super(e,t,"session",ou),this.core=e,this.logger=t}}class oL extends sq{constructor(e,t){super(e,t,"request",ou,e=>e.id),this.core=e,this.logger=t}}class oU extends sq{constructor(e,t){super(e,t,"authKeys",ox,()=>oE),this.core=e,this.logger=t}}class oB extends sq{constructor(e,t){super(e,t,"pairingTopics",ox),this.core=e,this.logger=t}}class oj extends sq{constructor(e,t){super(e,t,"requests",ox,e=>e.id),this.core=e,this.logger=t}}var o$=Object.defineProperty,oz=(e,t,r)=>((e,t,r)=>t in e?o$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class oq{constructor(e,t){this.core=e,this.logger=t,oz(this,"authKeys"),oz(this,"pairingTopics"),oz(this,"requests"),this.authKeys=new oU(this.core,this.logger),this.pairingTopics=new oB(this.core,this.logger),this.requests=new oj(this.core,this.logger)}
508async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var oH=Object.defineProperty,oF=(e,t,r)=>((e,t,r)=>t in e?oH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class oW extends U{constructor(e){super(e),oF(this,"protocol","wc"),oF(this,"version",2),oF(this,"name",od.name),oF(this,"metadata"),oF(this,"core"),oF(this,"logger"),oF(this,"events",new g.EventEmitter),oF(this,"engine"),oF(this,"session"),oF(this,"proposal"),oF(this,"pendingRequest"),oF(this,"auth"),oF(this,"signConfig"),oF(this,"on",(e,t)=>this.events.on(e,t)),oF(this,"once",(e,t)=>this.events.once(e,t)),oF(this,"off",(e,t)=>this.events.off(e,t)),oF(this,"removeListener",(e,t)=>this.events.removeListener(e,t)),oF(this,"removeAllListeners",e=>this.events.removeAllListeners(e)),oF(this,"connect",async e=>{try{return await this.engine.connect(e)}catch(e){throw this.logger.error(e.message),e}}),oF(this,"pair",async e=>{try{return await this.engine.pair(e)}catch(e){throw this.logger.error(e.message),e}}),oF(this,"approve",async e=>{try{return await this.engine.approve(e)}catch(e){throw this.logger.error(e.message),e}}),oF(this,"reject",async e=>{try{return await this.engine.reject(e)}catch(e){throw this.logger.error(e.message),e}}),oF(this,"update",async e=>{try{return await this.engine.update(e)}catch(e){throw this.logger.error(e.message),e}}),oF(this,"extend",async e=>{try{return await this.engine.extend(e)}catch(e){throw this.logger.error(e.message),e}}),oF(this,"request",async e=>{try{return await this.engine.request(e)}catch(e){throw this.logger.error(e.message),e}}),oF(this,"respond",async e=>{try{return await this.engine.respond(e)}catch(e){throw this.logger.error(e.message),e}}),oF(this,"ping",async e=>{try{return await this.engine.ping(e)}catch(e){throw this.logger.error(e.message),e}}),oF(this,"emit",async e=>{try{return await this.engine.emit(e)}catch(e){throw this.logger.error(e.message),e}}),oF(this,"disconnect",async e=>{try{return await this.engine.disconnect(e)}catch(e){throw this.logger.error(e.message),e}}),oF(this,"find",e=>{try{return this.engine.find(e)}catch(e){throw this.logger.error(e.message),e}}),oF(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}}),oF(this,"authenticate",async(e,t)=>{try{return await this.engine.authenticate(e,t)}catch(e){throw this.logger.error(e.message),e}}),oF(this,"formatAuthMessage",e=>{try{return this.engine.formatAuthMessage(e)}catch(e){throw this.logger.error(e.message),e}}),oF(this,"approveSessionAuthenticate",async e=>{try{return await this.engine.approveSessionAuthenticate(e)}catch(e){throw this.logger.error(e.message),e}}),oF(this,"rejectSessionAuthenticate",async e=>{try{return await this.engine.rejectSessionAuthenticate(e)}catch(e){throw this.logger.error(e.message),e}}),this.name=e?.name||od.name,this.metadata=e?.metadata||eJ(),this.signConfig=e?.signConfig;let t="u">typeof e?.logger&&"string"!=typeof e?.logger?e.logger:(0,w.h6)((0,w.iP)({level:e?.logger||od.logger}));this.core=e?.core||new ol(e),this.logger=(0,w.U5)(t,this.name),this.session=new oD(this.core,this.logger),this.proposal=new ok(this.core,this.logger),this.pendingRequest=new oL(this.core,this.logger),this.engine=new oR(this),this.auth=new oq(this.core,this.logger)}static async init(e){let t=new oW(e);return await t.initialize(),t}get context(){return(0,w.oI)(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),setTimeout(()=>{this.engine.processRelayMessageCache()},(0,j.toMiliseconds)(j.ONE_SECOND))}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var oV=r(57317);let oK="error",oG="wc@2:universal_provider:",oY="https://rpc.walletconnect.org/v1/",oJ="generic",oX=`${oY}bundler`,oQ={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var oZ="u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof r.g?r.g:"u">typeof self?self:{},o0=function(e,t){return e===t||e!=e&&t!=t},o1=function(e,t){for(var r=e.length;r--;)if(o0(e[r][0],t))return r;return -1},o2=Array.prototype.splice;function o3(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}o3.prototype.clear=function(){this.__data__=[],this.size=0},o3.prototype.delete=function(e){var t=this.__data__,r=o1(t,e);return!(r<0)&&(r==t.length-1?t.pop():o2.call(t,r,1),--this.size,!0)},o3.prototype.get=function(e){var t=this.__data__,r=o1(t,e);return r<0?void 0:t[r][1]},o3.prototype.has=function(e){return o1(this.__data__,e)>-1},o3.prototype.set=function(e,t){var r=this.__data__,i=o1(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this};var o8="object"==typeof oZ&&oZ&&oZ.Object===Object&&oZ,o5="object"==typeof self&&self&&self.Object===Object&&self,o6=o8||o5||Function("return this")(),o4=o6.Symbol,o9=Object.prototype,o7=o9.hasOwnProperty,ae=o9.toString,at=o4?o4.toStringTag:void 0,ar=Object.prototype.toString,ai=function(e){var t=o7.call(e,at),r=e[at];try{e[at]=void 0;var i=!0}catch{}var n=ae.call(e);return i&&(t?e[at]=r:delete e[at]),n},an=o4?o4.toStringTag:void 0,as=function(e){return null==e?void 0===e?"[object Undef
508ined]":"[object Null]":an&&an in Object(e)?ai(e):ar.call(e)},ao=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},aa=function(e){if(!ao(e))return!1;var t=as(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},ac=o6["__core-js_shared__"],al=function(){var e=/[^.]+$/.exec(ac&&ac.keys&&ac.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ah=Function.prototype.toString,au=function(e){if(null!=e){try{return ah.call(e)}catch{}try{return e+""}catch{}}return""},ad=/^\[object .+?Constructor\]$/,af=Object.prototype,ap=Function.prototype.toString,ag=af.hasOwnProperty,am=RegExp("^"+ap.call(ag).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ay=function(e){return!!ao(e)&&(!al||!(al in e))&&(aa(e)?am:ad).test(au(e))},ab=function(e,t){var r=e?.[t];return ay(r)?r:void 0},aw=ab(o6,"Map"),av=ab(Object,"create"),ax=Object.prototype.hasOwnProperty,aE=Object.prototype.hasOwnProperty;function a_(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}a_.prototype.clear=function(){this.__data__=av?av(null):{},this.size=0},a_.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},a_.prototype.get=function(e){var t=this.__data__;if(av){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return ax.call(t,e)?t[e]:void 0},a_.prototype.has=function(e){var t=this.__data__;return av?void 0!==t[e]:aE.call(t,e)},a_.prototype.set=function(e,t){var r=this.__data__;return this.size+=+!this.has(e),r[e]=av&&void 0===t?"__lodash_hash_undefined__":t,this};var aI=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},aA=function(e,t){var r=e.__data__;return aI(t)?r["string"==typeof t?"string":"hash"]:r.map};function aS(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function aC(e){var t=this.__data__=new o3(e);this.size=t.size}aS.prototype.clear=function(){this.size=0,this.__data__={hash:new a_,map:new(aw||o3),string:new a_}},aS.prototype.delete=function(e){var t=aA(this,e).delete(e);return this.size-=!!t,t},aS.prototype.get=function(e){return aA(this,e).get(e)},aS.prototype.has=function(e){return aA(this,e).has(e)},aS.prototype.set=function(e,t){var r=aA(this,e),i=r.size;return r.set(e,t),this.size+=+(r.size!=i),this},aC.prototype.clear=function(){this.__data__=new o3,this.size=0},aC.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},aC.prototype.get=function(e){return this.__data__.get(e)},aC.prototype.has=function(e){return this.__data__.has(e)},aC.prototype.set=function(e,t){var r=this.__data__;if(r instanceof o3){var i=r.__data__;if(!aw||i.length<199)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new aS(i)}return r.set(e,t),this.size=r.size,this};var aN=function(){try{var e=ab(Object,"defineProperty");return e({},"",{}),e}catch{}}(),aO=function(e,t,r){"__proto__"==t&&aN?aN(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},aP=function(e,t,r){(void 0===r||o0(e[t],r))&&(void 0!==r||t in e)||aO(e,t,r)},aT={exports:{}};!function(e,t){var r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,n=i&&i.exports===r?o6.Buffer:void 0,s=n?n.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var r=e.length,i=s?s(r):new e.constructor(r);return e.copy(i),i}}(aT,aT.exports);var aM=o6.Uint8Array,aR=function(e){var t=new e.constructor(e.byteLength);return new aM(t).set(new aM(e)),t},ak=Object.create,aD=function(){function e(){}return function(t){if(!ao(t))return{};if(ak)return ak(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),aL=(n=Object.getPrototypeOf,s=Object,function(e){return n(s(e))}),aU=Object.prototype,aB=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||aU)},aj=function(e){return null!=e&&"object"==typeof e},a$=function(e){return aj(e)&&"[object Arguments]"==as(e)},az=Object.prototype,aq=az.hasOwnProperty,aH=az.propertyIsEnumerable,aF=a$(function(){return arguments}())?a$:function(e){return aj(e)&&aq.call(e,"callee")&&!aH.call(e,"callee")},aW=Array.isArray,aV=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff},aK=function(e){return null!=e&&aV(e.length)&&!aa(e)},aG={exports:{}},aY=function(){return!1};!function(e,t){var r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,n=i&&i.exports===r?o6.Buffer:void 0;e.exports=(n?n.isBuffer:void 0)||aY}(aG,aG.exports);var aJ=Object.prototype,aX=Function.prototype.toString,aQ=aJ.hasOwnProperty,aZ=aX.call(Object),a0={};
508a0["[object Float32Array]"]=a0["[object Float64Array]"]=a0["[object Int8Array]"]=a0["[object Int16Array]"]=a0["[object Int32Array]"]=a0["[object Uint8Array]"]=a0["[object Uint8ClampedArray]"]=a0["[object Uint16Array]"]=a0["[object Uint32Array]"]=!0,a0["[object Arguments]"]=a0["[object Array]"]=a0["[object ArrayBuffer]"]=a0["[object Boolean]"]=a0["[object DataView]"]=a0["[object Date]"]=a0["[object Error]"]=a0["[object Function]"]=a0["[object Map]"]=a0["[object Number]"]=a0["[object Object]"]=a0["[object RegExp]"]=a0["[object Set]"]=a0["[object String]"]=a0["[object WeakMap]"]=!1;var a1={exports:{}};!function(e,t){var r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,n=i&&i.exports===r&&o8.process;e.exports=function(){try{return i&&i.require&&i.require("util").types||n&&n.binding&&n.binding("util")}catch{}}()}(a1,a1.exports);var a2=a1.exports,a3=a2&&a2.isTypedArray,a8=a3?function(e){return a3(e)}:function(e){return aj(e)&&aV(e.length)&&!!a0[as(e)]},a5=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]},a6=Object.prototype.hasOwnProperty,a4=function(e,t,r){var i=e[t];a6.call(e,t)&&o0(i,r)&&(void 0!==r||t in e)||aO(e,t,r)},a9=/^(?:0|[1-9]\d*)$/,a7=function(e,t){var r=typeof e;return!!(t=t??0x1fffffffffffff)&&("number"==r||"symbol"!=r&&a9.test(e))&&e>-1&&e%1==0&&e<t},ce=function(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i},ct=aG.exports,cr=Object.prototype.hasOwnProperty,ci=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t},cn=Object.prototype.hasOwnProperty,cs=function(e,t){var r=aW(e),i=!r&&aF(e),n=!r&&!i&&ct(e),s=!r&&!i&&!n&&a8(e),o=r||i||n||s,a=o?ce(e.length,String):[],c=a.length;for(var l in e)(t||cr.call(e,l))&&!(o&&("length"==l||n&&("offset"==l||"parent"==l)||s&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||a7(l,c)))&&a.push(l);return a},co=function(e){if(!ao(e))return ci(e);var t=aB(e),r=[];for(var i in e)"constructor"==i&&(t||!cn.call(e,i))||r.push(i);return r},ca=function(e){return aK(e)?cs(e,!0):co(e)},cc=function(e,t,r,i){var n=!r;r||(r={});for(var s=-1,o=t.length;++s<o;){var a=t[s],c=i?i(r[a],e[a],a,r,e):void 0;void 0===c&&(c=e[a]),n?aO(r,a,c):a4(r,a,c)}return r},cl=aT.exports,ch=function(e,t){var r=t?aR(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)},cu=function(e,t){var r=-1,i=e.length;for(t||(t=Array(i));++r<i;)t[r]=e[r];return t},cd=aG.exports,cf=function(e){if(!aj(e)||"[object Object]"!=as(e))return!1;var t=aL(e);if(null===t)return!0;var r=aQ.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&aX.call(r)==aZ},cp=function(e,t,r){for(var i=-1,n=Object(e),s=r(e),o=s.length;o--;){var a=s[++i];if(!1===t(n[a],a,n))break}return e},cg=function(e,t,r,i,n,s,o){var a=a5(e,r),c=a5(t,r),l=o.get(c);if(l)return void aP(e,r,l);var h=s?s(a,c,r+"",e,t,o):void 0,u=void 0===h;if(u){var d=aW(c),f=!d&&cd(c),p=!d&&!f&&a8(c);h=c,d||f||p?aW(a)?h=a:aj(a)&&aK(a)?h=cu(a):f?(u=!1,h=cl(c,!0)):p?(u=!1,h=ch(c,!0)):h=[]:cf(c)||aF(c)?(h=a,aF(a)?h=cc(a,ca(a)):(!ao(a)||aa(a))&&(h="function"!=typeof c.constructor||aB(c)?{}:aD(aL(c)))):u=!1}u&&(o.set(c,h),n(h,c,i,s,o),o.delete(c)),aP(e,r,h)},cm=function(e){return e},cy=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)},cb=Math.max,cw=Date.now,cv=function(e){var t=0,r=0;return function(){var i=cw(),n=16-(i-r);if(r=i,n>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(aN?function(e,t){return aN(e,"toString",{configurable:!0,enumerable:!1,value:function(){return t},writable:!0})}:cm),cx=function(e,t){var r;return cv((r=cb(void 0===(r=t)?e.length-1:r,0),function(){for(var t=arguments,i=-1,n=cb(t.length-r,0),s=Array(n);++i<n;)s[i]=t[r+i];i=-1;for(var o=Array(r+1);++i<r;)o[i]=t[i];return o[r]=cm(s),cy(e,this,o)}),e+"")},cE=function(e,t,r){if(!ao(r))return!1;var i=typeof t;return("number"==i?!!(aK(r)&&a7(t,r.length)):"string"==i&&t in r)&&o0(r[t],e)},c_=function e(t,r,i,n,s){t!==r&&cp(r,function(o,a){if(s||(s=new aC),ao(o))cg(t,r,a,i,e,n,s);else{var c=n?n(a5(t,a),o,a+"",t,r,s):void 0;void 0===c&&(c=o),aP(t,a,c)}},ca)},cI=function(e){return cx(function(t,r){var i=-1,n=r.length,s=n>1?r[n-1]:void 0,o=n>2?r[2]:void 0;for(s=e.length>
5083&&"function"==typeof s?(n--,s):void 0,o&&cE(r[0],r[1],o)&&(s=n<3?void 0:s,n=1),t=Object(t);++i<n;){var a=r[i];a&&e(t,a,i,s)}return t})}(function(e,t,r){c_(e,t,r)}),cA=Object.defineProperty,cS=Object.defineProperties,cC=Object.getOwnPropertyDescriptors,cN=Object.getOwnPropertySymbols,cO=Object.prototype.hasOwnProperty,cP=Object.prototype.propertyIsEnumerable,cT=(e,t,r)=>t in e?cA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cM=(e,t)=>{for(var r in t||(t={}))cO.call(t,r)&&cT(e,r,t[r]);if(cN)for(var r of cN(t))cP.call(t,r)&&cT(e,r,t[r]);return e},cR=(e,t)=>cS(e,cC(t));function ck(e,t,r){var i;let n=eq(e);return(null==(i=t.rpcMap)?void 0:i[n.reference])||`${oY}?chainId=${n.namespace}:${n.reference}&projectId=${r}`}function cD(e){return e.includes(":")?e.split(":")[1]:e}function cL(e){return e.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function cU(e={},t={}){return cI(cB(e),cB(t))}function cB(e){var t,r,i,n;let s={};if(!i_(e))return s;for(let[o,a]of Object.entries(e)){let e=ig(o)?[o]:a.chains,c=a.methods||[],l=a.events||[],h=a.rpcMap||{},u=im(o);s[u]=cR(cM(cM({},s[u]),a),{chains:e9(e,null==(t=s[u])?void 0:t.chains),methods:e9(c,null==(r=s[u])?void 0:r.methods),events:e9(l,null==(i=s[u])?void 0:i.events),rpcMap:cM(cM({},h),null==(n=s[u])?void 0:n.rpcMap)})}return s}function cj(e){return e.includes(":")?e.split(":")[2]:e}function c$(e){let t={};for(let[r,i]of Object.entries(e)){let e=i.methods||[],n=i.events||[],s=i.accounts||[],o=ig(r)?[r]:i.chains?i.chains:cL(i.accounts);t[r]={chains:o,methods:e,events:n,accounts:s}}return t}function cz(e){return"number"==typeof e?e:e.includes("0x")?parseInt(e,16):isNaN(Number(e=e.includes(":")?e.split(":")[1]:e))?e:Number(e)}let cq={},cH=e=>cq[e],cF=(e,t)=>{cq[e]=t};var cW=Object.defineProperty,cV=(e,t,r)=>((e,t,r)=>t in e?cW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class cK{constructor(e){cV(this,"name","polkadot"),cV(this,"client"),cV(this,"httpProviders"),cV(this,"events"),cV(this,"namespace"),cV(this,"chainId"),this.namespace=e.namespace,this.events=cH("events"),this.client=cH("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(oQ.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=cD(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ck(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new i$.F(new oV.A(r,cH("disableProviderPing")))}}var cG=Object.defineProperty,cY=Object.defineProperties,cJ=Object.getOwnPropertyDescriptors,cX=Object.getOwnPropertySymbols,cQ=Object.prototype.hasOwnProperty,cZ=Object.prototype.propertyIsEnumerable,c0=(e,t,r)=>t in e?cG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,c1=(e,t)=>{for(var r in t||(t={}))cQ.call(t,r)&&c0(e,r,t[r]);if(cX)for(var r of cX(t))cZ.call(t,r)&&c0(e,r,t[r]);return e},c2=(e,t)=>cY(e,cJ(t)),c3=(e,t,r)=>c0(e,"symbol"!=typeof t?t+"":t,r);class c8{constructor(e){c3(this,"name","eip155"),c3(this,"client"),c3(this,"chainId"),c3(this,"namespace"),c3(this,"httpProviders"),c3(this,"events"),this.namespace=e.namespace,this.events=cH("events"),this.client=cH("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(oQ.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){let r=t||ck(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new i$.F(new oV.V(r,cH("disableProviderPing")))}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=parseInt(cD(t));e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(){let e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,r;let i=e.request.params?null==(t=e.request.params[0])?void 0:t.chainId:"0x0",n=parseInt(i=i.startsWith("0x")?i:`0x${i}`,16);if(this.isChainApproved(n))this.setDefaultChain(`${n}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:null==(r=this.namespace.chains)?void 0:r[0]}),this.setDefaultChain(`${n}`);else throw Error(`Failed to switch to chain 'eip155:${n}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,r,i;let n=null==(r=null==(t=e.request)?void 0:t.params)?void 0:r[0];if(!n)throw Error("Missing address parameter in `wallet_getCapabilities` request");let s=this.client.session.get(e.topic),o=(null==(i=s?.sessionProperties)?void 0:i.capabilities)||{};if(null!=o&&o[n])return o?.[n];let a=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:c2(c1({},s.sessionProperties||{}),{capabilities:c2(c1({},o||{}),{[n]:a})})})}catch(e){console.warn("Failed to update session with capabilities",e)}return a}
508async getCallStatus(e){var t,r;let i=this.client.session.get(e.topic),n=null==(t=i.sessionProperties)?void 0:t.bundler_name;if(n){let t=this.getBundlerUrl(e.chainId,n);try{return await this.getUserOperationReceipt(t,e)}catch(e){console.warn("Failed to fetch call status from bundler",e,t)}}let s=null==(r=i.sessionProperties)?void 0:r.bundler_url;if(s)try{return await this.getUserOperationReceipt(s,e)}catch(e){console.warn("Failed to fetch call status from custom bundler",e,s)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var r;let i=new URL(e),n=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((0,iz.formatJsonRpcRequest)("eth_getUserOperationReceipt",[null==(r=t.request.params)?void 0:r[0]]))});if(!n.ok)throw Error(`Failed to fetch user operation receipt - ${n.status}`);return await n.json()}getBundlerUrl(e,t){return`${oX}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}var c5=Object.defineProperty,c6=(e,t,r)=>((e,t,r)=>t in e?c5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class c4{constructor(e){c6(this,"name","solana"),c6(this,"client"),c6(this,"httpProviders"),c6(this,"events"),c6(this,"namespace"),c6(this,"chainId"),this.namespace=e.namespace,this.events=cH("events"),this.client=cH("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(oQ.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=cD(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ck(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new i$.F(new oV.A(r,cH("disableProviderPing")))}}var c9=Object.defineProperty,c7=(e,t,r)=>((e,t,r)=>t in e?c9(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class le{constructor(e){c7(this,"name","cosmos"),c7(this,"client"),c7(this,"httpProviders"),c7(this,"events"),c7(this,"namespace"),c7(this,"chainId"),this.namespace=e.namespace,this.events=cH("events"),this.client=cH("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(oQ.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=cD(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ck(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new i$.F(new oV.A(r,cH("disableProviderPing")))}}var lt=Object.defineProperty,lr=(e,t,r)=>((e,t,r)=>t in e?lt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class li{constructor(e){lr(this,"name","algorand"),lr(this,"client"),lr(this,"httpProviders"),lr(this,"events"),lr(this,"namespace"),lr(this,"chainId"),this.namespace=e.namespace,this.events=cH("events"),this.client=cH("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){let r=t||ck(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.chainId=e,this.events.emit(oQ.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ck(e,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new i$.F(new oV.A(r,cH("disableProviderPing")))}}var ln=Object.defineProperty,ls=(e,t,r)=>((e,t,r)=>t in e?ln(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class lo{constructor(e){ls(this,"name","cip34"),ls(this,"client"),ls(this,"httpProviders"),ls(this,"events"),ls(this,"namespace"),ls(this,"chainId"),this.namespace=e.namespace,this.events=cH("events"),this.client=cH("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(oQ.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{let r=this.getCardanoRPCUrl(t),i=cD(t);e[i]=this.createHttpProvider(i,r)}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){let t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||this.getCardanoRPCUrl(e);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new i$.F(new oV.A(r,cH("disableProviderPing")))}}var la=Object.defineProperty,lc=(e,t,r)=>((e,t,r)=>t in e?la(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class ll{constructor(e){lc(this,"name","elrond"),lc(this,"client"),lc(this,"httpProviders"),lc(this,"events"),lc(this,"namespace"),lc(this,"chainId"),this.namespace=e.namespace,this.events=cH("events"),this.client=cH("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(oQ.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=cD(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ck(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new i$.F(new oV.A(r,cH("disableProviderPing")))}}var lh=Object.defineProperty,lu=(e,t,r)=>((e,t,r)=>t in e?lh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class ld{constructor(e){lu(this,"name","multiversx"),lu(this,"client"),lu(this,"httpProviders"),lu(this,"events"),lu(this,"namespace"),lu(this,"chainId"),this.namespace=e.namespace,this.events=cH("events"),this.client=cH("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(oQ.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=cD(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ck(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new i$.F(new oV.A(r,cH("disableProviderPing")))}}var lf=Object.defineProperty,lp=(e,t,r)=>((e,t,r)=>t in e?lf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class lg{constructor(e){lp(this,"name","near"),lp(this,"client"),lp(this,"httpProviders"),lp(this,"events"),lp(this,"namespace"),lp(this,"chainId"),this.namespace=e.namespace,this.events=cH("events"),this.client=cH("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){let r=t||ck(`${this.name}:${e}`,this.namespace);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(oQ.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ck(e,this.namespace);return typeof r>"u"?void 0:new i$.F(new oV.A(r,cH("disableProviderPing")))}}var lm=Object.defineProperty,ly=(e,t,r)=>((e,t,r)=>t in e?lm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class lb{constructor(e){ly(this,"name","tezos"),ly(this,"client"),ly(this,"httpProviders"),ly(this,"events"),ly(this,"namespace"),ly(this,"chainId"),this.namespace=e.namespace,this.events=cH("events"),this.client=cH("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){let r=t||ck(`${this.name}:${e}`,this.namespace);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(oQ.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{e[t]=this.createHttpProvider(t)}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ck(e,this.namespace);return typeof r>"u"?void 0:new i$.F(new oV.A(r))}}var lw=Object.defineProperty,lv=(e,t,r)=>((e,t,r)=>t in e?lw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class lx{constructor(e){lv(this,"name",oJ),lv(this,"client"),lv(this,"httpProviders"),lv(this,"events"),lv(this,"namespace"),lv(this,"chainId"),this.namespace=e.namespace,this.events=cH("events"),this.client=cH("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains|
508|[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(oQ.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){var e,t;let r={};return null==(t=null==(e=this.namespace)?void 0:e.accounts)||t.forEach(e=>{let t=eq(e);r[`${t.namespace}:${t.reference}`]=this.createHttpProvider(e)}),r}getHttpProvider(e){let t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ck(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new i$.F(new oV.A(r,cH("disableProviderPing")))}}var lE=Object.defineProperty,l_=Object.defineProperties,lI=Object.getOwnPropertyDescriptors,lA=Object.getOwnPropertySymbols,lS=Object.prototype.hasOwnProperty,lC=Object.prototype.propertyIsEnumerable,lN=(e,t,r)=>t in e?lE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lO=(e,t)=>{for(var r in t||(t={}))lS.call(t,r)&&lN(e,r,t[r]);if(lA)for(var r of lA(t))lC.call(t,r)&&lN(e,r,t[r]);return e},lP=(e,t)=>l_(e,lI(t)),lT=(e,t,r)=>lN(e,"symbol"!=typeof t?t+"":t,r);class lM{constructor(e){lT(this,"client"),lT(this,"namespaces"),lT(this,"optionalNamespaces"),lT(this,"sessionProperties"),lT(this,"events",new(m())),lT(this,"rpcProviders",{}),lT(this,"session"),lT(this,"providerOpts"),lT(this,"logger"),lT(this,"uri"),lT(this,"disableProviderPing",!1),this.providerOpts=e,this.logger="u">typeof e?.logger&&"string"!=typeof e?.logger?e.logger:(0,w.h6)((0,w.iP)({level:e?.logger||oK})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){let t=new lM(e);return await t.initialize(),t}async request(e,t,r){let[i,n]=this.validateChain(t);if(!this.session)throw Error("Please call connect() before request()");return await this.getProvider(i).request({request:lO({},e),chainId:`${i}:${n}`,topic:this.session.topic,expiry:r})}sendAsync(e,t,r,i){let n=new Date().getTime();this.request(e,r,i).then(e=>t(null,(0,iz.formatJsonRpcResult)(n,e))).catch(e=>t(e,void 0))}async enable(){if(!this.client)throw Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(e=this.session)?void 0:e.topic,reason:ix("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();let{uri:r,response:i}=await this.client.authenticate(e,t);r&&(this.uri=r,this.events.emit("display_uri",r));let n=await i();if(this.session=n.session,this.session){let e=c$(this.session.namespaces);this.namespaces=cU(this.namespaces,e),this.persist("namespaces",this.namespaces),this.onConnect()}return n}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){let{uri:t,approval:r}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});t&&(this.uri=t,this.events.emit("display_uri",t));let i=await r();this.session=i;let n=c$(i.namespaces);return this.namespaces=cU(this.namespaces,n),this.persist("namespaces",this.namespaces),this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;let[r,i]=this.validateChain(e),n=this.getProvider(r);n.name===oJ?n.setDefaultChain(`${r}:${i}`,t):n.setDefaultChain(i,t)}catch(e){if(!/Please call connect/.test(e.message))throw e}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");let t=this.client.pairing.getAll();if(iE(t)){for(let r of t)e.deletePairings?this.client.core.expirer.set(r.topic,0):await this.client.core.relayer.subscriber.unsubscribe(r.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){let e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await oW.init({core:this.providerOpts.core,logger:this.providerOpts.logger||oK,relayUrl:this.providerOpts.relayUrl||"wss://relay.walletconnect.org",projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw Error("Sign Client not initialized");if(!this.session)throw Error("Session not initialized. Please call connect() before enable()");let e=[...new Set(Object.keys(this.session.namespaces).map(e=>im(e)))];cF("client",this.client),cF("events",this.events),cF("disableProviderPing",this.disableProviderPing),e.forEach(e
508=>{if(!this.session)return;let t=function(e,t){let r=Object.keys(t.namespaces).filter(t=>t.includes(e));if(!r.length)return[];let i=[];return r.forEach(e=>{let r=t.namespaces[e].accounts;i.push(...r)}),i}(e,this.session),r=cL(t),i=lP(lO({},cU(this.namespaces,this.optionalNamespaces)[e]),{accounts:t,chains:r});switch(e){case"eip155":this.rpcProviders[e]=new c8({namespace:i});break;case"algorand":this.rpcProviders[e]=new li({namespace:i});break;case"solana":this.rpcProviders[e]=new c4({namespace:i});break;case"cosmos":this.rpcProviders[e]=new le({namespace:i});break;case"polkadot":this.rpcProviders[e]=new cK({namespace:i});break;case"cip34":this.rpcProviders[e]=new lo({namespace:i});break;case"elrond":this.rpcProviders[e]=new ll({namespace:i});break;case"multiversx":this.rpcProviders[e]=new ld({namespace:i});break;case"near":this.rpcProviders[e]=new lg({namespace:i});break;case"tezos":this.rpcProviders[e]=new lb({namespace:i});break;default:this.rpcProviders[oJ]?this.rpcProviders[oJ].updateNamespace(i):this.rpcProviders[oJ]=new lx({namespace:i})}})}registerEventListeners(){if(typeof this.client>"u")throw Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{let{params:t}=e,{event:r}=t;if("accountsChanged"===r.name){let e=r.data;e&&iE(e)&&this.events.emit("accountsChanged",e.map(cj))}else if("chainChanged"===r.name){let e=t.chainId,r=t.event.data,i=im(e),n=cz(e)!==cz(r)?`${i}:${cz(r)}`:e;this.onChainChanged(n)}else this.events.emit(r.name,r.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var r;let{namespaces:i}=t,n=null==(r=this.client)?void 0:r.session.get(e);this.session=lP(lO({},n),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",lP(lO({},ix("USER_DISCONNECTED")),{data:e.topic}))}),this.on(oQ.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[oJ]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace(null==(t=this.session)?void 0:t.namespaces[e])})}setNamespaces(e){let{namespaces:t,optionalNamespaces:r,sessionProperties:i}=e;t&&Object.keys(t).length&&(this.namespaces=t),r&&Object.keys(r).length&&(this.optionalNamespaces=r),this.sessionProperties=i,this.persist("namespaces",t),this.persist("optionalNamespaces",r)}validateChain(e){let[t,r]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,r];if(t&&!Object.keys(this.namespaces||{}).map(e=>im(e)).includes(t))throw Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&r)return[t,r];let i=im(Object.keys(this.namespaces)[0]),n=this.rpcProviders[i].getDefaultChain();return[i,n]}async requestAccounts(){let[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;let[r,i]=this.validateChain(e);i&&(t||this.getProvider(r).setDefaultChain(i),this.namespaces[r]?this.namespaces[r].defaultChain=i:this.namespaces[`${r}:${i}`]?this.namespaces[`${r}:${i}`].defaultChain=i:this.namespaces[`${r}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${oG}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${oG}/${e}`)}}var lR=r(66254),lk=r(88097),lD=r(12319),lL=r(55480),lU=r(33124),lB=r(67934);let lj={validateCaipAddress(e){if(e.split(":")?.length!==3)throw Error("Invalid CAIP Address");return e},parseCaipAddress(e){let t=e.split(":");if(3!==t.length)throw Error(`Invalid CAIP-10 address: ${e}`);let[r,i,n]=t;if(!r||!i||!n)throw Error(`Invalid CAIP-10 address: ${e}`);return{chainNamespace:r,chainId:i,address:n}},parseCaipNetworkId(e){let t=e.split(":");if(2!==t.length)throw Error(`Invalid CAIP-2 network id: ${e}`);let[r,i]=t;if(!r||!i)throw Error(`Invalid CAIP-2 network id: ${e}`);return{chainNamespace:r,chainId:i}}};var l$=r(76190),lz=r(67695),lq=r(44826),lH=r(58051),lF=r(81701),lW=r(58653),lV=r(70524),lK=r(98866);let lG={convertEVMChainIdToCoinType(e){if(e>=0x80000000)throw Error("Invalid chainId");return(0x80000000|e)>>>0}};var lY=r(67869);let lJ=(0,lV.BX)({suggestions:[],loading:!1}),lX={state:lJ,subscribe:e=>(0,lV.B1)(lJ,()=>e(lJ)),subscribeKey:(e,t)=>(0,lK.u$)(lJ,e,t),async resolveName(e){try{return await lq.T.lookupEnsName(e)}catch(e){throw Error(e?.reasons?.[0]?.description||"Error resolving name")}},async isNameRegistered(e){try{return await lq.T.lookupEnsName(e),!0}catch{return!1}},async getSuggestions(e){try{return lJ.loading=!0,lJ.suggestions=[],lJ.suggestions=(await lq.T.getEnsNameSuggestions(e)).suggestions.map(e=>({...e,name:e.name}))||[],lJ.suggestions}catch(e){throw Error(this.parseEnsApiError(e,"Error fetching name suggestions"))}finally{lJ.loading=!1}},async getNamesForAddress(e){try{if(!lz.W.state.activeCaipNetwork)return[];
508let t=lW.i.getEnsFromCacheForAddress(e);if(t)return t;let r=await lq.T.reverseLookupEnsName({address:e});return lW.i.updateEnsCache({address:e,ens:r,timestamp:Date.now()}),r}catch(e){throw Error(this.parseEnsApiError(e,"Error fetching names for address"))}},async registerName(e){let t=lz.W.state.activeCaipNetwork;if(!t)throw Error("Network not found");let r=lH.U.state.address,i=lR.a.getAuthConnector();if(!r||!i)throw Error("Address or auth connector not found");lJ.loading=!0;try{let i=JSON.stringify({name:e,attributes:{},timestamp:Math.floor(Date.now()/1e3)});lY.I.pushTransactionStack({view:"RegisterAccountNameSuccess",goBack:!1,replace:!0,onCancel(){lJ.loading=!1}});let n=await lk.x.signMessage(i),s=t.id;if(!s)throw Error("Network not found");let o=lG.convertEVMChainIdToCoinType(Number(s));await lq.T.registerEnsName({coinType:o,address:r,signature:n,message:i}),lH.U.setProfileName(e,t.chainNamespace),lY.I.replace("RegisterAccountNameSuccess")}catch(r){let t=this.parseEnsApiError(r,`Error registering name ${e}`);throw lY.I.replace("RegisterAccountName"),Error(t)}finally{lJ.loading=!1}},validateName:e=>/^[a-zA-Z0-9-]{4,}$/u.test(e),parseEnsApiError:(e,t)=>e?.reasons?.[0]?.description||t};var lQ=r(14744),lZ=r(6578),l0=r(70417),l1=r(45069),l2=r(52502),l3=r(65374);r(48981),r(91867);var l8=r(18635),l5=r(94545);let l6={UniversalProviderErrors:{UNAUTHORIZED_DOMAIN_NOT_ALLOWED:{message:"Unauthorized: origin not allowed",alertErrorKey:"INVALID_APP_CONFIGURATION"},JWT_VALIDATION_ERROR:{message:"JWT validation error: JWT Token is not yet valid",alertErrorKey:"JWT_TOKEN_NOT_VALID"},INVALID_KEY:{message:"Unauthorized: invalid key",alertErrorKey:"INVALID_PROJECT_ID"}},ALERT_ERRORS:{SWITCH_NETWORK_NOT_FOUND:{shortMessage:"Network Not Found",longMessage:"Network not found - please make sure it is included in 'networks' array in createAppKit function"},INVALID_APP_CONFIGURATION:{shortMessage:"Invalid App Configuration",longMessage:()=>`Origin ${"undefined"!=typeof window?window.origin:"unknown"} not found on Allowlist - update configuration on cloud.reown.com`},SOCIALS_TIMEOUT:{shortMessage:"Invalid App Configuration",longMessage:()=>"There was an issue loading the embedded wallet. Please verify that your domain is allowed at cloud.reown.com"},JWT_TOKEN_NOT_VALID:{shortMessage:"Session Expired",longMessage:"Invalid session found on UniversalProvider - please check your time settings and connect again"},INVALID_PROJECT_ID:{shortMessage:"Invalid App Configuration",longMessage:"Invalid Project ID - update configuration"},PROJECT_ID_NOT_CONFIGURED:{shortMessage:"Project ID Not Configured",longMessage:"Project ID Not Configured - update configuration on cloud.reown.com"}}},l4=(e,t,r)=>JSON.stringify(e,(e,r)=>{let i="bigint"==typeof r?r.toString():r;return"function"==typeof t?t(e,i):i},r),l9="2.48.4",l7={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${l9}`};class he extends Error{constructor(e,t={}){let r=t.cause instanceof he?t.cause.details:t.cause?.message?t.cause.message:t.details,i=t.cause instanceof he&&t.cause.docsPath||t.docsPath,n=l7.getDocsUrl?.({...t,docsPath:i});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: ${n}`]:[],...r?[`Details: ${r}`]:[],...l7.version?[`Version: ${l7.version}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=i,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=l9}walk(e){return function e(t,r){return r?.(t)?t:t&&"object"==typeof t&&"cause"in t&&void 0!==t.cause?e(t.cause,r):r?null:t}(this,e)}}class ht extends he{constructor({body:e,cause:t,details:r,headers:i,status:n,url:s}){super("HTTP request failed.",{cause:t,details:r,metaMessages:[n&&`Status: ${n}`,`URL: ${s}`,e&&`Request body: ${l4(e)}
508`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=n,this.url=s}}class hr extends he{constructor({body:e,error:t,url:r}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${r}`,`Request body: ${l4(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code,this.data=t.data,this.url=r}}class hi extends he{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${t}`,`Request body: ${l4(e)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=t}}class hn extends he{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}let hs=new Map,ho={current:0,take(){return this.current++},reset(){this.current=0}};class ha extends he{constructor(e,{code:t,docsPath:r,metaMessages:i,name:n,shortMessage:s}){super(s,{cause:e,docsPath:r,metaMessages:i||e?.metaMessages,name:n||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=n||e.name,this.code=e instanceof hr?e.code:t??-1}}class hc extends ha{constructor(e,t){super(e,t),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}}class hl extends ha{constructor(e){super(e,{code:hl.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(hl,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class hh extends ha{constructor(e){super(e,{code:hh.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(hh,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class hu extends ha{constructor(e,{method:t}={}){super(e,{code:hu.code,name:"MethodNotFoundRpcError",shortMessage:`The method${t?` "${t}"`:""} does not exist / is not available.`})}}Object.defineProperty(hu,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class hd extends ha{constructor(e){super(e,{code:hd.code,name:"InvalidParamsRpcError",shortMessage:"Invalid parameters were provided to the RPC method.\nDouble check you have provided the correct parameters."})}}Object.defineProperty(hd,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class hf extends ha{constructor(e){super(e,{code:hf.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(hf,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class hp extends ha{constructor(e){super(e,{code:hp.code,name:"InvalidInputRpcError",shortMessage:"Missing or invalid parameters.\nDouble check you have provided the correct parameters."})}}Object.defineProperty(hp,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class hg extends ha{constructor(e){super(e,{code:hg.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(hg,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class hm extends ha{constructor(e){super(e,{code:hm.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(hm,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class hy extends ha{constructor(e){super(e,{code:hy.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(hy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class hb extends ha{constructor(e,{method:t}={}){super(e,{code:hb.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${t?` "${t}"`:""} is not supported.`})}}Object.defineProperty(hb,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class hw extends ha{constructor(e){super(e,{code:hw.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(hw,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class hv extends ha{constructor(e){super(e,{code:hv.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(hv,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class hx extends hc{constructor(e){super(e,{code:hx.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(hx,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class hE extends hc{constructor(e){super(e,{code:hE.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(hE,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class h_ extends hc{constructor(e,{method:t}={}){super(e,{code:h_.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${t?` " ${t}"`:""}.`})}}Object.defineProperty(h_,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class hI extends hc{constructor(e){super(e,{code:hI.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(hI,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class hA extends hc{constructor(e){super(e,{code:hA.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(hA,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class hS extends hc{constructor(e){super(e,{code:hS.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(hS,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class hC extends hc{constructor(e){super(e,{code:hC.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(hC,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class hN extends hc{constructor(e){super(e,{code:hN.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(hN,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class hO extends hc{constructor(e){super(e,{code:hO.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(hO,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class hP extends hc{constructor(e){super(e,{code:hP.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(hP,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class hT extends hc{constructor(e){super(e,{code:hT.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(hT,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class hM extends hc{constructor(e){super(e,{code:hM.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(hM,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750}
508);class hR extends hc{constructor(e){super(e,{code:hR.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(hR,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class hk extends hc{constructor(e){super(e,{code:hk.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}}Object.defineProperty(hk,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});class hD extends ha{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}class hL extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;void 0!==e&&super.delete(e)}return this}}let hU=new hL(8192);async function hB(e){return new Promise(t=>setTimeout(t,e))}let hj=256;function h$({key:e,methods:t,name:r,request:n,retryCount:s=3,retryDelay:o=150,timeout:a,type:c},l){return{config:{key:e,methods:t,name:r,request:n,retryCount:s,retryDelay:o,timeout:a,type:c},request:function(e,t={}){return async(r,i={})=>{let{dedupe:n=!1,methods:s,retryDelay:o=150,retryCount:a=3,uid:c}={...t,...i},{method:l}=r;if(s?.exclude?.includes(l)||s?.include&&!s.include.includes(l))throw new hb(Error("method not supported"),{method:l});let h=n?function(e,t=0){let r=0xdeadbeef^t,i=0x41c6ce57^t;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);r=Math.imul(r^n,0x9e3779b1),i=Math.imul(i^n,0x5f356495)}return r=Math.imul(r^r>>>16,0x85ebca6b)^Math.imul(i^i>>>16,0xc2b2ae35),(0x100000000*(2097151&(i=Math.imul(i^i>>>16,0x85ebca6b)^Math.imul(r^r>>>16,0xc2b2ae35)))+(r>>>0)).toString(36)}(`${c}.${l4(r)}`):void 0;return function(e,{enabled:t=!0,id:r}){if(!t||!r)return e();if(hU.get(r))return hU.get(r);let i=e().finally(()=>hU.delete(r));return hU.set(r,i),i}(()=>(function(e,{delay:t=100,retryCount:r=2,shouldRetry:i=()=>!0}={}){return new Promise((n,s)=>{let o=async({count:a=0}={})=>{let c=async({error:e})=>{let r="function"==typeof t?t({count:a,error:e}):t;r&&await hB(r),o({count:a+1})};try{let t=await e();n(t)}catch(e){if(a<r&&await i({count:a,error:e}))return c({error:e});s(e)}};o()})})(async()=>{try{return await e(r)}catch(e){switch(e.code){case hl.code:throw new hl(e);case hh.code:throw new hh(e);case hu.code:throw new hu(e,{method:r.method});case hd.code:throw new hd(e);case hf.code:throw new hf(e);case hp.code:throw new hp(e);case hg.code:throw new hg(e);case hm.code:throw new hm(e);case hy.code:throw new hy(e);case hb.code:throw new hb(e,{method:r.method});case hw.code:throw new hw(e);case hv.code:throw new hv(e);case hx.code:throw new hx(e);case hE.code:throw new hE(e);case h_.code:throw new h_(e);case hI.code:throw new hI(e);case hA.code:throw new hA(e);case hS.code:throw new hS(e);case hC.code:throw new hC(e);case hN.code:throw new hN(e);case hO.code:throw new hO(e);case hP.code:throw new hP(e);case hT.code:throw new hT(e);case hM.code:throw new hM(e);case hR.code:throw new hR(e);case 5e3:throw new hx(e);case hk.code:throw new hk(e);default:if(e instanceof he)throw e;throw new hD(e)}}},{delay:({count:e,error:t})=>{if(t&&t instanceof ht){let e=t?.headers?.get("Retry-After");if(e?.match(/\d/))return 1e3*Number.parseInt(e,10)}return~~(1<<e)*o},retryCount:a,shouldRetry:({error:e})=>{var t;return"code"in(t=e)&&"number"==typeof t.code?-1===t.code||t.code===hw.code||t.code===hf.code||429===t.code:!(t instanceof ht)||!t.status||403===t.status||408===t.status||413===t.status||429===t.status||500===t.status||502===t.status||503===t.status||504===t.status||!1}}),{enabled:n,id:h})}}(n,{methods:t,retryCount:s,retryDelay:o,uid:function(e=11){if(!i||hj+e>512){i="",hj=0;for(let e=0;e<256;e++)i+=(256+256*Math.random()|0).toString(16).substring(1)}return i.substring(hj,hj+++e)}()}),value:l}}function hz(e,t={}){let{batch:r,fetchFn:i,fetchOptions:n,key:s="http",methods:o,name:a="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:l,retryDelay:h,raw:u}=t;return({chain:d,retryCount:f,timeout:p})=>{let{batchSize:g=1e3,wait:m=0}="object"==typeof r?r:{},y=t.retryCount??f,b=p??t.timeout??1e4,w=e||d?.rpcUrls.default.http[0];if(!w)throw new hn;let v=function(e,t={}){let{url:r,headers:i}=function(e){try{let t=new URL(e),r=(()=>
508{if(t.username){let e=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(e)}`}}}})();return{url:t.toString(),...r}}catch{return{url:e}}}(e);return{async request(e){let{body:n,fetchFn:s=t.fetchFn??fetch,onRequest:o=t.onRequest,onResponse:a=t.onResponse,timeout:c=t.timeout??1e4}=e,l={...t.fetchOptions??{},...e.fetchOptions??{}},{headers:h,method:u,signal:d}=l;try{let e,t=await function(e,{errorInstance:t=Error("timed out"),timeout:r,signal:i}){return new Promise((n,s)=>{(async()=>{let o;try{let a=new AbortController;r>0&&(o=setTimeout(()=>{i?a.abort():s(t)},r)),n(await e({signal:a?.signal||null}))}catch(e){e?.name==="AbortError"&&s(t),s(e)}finally{clearTimeout(o)}})()})}(async({signal:e})=>{let t={...l,body:Array.isArray(n)?l4(n.map(e=>({jsonrpc:"2.0",id:e.id??ho.take(),...e}))):l4({jsonrpc:"2.0",id:n.id??ho.take(),...n}),headers:{...i,"Content-Type":"application/json",...h},method:u||"POST",signal:d||(c>0?e:null)},a=new Request(r,t),f=await o?.(a,t)??{...t,url:r};return await s(f.url??r,f)},{errorInstance:new hi({body:n,url:r}),timeout:c,signal:!0});if(a&&await a(t),t.headers.get("Content-Type")?.startsWith("application/json"))e=await t.json();else{e=await t.text();try{e=JSON.parse(e||"{}")}catch(r){if(t.ok)throw r;e={error:e}}}if(!t.ok){if("number"==typeof e.error?.code&&"string"==typeof e.error?.message)return e;throw new ht({body:n,details:l4(e.error)||t.statusText,headers:t.headers,status:t.status,url:r})}return e}catch(e){if(e instanceof ht||e instanceof hi)throw e;throw new ht({body:n,cause:e,url:r})}}}}(w,{fetchFn:i,fetchOptions:n,onRequest:c,onResponse:l,timeout:b});return h$({key:s,methods:o,name:a,async request({method:e,params:t}){let i={method:e,params:t},{schedule:n}=function({fn:e,id:t,shouldSplitBatch:r,wait:i=0,sort:n}){let s=async()=>{let t=a();o();let r=t.map(({args:e})=>e);0!==r.length&&e(r).then(e=>{n&&Array.isArray(e)&&e.sort(n);for(let r=0;r<t.length;r++){let{resolve:i}=t[r];i?.([e[r],e])}}).catch(e=>{for(let r=0;r<t.length;r++){let{reject:i}=t[r];i?.(e)}})},o=()=>hs.delete(t),a=()=>hs.get(t)||[],c=e=>hs.set(t,[...a(),e]);return{flush:o,async schedule(e){let t,n,{promise:o,resolve:l,reject:h}=(t=()=>void 0,n=()=>void 0,{promise:new Promise((e,r)=>{t=e,n=r}),resolve:t,reject:n});return(r?.([...a().map(({args:e})=>e),e])&&s(),a().length>0)?c({args:e,resolve:l,reject:h}):(c({args:e,resolve:l,reject:h}),setTimeout(s,i)),o}}}({id:w,wait:m,shouldSplitBatch:e=>e.length>g,fn:e=>v.request({body:e}),sort:(e,t)=>e.id-t.id}),s=async e=>r?n(e):[await v.request({body:e})],[{error:o,result:a}]=await s(i);if(u)return{error:o,result:a};if(o)throw new hr({body:i,error:o,url:w});return a},retryCount:y,retryDelay:h,timeout:b,type:"http"},{fetchOptions:n,url:w})}}let hq={ether:-9,wei:9};var hH=r(30598);function hF(e,t="wei"){return(0,hH.J)(e,hq[t])}class hW extends he{constructor({cause:e,message:t}={}){let r=t?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(hW,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(hW,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class hV extends he{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${hF(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(hV,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class hK extends he{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${hF(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(hK,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class hG extends he{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(hG,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class hY extends he{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.
509Try increasing the nonce or find the latest nonce with \`getTransactionCount\`.`,{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(hY,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class hJ extends he{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(hJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class hX extends he{constructor({cause:e}={}){super("The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account.",{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(hX,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class hQ extends he{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(hQ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class hZ extends he{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(hZ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class h0 extends he{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(h0,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class h1 extends he{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:r}={}){super(`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${hF(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${hF(r)} gwei`:""}).`,{cause:e,name:"TipAboveFeeCapError"})}}function h2(e,t={}){let{key:r="fallback",name:i="Fallback",rank:n=!1,shouldThrow:s=h3,retryCount:o,retryDelay:a}=t;return({chain:t,pollingInterval:c=4e3,timeout:l,...h})=>{let u=e,d=()=>{},f=h$({key:r,name:i,async request({method:e,params:r}){let i,n=async(o=0)=>{let a=u[o]({...h,chain:t,retryCount:0,timeout:l});try{let t=await a.request({method:e,params:r});return d({method:e,params:r,response:t,transport:a,status:"success"}),t}catch(c){if(d({error:c,method:e,params:r,transport:a,status:"error"}),s(c)||o===u.length-1||!(i??=u.slice(o+1).some(r=>{let{include:i,exclude:n}=r({chain:t}).config.methods||{};return i?i.includes(e):!n||!n.includes(e)})))throw c;return n(o+1)}};return n()},retryCount:o,retryDelay:a,type:"fallback"},{onResponse:e=>d=e,transports:u.map(e=>e({chain:t,retryCount:0}))});if(n){let e="object"==typeof n?n:{};!function({chain:e,interval:t=4e3,onTransports:r,ping:i,sampleCount:n=10,timeout:s=1e3,transports:o,weights:a={}}){let{stability:c=.7,latency:l=.3}=a,h=[],u=async()=>{let a=await Promise.all(o.map(async t=>{let r,n,o=t({chain:e,retryCount:0,timeout:s}),a=Date.now();try{await (i?i({transport:o}):o.request({method:"net_listening"})),n=1}catch{n=0}finally{r=Date.now()}return{latency:r-a,success:n}}));h.push(a),h.length>n&&h.shift();let d=Math.max(...h.map(e=>Math.max(...e.map(({latency:e})=>e))));r(o.map((e,t)=>{let r=h.map(e=>e[t].latency),i=r.reduce((e,t)=>e+t,0)/r.length,n=h.map(e=>e[t].success),s=n.reduce((e,t)=>e+t,0)/n.length;return 0===s?[0,t]:[l*(1-i/d)+c*s,t]}).sort((e,t)=>t[0]-e[0]).map(([,e])=>
509o[e])),await hB(t),u()};u()}({chain:t,interval:e.interval??c,onTransports:e=>u=e,ping:e.ping,sampleCount:e.sampleCount,timeout:e.timeout,transports:u,weights:e.weights})}return f}}function h3(e){return!!("code"in e&&"number"==typeof e.code&&(e.code===hy.code||e.code===hx.code||e.code===hk.code||hW.nodeMessage.test(e.message)||5e3===e.code))}Object.defineProperty(h1,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});var h8=r(8567);let h5={ConnectorExplorerIds:{[lB.o.CONNECTOR_ID.COINBASE]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[lB.o.CONNECTOR_ID.COINBASE_SDK]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[lB.o.CONNECTOR_ID.SAFE]:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",[lB.o.CONNECTOR_ID.LEDGER]:"19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927",[lB.o.CONNECTOR_ID.OKX]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[h8.o.METMASK_CONNECTOR_NAME]:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",[h8.o.TRUST_CONNECTOR_NAME]:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",[h8.o.SOLFLARE_CONNECTOR_NAME]:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",[h8.o.PHANTOM_CONNECTOR_NAME]:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",[h8.o.COIN98_CONNECTOR_NAME]:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",[h8.o.MAGIC_EDEN_CONNECTOR_NAME]:"8b830a2b724a9c3fbab63af6f55ed29c9dfa8a55e732dc88c80a196a2ba136c6",[h8.o.BACKPACK_CONNECTOR_NAME]:"2bd8c14e035c2d48f184aaa168559e86b0e3433228d3c4075900a221785019b0",[h8.o.BITGET_CONNECTOR_NAME]:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",[h8.o.FRONTIER_CONNECTOR_NAME]:"85db431492aa2e8672e93f4ea7acf10c88b97b867b0d373107af63dc4880f041",[h8.o.XVERSE_CONNECTOR_NAME]:"2a87d74ae02e10bdd1f51f7ce6c4e1cc53cd5f2c0b6b5ad0d7b3007d2b13de7b",[h8.o.LEATHER_CONNECTOR_NAME]:"483afe1df1df63daf313109971ff3ef8356ddf1cc4e45877d205eee0b7893a13"},NetworkImageIds:{1:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",42161:"3bff954d-5cb0-47a0-9a23-d20192e74600",43114:"30c46e53-e989-45fb-4549-be3bd4eb3b00",56:"93564157-2e8e-4ce7-81df-b264dbee9b00",250:"06b26297-fe0c-4733-5d6b-ffa5498aac00",10:"ab9c186a-c52f-464b-2906-ca59d760a400",137:"41d04d42-da3b-4453-8506-668cc0727900",5e3:"e86fae9b-b770-4eea-e520-150e12c81100",295:"6a97d510-cac8-4e58-c7ce-e8681b044c00",0xaa36a7:"e909ea0a-f92a-4512-c8fc-748044ea6800",84532:"a18a7ecd-e307-4360-4746-283182228e00",1301:"4eeea7ef-0014-4649-5d1d-07271a80f600",130:"2257980a-3463-48c6-cbac-a42d2a956e00",10143:"0a728e83-bacb-46db-7844-948f05434900",100:"02b53f6a-e3d4-479e-1cb4-21178987d100",9001:"f926ff41-260d-4028-635e-91913fc28e00",324:"b310f07f-4ef7-49f3-7073-2a0a39685800",314:"5a73b3dd-af74-424e-cae0-0de859ee9400",4689:"34e68754-e536-40da-c153-6ef2e7188a00",1088:"3897a66d-40b9-4833-162f-a2c90531c900",1284:"161038da-44ae-4ec7-1208-0ea569454b00",1285:"f1d73bb6-5450-4e18-38f7-fb6484264a00",7777777:"845c60df-d429-4991-e687-91ae45791600",42220:"ab781bbc-ccc6-418d-d32d-789b15da1f00",8453:"7289c336-3981-4081-c5f4-efc26ac64a00",0x4e454152:"3ff73439-a619-4894-9262-4470c773a100",2020:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",2021:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",80094:"e329c2c9-59b0-4a02-83e4-212ff3779900","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":"a1b58899-f671-4276-6a5e-56ca5bd59700","4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":"a1b58899-f671-4276-6a5e-56ca5bd59700",EtWTRABZaYq6iMfeYKouRu166VU2xqa1:"a1b58899-f671-4276-6a5e-56ca5bd59700","000000000019d6689c085ae165831e93":"0b4838db-0161-4ffe-022d-532bf03dba00","000000000933ea01ad0ee984209779ba":"39354064-d79b-420b-065d-f980c4b78200"},ConnectorImageIds:{[lB.o.CONNECTOR_ID.COINBASE]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[lB.o.CONNECTOR_ID.COINBASE_SDK]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[lB.o.CONNECTOR_ID.SAFE]:"461db637-8616-43ce-035a-d89b8a1d5800",[lB.o.CONNECTOR_ID.LEDGER]:"54a1aa77-d202-4f8d-0fb2-5d2bb6db0300",[lB.o.CONNECTOR_ID.WALLET_CONNECT]:"ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",[lB.o.CONNECTOR_ID.INJECTED]:"07ba87ed-43aa-4adf-454
5090-9e6a2b9cae00"},ConnectorNamesMap:{[lB.o.CONNECTOR_ID.INJECTED]:"Browser Wallet",[lB.o.CONNECTOR_ID.WALLET_CONNECT]:"WalletConnect",[lB.o.CONNECTOR_ID.COINBASE]:"Coinbase",[lB.o.CONNECTOR_ID.COINBASE_SDK]:"Coinbase",[lB.o.CONNECTOR_ID.LEDGER]:"Ledger",[lB.o.CONNECTOR_ID.SAFE]:"Safe"},ConnectorTypesMap:{[lB.o.CONNECTOR_ID.INJECTED]:"INJECTED",[lB.o.CONNECTOR_ID.WALLET_CONNECT]:"WALLET_CONNECT",[lB.o.CONNECTOR_ID.EIP6963]:"ANNOUNCED",[lB.o.CONNECTOR_ID.AUTH]:"AUTH"},WalletConnectRpcChainIds:[1,5,0xaa36a7,10,420,42161,421613,137,80001,42220,0x4e454152,0x4e454153,56,97,43114,43113,100,8453,84531,7777777,999,324,280]},h6=["near:mainnet","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","eip155:1101","eip155:56","eip155:42161","eip155:7777777","eip155:59144","eip155:324","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1","eip155:5000","solana:4sgjmw1sunhzsxgspuhpqldx6wiyjntz","eip155:80084","eip155:5003","eip155:100","eip155:8453","eip155:42220","eip155:1313161555","eip155:17000","eip155:1","eip155:300","eip155:1313161554","eip155:1329","eip155:84532","eip155:421614","eip155:11155111","eip155:8217","eip155:43114","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","eip155:999999999","eip155:11155420","eip155:80002","eip155:97","eip155:43113","eip155:137","eip155:10","eip155:1301","bip122:000000000019d6689c085ae165831e93","bip122:000000000933ea01ad0ee984209779ba"],h4={extendRpcUrlWithProjectId(e,t){let r=!1;try{r="rpc.walletconnect.org"===new URL(e).host}catch(e){r=!1}if(r){let r=new URL(e);return r.searchParams.has("projectId")||r.searchParams.set("projectId",t),r.toString()}return e},isCaipNetwork:e=>"chainNamespace"in e&&"caipNetworkId"in e,getChainNamespace(e){return this.isCaipNetwork(e)?e.chainNamespace:lB.o.CHAIN.EVM},getCaipNetworkId(e){return this.isCaipNetwork(e)?e.caipNetworkId:`${lB.o.CHAIN.EVM}:${e.id}`},getDefaultRpcUrl(e,t,r){let i=e.rpcUrls?.default?.http?.[0];if(h6.includes(t)){let e=new URL("https://rpc.walletconnect.org/v1/");return e.searchParams.set("chainId",t),e.searchParams.set("projectId",r),e.toString()}return i||""},extendCaipNetwork(e,{customNetworkImageUrls:t,projectId:r,customRpcUrls:i}){let n=this.getChainNamespace(e),s=this.getCaipNetworkId(e),o=e.rpcUrls.default.http?.[0],a=this.getDefaultRpcUrl(e,s,r),c=e?.rpcUrls?.chainDefault?.http?.[0]||o,l=i?.[s]?.map(e=>e.url)||[],h=[...l,a],u=[...l];return c&&!u.includes(c)&&u.push(c),{...e,chainNamespace:n,caipNetworkId:s,assets:{imageId:h5.NetworkImageIds[e.id],imageUrl:t?.[e.id]},rpcUrls:{...e.rpcUrls,default:{http:h},chainDefault:{http:u}}}},extendCaipNetworks:(e,{customNetworkImageUrls:t,projectId:r,customRpcUrls:i})=>e.map(e=>h4.extendCaipNetwork(e,{customNetworkImageUrls:t,customRpcUrls:i,projectId:r})),getViemTransport(e,t,r){let i=[];if(r?.forEach(e=>{i.push(hz(e.url,e.config))}),h6.includes(e.caipNetworkId)){let r=this.getDefaultRpcUrl(e,e.caipNetworkId,t);i.push(hz(r,{fetchOptions:{headers:{"Content-Type":"text/plain"}}}))}return h2(i)},extendWagmiTransports(e,t,r){return h6.includes(e.caipNetworkId)?h2([r,hz(this.getDefaultRpcUrl(e,e.caipNetworkId,t))]):r},getUnsupportedNetwork:e=>({id:e.split(":")[1],caipNetworkId:e,name:lB.o.UNSUPPORTED_NETWORK_NAME,chainNamespace:e.split(":")[0],nativeCurrency:{name:"",decimals:0,symbol:""},rpcUrls:{default:{http:[]}}}),getCaipNetworkFromStorage(e){let t=lW.i.getActiveCaipNetworkId(),r=lz.W.getAllRequestedCaipNetworks(),i=Array.from(lz.W.state.chains?.keys()||[]),n=t?.split(":")[0],s=!!n&&i.includes(n),o=r?.find(e=>e.caipNetworkId===t);return s&&!o&&t?this.getUnsupportedNetwork(t):o||e||r?.[0]}};var h9=r(79355);let h7={createLogger(e,t="error"){let r=(0,w.iP)({level:t}),{logger:i}=(0,w.D5)({opts:r});return i.error=(...t)=>{for(let r of t)if(r instanceof Error)return void e(r,...t);e(void 0,...t)},i}},ue={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0},ut=(0,lV.BX)({providers:{...ue},providerIds:{...ue}}),ur={state:ut,subscribeKey:(e,t)=>(0,lK.u$)(ut,e,t),subscribe:e=>(0,lV.B1)(ut,()=>{e(ut)}),subscribeProviders:e=>(0,lV.B1)(ut.providers,()=>e(ut.providers)),setProvider(e,t){t&&(ut.providers[e]=(0,lV.KR)(t))},getProvider:e=>ut.providers[e],setProviderId(e,t){t&&(ut.providerIds[e]=t)},getProviderId(e){if(e)return ut.providerIds[e]},reset(){ut.providers={...ue},ut.providerIds={...ue}},resetChain(e){ut.providers[e]=void 0,ut.providerIds[e]=void 0}};var ui=r(8444);class un extends he{constructor({max:e,min:t,signed:r,size:i,value:n}){super(`Number "${n}" is not in safe ${i?`${8*i}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class us extends he{constructor({givenSize:e,maxSize:t}
509){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}class uo extends he{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function ua(e,{dir:t,size:r=32}={}){return"string"==typeof e?function(e,{dir:t,size:r=32}={}){if(null===r)return e;let i=e.replace("0x","");if(i.length>2*r)throw new uo({size:Math.ceil(i.length/2),targetSize:r,type:"hex"});return`0x${i["right"===t?"padEnd":"padStart"](2*r,"0")}`}(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new uo({size:e.length,targetSize:r,type:"bytes"});let i=new Uint8Array(r);for(let n=0;n<r;n++){let s="right"===t;i[s?n:r-n-1]=e[s?n:e.length-n-1]}return i}(e,{dir:t,size:r})}function uc(e){return!function(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}(e,{strict:!1})?e.length:Math.ceil((e.length-2)/2)}function ul(e,{size:t}){if(uc(e)>t)throw new us({givenSize:uc(e),maxSize:t})}let uh=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function uu(e,t={}){return"number"==typeof e||"bigint"==typeof e?function(e,t={}){let r,{signed:i,size:n}=t,s=BigInt(e);n?r=i?(1n<<8n*BigInt(n)-1n)-1n:2n**(8n*BigInt(n))-1n:"number"==typeof e&&(r=BigInt(Number.MAX_SAFE_INTEGER));let o="bigint"==typeof r&&i?-r-1n:0;if(r&&s>r||s<o){let t="bigint"==typeof e?"n":"";throw new un({max:r?`${r}${t}`:void 0,min:`${o}${t}`,signed:i,size:n,value:`${e}${t}`})}let a=`0x${(i&&s<0?(1n<<BigInt(8*n))+BigInt(s):s).toString(16)}`;return n?ua(a,{size:n}):a}(e,t):"string"==typeof e?function(e,t={}){return ud(uf.encode(e),t)}(e,t):"boolean"==typeof e?function(e,t={}){let r=`0x${Number(e)}`;return"number"==typeof t.size?(ul(r,{size:t.size}),ua(r,{size:t.size})):r}(e,t):ud(e,t)}function ud(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=uh[e[t]];let i=`0x${r}`;return"number"==typeof t.size?(ul(i,{size:t.size}),ua(i,{dir:"right",size:t.size})):i}let uf=new TextEncoder;var up=r(28977),ug=r(67243);let um={ERROR_CODE_UNRECOGNIZED_CHAIN_ID:4902,ERROR_CODE_DEFAULT:5e3,ERROR_INVALID_CHAIN_ID:32603};function uy(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}let ub=uy({id:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",name:"Solana",network:"solana-mainnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!1,chainNamespace:"solana",caipNetworkId:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",deprecatedCaipNetworkId:"solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ"}),uw=uy({id:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1",name:"Solana Devnet",network:"solana-devnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!0,chainNamespace:"solana",caipNetworkId:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",deprecatedCaipNetworkId:"solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K"}),uv=uy({id:"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",name:"Solana Testnet",network:"solana-testnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!0,chainNamespace:"solana",caipNetworkId:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"});uy({id:"000000000019d6689c085ae165831e93",caipNetworkId:"bip122:000000000019d6689c085ae165831e93",chainNamespace:"bip122",name:"Bitcoin",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}}}),uy({id:"000000000933ea01ad0ee984209779ba",caipNetworkId:"bip122:000000000933ea01ad0ee984209779ba",chainNamespace:"bip122",name:"Bitcoin Testnet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},testnet:!0});let ux={solana:["solana_signMessage","solana_signTransaction","solana_requestAccounts","solana_getAccounts","solana_signAllTransactions","solana_signAndSendTransaction"],eip155:["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_showCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"],bip122:["sendTransfer","signMessage","signPsbt","getAccountAddresses"]},uE={getMethodsByChainNamespace:e=>ux[e]||[],createDefaultNamespace(e){return{methods:this.getMethodsByChainNamespace(e),events:["accountsChanged","chainChanged"],chains:[],rpcMap:{}}},applyNamespaceOverrides(e,t){if(!t)return{...e};let r={...e},i=new Set;
509if(t.methods&&Object.keys(t.methods).forEach(e=>i.add(e)),t.chains&&Object.keys(t.chains).forEach(e=>i.add(e)),t.events&&Object.keys(t.events).forEach(e=>i.add(e)),t.rpcMap&&Object.keys(t.rpcMap).forEach(e=>{let[t]=e.split(":");t&&i.add(t)}),i.forEach(e=>{r[e]||(r[e]=this.createDefaultNamespace(e))}),t.methods&&Object.entries(t.methods).forEach(([e,t])=>{r[e]&&(r[e].methods=t)}),t.chains&&Object.entries(t.chains).forEach(([e,t])=>{r[e]&&(r[e].chains=t)}),t.events&&Object.entries(t.events).forEach(([e,t])=>{r[e]&&(r[e].events=t)}),t.rpcMap){let e=new Set;Object.entries(t.rpcMap).forEach(([t,i])=>{let[n,s]=t.split(":");n&&s&&r[n]&&(r[n].rpcMap||(r[n].rpcMap={}),e.has(n)||(r[n].rpcMap={},e.add(n)),r[n].rpcMap[s]=i)})}return r},createNamespaces(e,t){let r=e.reduce((e,t)=>{let{id:r,chainNamespace:i,rpcUrls:n}=t,s=n.default.http[0];e[i]||(e[i]=this.createDefaultNamespace(i));let o=`${i}:${r}`,a=e[i];switch(a.chains.push(o),o){case ub.caipNetworkId:a.chains.push(ub.deprecatedCaipNetworkId);break;case uw.caipNetworkId:a.chains.push(uw.deprecatedCaipNetworkId)}return a?.rpcMap&&s&&(a.rpcMap[r]=s),e},{});return this.applyNamespaceOverrides(r,t)},resolveReownName:async e=>{let t=await lX.resolveName(e),r=Object.values(t?.addresses)||[];return r[0]?.address||!1},getChainsFromNamespaces:(e={})=>Object.values(e).flatMap(e=>Array.from(new Set([...e.chains||[],...e.accounts.map(e=>{let[t,r]=e.split(":");return`${t}:${r}`})]))),isSessionEventData:e=>"object"==typeof e&&null!==e&&"id"in e&&"topic"in e&&"params"in e&&"object"==typeof e.params&&null!==e.params&&"chainId"in e.params&&"event"in e.params&&"object"==typeof e.params.event&&null!==e.params.event};class u_{constructor({provider:e,caipNetworks:t,namespace:r}){this.id=lB.o.CONNECTOR_ID.WALLET_CONNECT,this.name=h5.ConnectorNamesMap[lB.o.CONNECTOR_ID.WALLET_CONNECT],this.type="WALLET_CONNECT",this.imageId=h5.ConnectorImageIds[lB.o.CONNECTOR_ID.WALLET_CONNECT],this.caipNetworks=t,this.provider=e,this.chain=r}get chains(){return this.caipNetworks}async connectWalletConnect(){if(!await this.authenticate()){let e=lL.H.state.universalProviderConfigOverride,t=uE.createNamespaces(this.caipNetworks,e);await this.provider.connect({optionalNamespaces:t})}return{clientId:await this.provider.client.core.crypto.getClientId(),session:this.provider.session}}async disconnect(){await this.provider.disconnect()}async authenticate(){let e=this.chains.map(e=>e.caipNetworkId);return ug.U.universalProviderAuthenticate({universalProvider:this.provider,chains:e,methods:uI})}}let uI=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"];class uA{constructor(e){this.availableConnectors=[],this.eventListeners=new Map,e&&this.construct(e)}construct(e){this.caipNetworks=e.networks,this.projectId=e.projectId,this.namespace=e.namespace,this.adapterType=e.adapterType}get connectors(){return this.availableConnectors}get networks(){return this.caipNetworks||[]}setAuthProvider(e){this.addConnector({id:lB.o.CONNECTOR_ID.AUTH,type:"AUTH",name:lB.o.CONNECTOR_NAMES.AUTH,provider:e,imageId:h5.ConnectorImageIds[lB.o.CONNECTOR_ID.AUTH],chain:this.namespace,chains:[]})}addConnector(...e){let t=new Set;this.availableConnectors=[...e,...this.availableConnectors].filter(e=>!t.has(e.id)&&(t.add(e.id),!0)),this.emit("connectors",this.availableConnectors)}setStatus(e,t){lH.U.setStatus(e,t)}on(e,t){this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e)?.add(t)}off(e,t){let r=this.eventListeners.get(e);r&&r.delete(t)}removeAllEventListeners(){this.eventListeners.forEach(e=>{e.clear()})}emit(e,t){let r=this.eventListeners.get(e);r&&r.forEach(e=>e(t))}async connectWalletConnect(e){let t=this.getWalletConnectConnector();return{clientId:(await t.connectWalletConnect()).clientId}}async switchNetwork(e){let{caipNetwork:t,providerType:r}=e;if(!e.provider)return;let i="provider"in e.provider?e.provider.provider:e.provider;if("WALLET_CONNECT"===r)return void i.setDefaultChain(t.caipNetworkId);if(i&&"AUTH"===r){await i.switchNetwork(t.caipNetworkId);let e=await i.getUser({chainId:t.caipNetworkId,preferredAccountType:lL.H.state.defaultAccountTypes[t.chainNamespace]});
509this.emit("switchNetwork",e)}}getWalletConnectConnector(){let e=this.connectors.find(e=>e instanceof u_);if(!e)throw Error("WalletConnectConnector not found");return e}}class uS extends uA{setUniversalProvider(e){this.addConnector(new u_({provider:e,caipNetworks:this.caipNetworks||[],namespace:this.namespace}))}async connect(e){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:Number(e.chainId),provider:this.provider,address:""})}async disconnect(){try{let e=this.getWalletConnectConnector();await e.disconnect()}catch(e){console.warn("UniversalAdapter:disconnect - error",e)}}async getAccounts({namespace:e}){let t=this.provider;return Promise.resolve({accounts:(t?.session?.namespaces?.[e]?.accounts?.map(e=>{let[,,t]=e.split(":");return t}).filter((e,t,r)=>r.indexOf(e)===t)||[]).map(t=>lD.w.createAccount(e,t,"bip122"===e?"payment":"eoa"))})}async syncConnectors(){return Promise.resolve()}async getBalance(e){if(!(e.caipNetwork&&up.oU.BALANCE_SUPPORTED_CHAINS.includes(e.caipNetwork?.chainNamespace))||e.caipNetwork?.testnet)return{balance:"0.00",symbol:e.caipNetwork?.nativeCurrency.symbol||""};if(lH.U.state.balanceLoading&&e.chainId===lz.W.state.activeCaipNetwork?.id)return{balance:lH.U.state.balance||"0.00",symbol:lH.U.state.balanceSymbol||""};let t=(await lH.U.fetchTokenBalance()).find(t=>t.chainId===`${e.caipNetwork?.chainNamespace}:${e.chainId}`&&t.symbol===e.caipNetwork?.nativeCurrency.symbol);return{balance:t?.quantity.numeric||"0.00",symbol:t?.symbol||e.caipNetwork?.nativeCurrency.symbol||""}}async signMessage(e){let{provider:t,message:r,address:i}=e;if(!t)throw Error("UniversalAdapter:signMessage - provider is undefined");return{signature:lz.W.state.activeCaipNetwork?.chainNamespace===lB.o.CHAIN.SOLANA?(await t.request({method:"solana_signMessage",params:{message:ui.A.encode(ne
509w TextEncoder().encode(r)),pubkey:i}},lz.W.state.activeCaipNetwork?.caipNetworkId)).signature:await t.request({method:"personal_sign",params:[r,i]},lz.W.state.activeCaipNetwork?.caipNetworkId)}}async estimateGas(){return Promise.resolve({gas:BigInt(0)})}async getProfile(){return Promise.resolve({profileImage:"",profileName:""})}async sendTransaction(){return Promise.resolve({hash:""})}walletGetAssets(e){return Promise.resolve({})}async writeContract(){return Promise.resolve({hash:""})}async getEnsAddress(){return Promise.resolve({address:!1})}parseUnits(){return 0n}formatUnits(){return"0"}async getCapabilities(){return Promise.resolve({})}async grantPermissions(){return Promise.resolve({})}async revokePermissions(){return Promise.resolve("0x")}async syncConnection(){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:1,provider:this.provider,address:""})}async switchNetwork(e){let{caipNetwork:t}=e,r=this.getWalletConnectConnector();if(t.chainNamespace===lB.o.CHAIN.EVM)try{await r.provider?.request({method:"wallet_switchEthereumChain",params:[{chainId:uu(t.id)}]})}catch(e){if(e.code===um.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||e.code===um.ERROR_INVALID_CHAIN_ID||e.code===um.ERROR_CODE_DEFAULT||e?.data?.originalError?.code===um.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)try{await r.provider?.request({method:"wallet_addEthereumChain",params:[{chainId:uu(t.id),rpcUrls:[t?.rpcUrls.chainDefault?.http],chainName:t.name,nativeCurrency:t.nativeCurrency,blockExplorerUrls:[t.blockExplorers?.default.url]}]})}catch(e){throw Error("Chain is not supported")}}r.provider.setDefaultChain(t.caipNetworkId)}getWalletConnectProvider(){let e=this.connectors.find(e=>"WALLET_CONNECT"===e.type);return e?.provider}}class uC{constructor(e){this.hasSwitchedToPreferredAccountTypeOnConnect=!1,this.chainNamespaces=[],this.reportedAlertErrors={},this.getCaipNetwork=e=>{if(e){let t=lz.W.getNetworkData(e)?.caipNetwork;return t||lz.W.getRequestedCaipNetworks(e).filter(t=>t.chainNamespace===e)?.[0]}return lz.W.state.activeCaipNetwork||this.defaultCaipNetwork},this.getCaipNetworkId=()=>{let e=this.getCaipNetwork();if(e)return e.id},this.getCaipNetworks=e=>lz.W.getRequestedCaipNetworks(e),this.getActiveChainNamespace=()=>lz.W.state.activeChain,this.setRequestedCaipNetworks=(e,t)=>{lz.W.setRequestedCaipNetworks(e,t)},this.getApprovedCaipNetworkIds=()=>lz.W.getAllApprovedCaipNetworkIds(),this.getCaipAddress=e=>lz.W.state.activeChain!==e&&e?lz.W.getAccountProp("caipAddress",e):lz.W.state.activeCaipAddress,this.setClientId=e=>{lq.T.setClientId(e)},this.getProvider=e=>ur.getProvider(e),this.getProviderType=e=>ur.getProviderId(e),this.getPreferredAccountType=()=>lH.U.state.preferredAccountType,this.setCaipAddress=(e,t)=>{lH.U.setCaipAddress(e,t)},this.setBalance=(e,t,r)=>{lH.U.setBalance(e,t,r)},this.setProfileName=(e,t)=>{lH.U.setProfileName(e,t)},this.setProfileImage=(e,t)=>{lH.U.setProfileImage(e,t)},this.setUser=(e,t)=>{lH.U.setUser(e,t),lL.H.state.enableEmbedded&&lF.W.close()},this.resetAccount=e=>{lH.U.resetAccount(e)},this.setCaipNetwork=e=>{lz.W.setActiveCaipNetwork(e)},this.setCaipNetworkOfNamespace=(e,t)=>{lz.W.setChainNetworkData(t,{caipNetwork:e})},this.setAllAccounts=(e,t)=>{lH.U.setAllAccounts(e,t),lL.H.setHasMultipleAddresses(e?.length>1)},this.setStatus=(e,t)=>{lH.U.setStatus(e,t),lR.a.isConnected()?lW.i.setConnectionStatus("connected"):lW.i.setConnectionStatus("disconnected")},this.getAddressByChainNamespace=e=>lz.W.getAccountProp("address",e),this.setConnectors=e=>{let t=[...lR.a.getConnectors(),...e];lR.a.setConnectors(t)},this.fetchIdentity=e=>lq.T.fetchIdentity(e),this.getReownName=e=>lX.getNamesForAddress(e),this.getConnectors=()=>lR.a.getConnectors(),this.getConnectorImage=e=>lQ.$.getConnectorImage(e),this.setConnectedWalletInfo=(e,t)=>{let r=ur.getProviderId(t),i=e?{...e,type:r}:void 0;lH.U.setConnectedWalletInfo(i,t)},this.getIsConnectedState=()=>!!lz.W.state.activeCaipAddress,this.addAddressLabel=(e,t,r)=>{lH.U.addAddressLabel(e,t,r)},this.removeAddressLabel=(e,t)=>
509{lH.U.removeAddressLabel(e,t)},this.getAddress=e=>lz.W.state.activeChain!==e&&e?lz.W.getAccountProp("address",e):lH.U.state.address,this.setApprovedCaipNetworksData=e=>lz.W.setApprovedCaipNetworksData(e),this.resetNetwork=e=>{lz.W.resetNetwork(e)},this.addConnector=e=>{lR.a.addConnector(e)},this.resetWcConnection=()=>{lk.x.resetWcConnection()},this.setAddressExplorerUrl=(e,t)=>{lH.U.setAddressExplorerUrl(e,t)},this.setSmartAccountDeployed=(e,t)=>{lH.U.setSmartAccountDeployed(e,t)},this.setSmartAccountEnabledNetworks=(e,t)=>{lz.W.setSmartAccountEnabledNetworks(e,t)},this.setPreferredAccountType=(e,t)=>{lH.U.setPreferredAccountType(e,t)},this.setEIP6963Enabled=e=>{lL.H.setEIP6963Enabled(e)},this.handleUnsafeRPCRequest=()=>{this.isOpen()?this.isTransactionStackEmpty()||this.redirect("ApproveTransaction"):this.open({view:"ApproveTransaction"})},this.options=e,this.version=e.sdkVersion,this.caipNetworks=this.extendCaipNetworks(e),this.chainNamespaces=[...new Set(this.caipNetworks?.map(e=>e.chainNamespace))],this.defaultCaipNetwork=this.extendDefaultCaipNetwork(e),this.chainAdapters=this.createAdapters(e.adapters),this.initialize(e),this.sendInitializeEvent(e)}async initialize(e){this.initControllers(e),await this.initChainAdapters(),await this.injectModalUi(),await this.syncExistingConnection(),lZ.z.set({initialized:!0})}sendInitializeEvent(e){let{...t}=e;delete t.adapters,l0.E.sendEvent({type:"track",event:"INITIALIZE",properties:{...t,networks:e.networks.map(e=>e.id),siweConfig:{options:e.siweConfig?.options||{}}}})}initControllers(e){this.initializeOptionsController(e),this.initializeChainController(e),this.initializeThemeController(e),this.initializeConnectionController(e),this.initializeConnectorController()}initializeThemeController(e){e.themeMode&&l1.W.setThemeMode(e.themeMode),e.themeVariables&&l1.W.setThemeVariables(e.themeVariables)}initializeChainController(e){if(!this.connectionControllerClient||!this.networkControllerClient)throw Error("ConnectionControllerClient and NetworkControllerClient must be set");lz.W.initialize(e.adapters??[],this.caipNetworks,{connectionControllerClient:this.connectionControllerClient,networkControllerClient:this.networkControllerClient});let t=this.getDefaultNetwork();t&&lz.W.setActiveCaipNetwork(t)}initializeConnectionController(e){lk.x.setWcBasic(e.basic??!1)}initializeConnectorController(){lR.a.initialize(this.chainNamespaces)}initializeOptionsController(e){lL.H.setDebug(!1!==e.debug),lL.H.setEnableWalletConnect(!1!==e.enableWalletConnect),lL.H.setEnableWalletGuide(!1!==e.enableWalletGuide),lL.H.setEnableWallets(!1!==e.enableWallets),lL.H.setEIP6963Enabled(!1!==e.enableEIP6963),lL.H.setEnableNetworkSwitch(!1!==e.enableNetworkSwitch),lL.H.setEnableAuthLogger(!1!==e.enableAuthLogger),lL.H.setCustomRpcUrls(e.customRpcUrls),lL.H.setSdkVersion(e.sdkVersion),lL.H.setProjectId(e.projectId),lL.H.setEnableEmbedded(e.enableEmbedded),lL.H.setAllWallets(e.allWallets),lL.H.setIncludeWalletIds(e.includeWalletIds),lL.H.setExcludeWalletIds(e.excludeWalletIds),lL.H.setFeaturedWalletIds(e.featuredWalletIds),lL.H.setTokens(e.tokens),lL.H.setTermsConditionsUrl(e.termsConditionsUrl),lL.H.setPrivacyPolicyUrl(e.privacyPolicyUrl),lL.H.setCustomWallets(e.customWallets),lL.H.setFeatures(e.features),lL.H.setAllowUnsupportedChain(e.allowUnsupportedChain),lL.H.setDefaultAccountTypes(e.defaultAccountTypes),lL.H.setUniversalProviderConfigOverride(e.universalProviderConfigOverride);let t=this.getDefaultMetaData();if(!e.metadata&&t&&(e.metadata=t),lL.H.setMetadata(e.metadata),lL.H.setDisableAppend(e.disableAppend),lL.H.setEnableEmbedded(e.enableEmbedded),lL.H.setSIWX(e.siwx),!e.projectId)return void l2.h.open(l6.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error");if(e.adapters?.find(e=>e.namespace===lB.o.CHAIN.EVM)&&e.siweConfig){if(e.siwx)throw Error("Cannot set both `siweConfig` and `siwx` options");lL.H.setSIWX(e.siweConfig.mapToSIWX())}}getDefaultMetaData(){return"undefined"!=typeof window&&"undefined"!=typeof document?{name:document.getElementsByTagName("title")?.[0]?.textContent||"",description:document.querySelector('meta[property="og:description"]')?.content||"",url:window.location.origin,icons:[document.querySelector('link[rel~="icon"]')?.href||""]}:null}setUnsupportedNetwork(e){let t=this.getActiveChainNamespace();if(t){let r=h4.getUnsupportedNetwork(`${t}:${e}`);lz.W.setActiveCaipNetwork(r)}}getDefaultNetwork(){return h4.getCaipNetworkFromStorage(this.defaultCaipNetwork)}extendCaipNetwork(e,t){return h4.extendCaipNetwork(e,{customNetworkImageUrls:t.chainImages,projectId:t.projectId})}extendCaipNetworks(e){return h4.extendCaipNetworks(e.networks,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId})}extendDefaultCaipNetwork(e){let t=e.networks.find(t=>
509t.id===e.defaultNetwork?.id);return t?h4.extendCaipNetwork(t,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId}):void 0}createClients(){this.connectionControllerClient={connectWalletConnect:async()=>{let e=lz.W.state.activeChain,t=this.getAdapter(e),r=this.getCaipNetwork(e)?.id;if(!t)throw Error("Adapter not found");let i=await t.connectWalletConnect(r);this.close(),this.setClientId(i?.clientId||null),lW.i.setConnectedNamespaces([...lz.W.state.chains.keys()]),this.chainNamespaces.forEach(e=>{lR.a.setConnectorId(h8.o.CONNECTOR_TYPE_WALLET_CONNECT,e)}),await this.syncWalletConnectAccount()},connectExternal:async({id:e,info:t,type:r,provider:i,chain:n,caipNetwork:s})=>{let o=lz.W.state.activeChain,a=n||o,c=this.getAdapter(a);if(n&&n!==o&&!s){let e=this.caipNetworks?.find(e=>e.chainNamespace===n);e&&this.setCaipNetwork(e)}if(!c)throw Error("Adapter not found");let l=this.getCaipNetwork(a),h=await c.connect({id:e,info:t,type:r,provider:i,chainId:s?.id||l?.id,rpcUrl:s?.rpcUrls?.default?.http?.[0]||l?.rpcUrls?.default?.http?.[0]});if(!h)return;lW.i.addConnectedNamespace(a),this.syncProvider({...h,chainNamespace:a}),await this.syncAccount({...h,chainNamespace:a});let{accounts:u}=await c.getAccounts({namespace:a,id:e});this.setAllAccounts(u,a)},reconnectExternal:async({id:e,info:t,type:r,provider:i})=>{let n=lz.W.state.activeChain,s=this.getAdapter(n);s?.reconnect&&(await s?.reconnect({id:e,info:t,type:r,provider:i,chainId:this.getCaipNetwork()?.id}),lW.i.addConnectedNamespace(n))},disconnect:async e=>{let t=e||lz.W.state.activeChain,r=this.getAdapter(t),i=ur.getProvider(t),n=ur.getProviderId(t);await r?.disconnect({provider:i,providerType:n}),lW.i.removeConnectedNamespace(t),ur.resetChain(t),this.setUser(void 0,t),this.setStatus("disconnected",t),this.hasSwitchedToPreferredAccountTypeOnConnect=!1},checkInstalled:e=>e?e.some(e=>!!window.ethereum?.[String(e)]):!!window.ethereum,signMessage:async e=>{let t=this.getAdapter(lz.W.state.activeChain),r=await t?.signMessage({message:e,address:lH.U.state.address,provider:ur.getProvider(lz.W.state.activeChain)});return r?.signature||""},sendTransaction:async e=>{if(e.chainNamespace===lB.o.CHAIN.EVM){let t=this.getAdapter(lz.W.state.activeChain),r=ur.getProvider(lz.W.state.activeChain),i=await t?.sendTransaction({...e,caipNetwork:this.getCaipNetwork(),provider:r});return i?.hash||""}return""},estimateGas:async e=>{if(e.chainNamespace===lB.o.CHAIN.EVM){let t=this.getAdapter(lz.W.state.activeChain),r=ur.getProvider(lz.W.state.activeChain),i=this.getCaipNetwork();if(!i)throw Error("CaipNetwork is undefined");let n=await t?.estimateGas({...e,provider:r,caipNetwork:i});return n?.gas||0n}return 0n},getEnsAvatar:async()=>{let e=this.getAdapter(lz.W.state.activeChain),t=await e?.getProfile({address:lH.U.state.address,chainId:Number(this.getCaipNetwork()?.id)});return t?.profileImage||!1},getEnsAddress:async e=>{let t=this.getAdapter(lz.W.state.activeChain),r=this.getCaipNetwork();if(!r)return!1;let i=await t?.getEnsAddress({name:e,caipNetwork:r});return i?.address||!1},writeContract:async e=>{let t=this.getAdapter(lz.W.state.activeChain),r=this.getCaipNetwork(),i=this.getCaipAddress(),n=ur.getProvider(lz.W.state.activeChain);if(!r||!i)throw Error("CaipNetwork or CaipAddress is undefined");let s=await t?.writeContract({...e,caipNetwork:r,provider:n,caipAddress:i});return s?.hash},parseUnits:(e,t)=>{let r=this.getAdapter(lz.W.state.activeChain);return r?.parseUnits({value:e,decimals:t})??0n},formatUnits:(e,t)=>{let r=this.getAdapter(lz.W.state.activeChain);return r?.formatUnits({value:e,decimals:t})??"0"},getCapabilities:async e=>{let t=this.getAdapter(lz.W.state.activeChain);return await t?.getCapabilities(e)},grantPermissions:async e=>{let t=this.getAdapter(lz.W.state.activeChain);return await t?.grantPermissions(e)},revokePermissions:async e=>{let t=this.getAdapter(lz.W.state.activeChain);return t?.revokePermissions?await t.revokePermissions(e):"0x"},walletGetAssets:async e=>{let t=this.getAdapter(lz.W.state.activeChain);return await t?.walletGetAssets(e)??{}}},this.networkControllerClient={switchCaipNetwork:async e=>await this.switchCaipNetwork(e),getApprovedCaipNetworksData:async()=>this.getApprovedCaipNetworksData()},lk.x.setClient(this.connectionControllerClient)}getApprovedCaipNetworksData(){if(ur.getProviderId(lz.W.state.activeChain)===h8.o.CONNECTOR_TYPE_WALLET_CONNECT){let e=this.universalProvider?.session?.namespaces;return{supportsAllNetworks:this.universalProvider?.session?.peer?.metadata.name==="MetaMask Wallet",approvedCaipNetworkIds:this.getChainsFromNamespaces(e)}}return{supportsAllNetworks:!0,approvedCaipNetworkIds:[]}}async switchCaipNetwork(e){if(!e)return;let t=e.chainNamespace;if(this.getAddressByChainNamespace(e.chainNamespace)){let r=ur.getProvider(t),i=ur.getProviderId(t);if(e.chainNamespace===lz.W.state.activeChain){let n=this.getAdapter(t);await n?.switchNetwork({caipNetwork:e,provider:r,providerType:i})}else if(this.setCaipNetwork(e),i===h8.o.CONNECTOR_TYPE_WALLET_CONNECT)this.syncWalletConnectAccount();else{let r=this.getAddressByChainNamespace(t);r&&this.syncAccount({address:r,chainId:e.id,chainNamespace:t})}}else this.setCaipNetwork(e)}
509getChainsFromNamespaces(e={}){return Object.values(e).flatMap(e=>Array.from(new Set([...e.chains||[],...e.accounts.map(e=>{let{chainId:t,chainNamespace:r}=lj.parseCaipAddress(e);return`${r}:${t}`})])))}createAdapters(e){return this.createClients(),this.chainNamespaces.reduce((t,r)=>{let i=e?.find(e=>e.namespace===r);return i?(t[r]=i,t[r].namespace=r,t[r].construct({namespace:r,projectId:this.options?.projectId,networks:this.caipNetworks})):t[r]=new uS({namespace:r,networks:this.caipNetworks}),t},{})}async initChainAdapter(e){this.onConnectors(e),this.listenAdapter(e),this.chainAdapters?.[e].syncConnectors(this.options,this),await this.createUniversalProviderForAdapter(e)}async initChainAdapters(){await Promise.all(this.chainNamespaces.map(async e=>{await this.initChainAdapter(e)}))}onConnectors(e){let t=this.getAdapter(e);t?.on("connectors",this.setConnectors.bind(this))}listenAdapter(e){let t=this.getAdapter(e);if(!t)return;let r=lW.i.getConnectionStatus();"connected"===r?this.setStatus("connecting",e):("disconnected"===r&&lW.i.clearAddressCache(),this.setStatus(r,e)),t.on("switchNetwork",({address:t,chainId:r})=>{let i=this.caipNetworks?.find(e=>e.id===r||e.caipNetworkId===r),n=lz.W.state.activeChain===e,s=lz.W.getAccountProp("address",e);if(i){let i=n&&t?t:s;i&&this.syncAccount({address:i,chainId:r,chainNamespace:e})}else this.setUnsupportedNetwork(r)}),t.on("disconnect",this.disconnect.bind(this,e)),t.on("pendingTransactions",()=>{let e=lH.U.state.address,t=lz.W.state.activeCaipNetwork;e&&t?.id&&this.updateNativeBalance(e,t.id,t.chainNamespace)}),t.on("accountChanged",({address:t,chainId:r})=>{let i=lz.W.state.activeChain===e;i&&r?this.syncAccount({address:t,chainId:r,chainNamespace:e}):i&&lz.W.state.activeCaipNetwork?.id?this.syncAccount({address:t,chainId:lz.W.state.activeCaipNetwork?.id,chainNamespace:e}):this.syncAccountInfo(t,r,e)})}async createUniversalProviderForAdapter(e){await this.getUniversalProvider(),this.universalProvider&&this.chainAdapters?.[e]?.setUniversalProvider?.(this.universalProvider)}async syncExistingConnection(){await Promise.allSettled(this.chainNamespaces.map(e=>this.syncNamespaceConnection(e)))}async syncNamespaceConnection(e){try{let t=lR.a.getConnectorId(e);switch(this.setStatus("connecting",e),t){case lB.o.CONNECTOR_ID.WALLET_CONNECT:await this.syncWalletConnectAccount();break;case lB.o.CONNECTOR_ID.AUTH:break;default:await this.syncAdapterConnection(e)}}catch(t){console.warn("AppKit couldn't sync existing connection",t),this.setStatus("disconnected",e)}}async syncAdapterConnection(e){let t=this.getAdapter(e),r=lR.a.getConnectorId(e),i=this.getCaipNetwork(e),n=lR.a.getConnectors(e).find(e=>e.id===r);try{if(!t||!n)throw Error(`Adapter or connector not found for namespace ${e}`);if(!i?.id)throw Error("CaipNetwork not found");let r=await t?.syncConnection({namespace:e,id:n.id,chainId:i.id,rpcUrl:i?.rpcUrls?.default?.http?.[0]});if(r){let i=await t?.getAccounts({namespace:e,id:n.id});i&&i.accounts.length>0?this.setAllAccounts(i.accounts,e):this.setAllAccounts([lD.w.createAccount(e,r.address,"eoa")],e),this.syncProvider({...r,chainNamespace:e}),await this.syncAccount({...r,chainNamespace:e}),this.setStatus("connected",e)}else this.setStatus("disconnected",e)}catch(t){this.setStatus("disconnected",e)}}async syncWalletConnectAccount(){let e=this.chainNamespaces.map(async e=>{let t=this.getAdapter(e),r=this.universalProvider?.session?.namespaces?.[e]?.accounts||[],i=lz.W.state.activeCaipNetwork?.id,n=r.find(e=>{let{chainId:t}=lj.parseCaipAddress(e);return t===i?.toString()})||r[0];if(n){let r=lj.validateCaipAddress(n),{chainId:i,address:s}=lj.parseCaipAddress(r);if(ur.setProviderId(e,h8.o.CONNECTOR_TYPE_WALLET_CONNECT),this.caipNetworks&&lz.W.state.activeCaipNetwork&&t?.namespace!==lB.o.CHAIN.EVM){let r=t?.getWalletConnectProvider({caipNetworks:this.caipNetworks,provider:this.universalProvider,activeCaipNetwork:lz.W.state.activeCaipNetwork});ur.setProvider(e,r)}else ur.setProvider(e,this.universalProvider);lR.a.setConnectorId(lB.o.CONNECTOR_ID.WALLET_CONNECT,e),lW.i.addConnectedNamespace(e),this.syncWalletConnectAccounts(e),await this.syncAccount({address:s,chainId:i,chainNamespace:e})}else this.setStatus("disconnected",e);await lz.W.setApprovedCaipNetworksData(e)});await Promise.all(e)}syncWalletConnectAccounts(e){let t=this.universalProvider?.session?.namespaces?.[e]?.accounts?.map(e=>{let{address:t}=lj.parseCaipAddress(e);return t}).filter((e,t,r)=>r.indexOf(e)===t);t&&this.setAllAccounts(t.map(t=>lD.w.createAccount(e,t,"bip122"===e?"payment":"eoa")),e)}syncProvider({type:e,provider:t,id:r,chainNamespace:i}){ur.setProviderId(i,e),ur.setProvider(i,t),lR.a.setConnectorId(r,i)}async syncAccount(e){let t=e.chainNamespace===lz.W.state.activeChain,r=lz.W.getCaipNetworkByNamespace(e.chainNamespace,e.chainId),{address:i,chainId:n,chainNamespace:s}=e,{chainId:o}=lW.i.getActiveNetworkProps(),a=n||o,c=lz.W.state.activeCaipNetwork?.name===lB.o.UNSUPPORTED_NETWORK_NAME,l=lz.W.getNetworkProp("supportsAllNetworks",
509s);if(this.setStatus("connected",s),(!c||l)&&a){let e=this.caipNetworks?.find(e=>e.id.toString()===a.toString()),n=this.caipNetworks?.find(e=>e.chainNamespace===s);if(!l&&!e&&!n){let t=this.getApprovedCaipNetworkIds()||[],r=t.find(e=>lj.parseCaipNetworkId(e)?.chainId===a.toString()),i=t.find(e=>lj.parseCaipNetworkId(e)?.chainNamespace===s);e=this.caipNetworks?.find(e=>e.caipNetworkId===r),n=this.caipNetworks?.find(e=>e.caipNetworkId===i||"deprecatedCaipNetworkId"in e&&e.deprecatedCaipNetworkId===i)}let o=e||n;o?.chainNamespace===lz.W.state.activeChain?lL.H.state.enableNetworkSwitch&&!lL.H.state.allowUnsupportedChain&&lz.W.state.activeCaipNetwork?.name===lB.o.UNSUPPORTED_NETWORK_NAME?lz.W.showUnsupportedChainUI():this.setCaipNetwork(o):!t&&r&&this.setCaipNetworkOfNamespace(r,s),this.syncConnectedWalletInfo(s),h9.y.isLowerCaseMatch(i,lH.U.state.address)||this.syncAccountInfo(i,o?.id,s),t?await this.syncBalance({address:i,chainId:o?.id,chainNamespace:s}):await this.syncBalance({address:i,chainId:r?.id,chainNamespace:s})}}async syncAccountInfo(e,t,r){let i=this.getCaipAddress(r),n=t||i?.split(":")[1];if(!n)return;let s=`${r}:${n}:${e}`;this.setCaipAddress(s,r),await this.syncIdentity({address:e,chainId:n,chainNamespace:r})}async syncReownName(e,t){try{let r=await this.getReownName(e);if(r[0]){let e=r[0];this.setProfileName(e.name,t)}else this.setProfileName(null,t)}catch{this.setProfileName(null,t)}}syncConnectedWalletInfo(e){let t=lR.a.getConnectorId(e),r=ur.getProviderId(e);if(r===h8.o.CONNECTOR_TYPE_ANNOUNCED||r===h8.o.CONNECTOR_TYPE_INJECTED){if(t){let r=this.getConnectors().find(e=>e.id===t);if(r){let{info:t,name:i,imageUrl:n}=r,s=n||this.getConnectorImage(r);this.setConnectedWalletInfo({name:i,icon:s,...t},e)}}}else if(r===h8.o.CONNECTOR_TYPE_WALLET_CONNECT){let t=ur.getProvider(e);t?.session&&this.setConnectedWalletInfo({...t.session.peer.metadata,name:t.session.peer.metadata.name,icon:t.session.peer.metadata.icons?.[0]},e)}else if(t)if(t===lB.o.CONNECTOR_ID.COINBASE){let t=this.getConnectors().find(e=>e.id===lB.o.CONNECTOR_ID.COINBASE);this.setConnectedWalletInfo({name:"Coinbase Wallet",icon:this.getConnectorImage(t)},e)}else this.setConnectedWalletInfo({name:t},e)}async syncBalance(e){l$.L.getNetworksByNamespace(this.caipNetworks,e.chainNamespace).find(t=>t.id.toString()===e.chainId?.toString())&&e.chainId&&await this.updateNativeBalance(e.address,e.chainId,e.chainNamespace)}async updateNativeBalance(e,t,r){let i=this.getAdapter(r);if(i){let n=await i.getBalance({address:e,chainId:t,caipNetwork:this.getCaipNetwork(r),tokens:this.options.tokens});this.setBalance(n.balance,n.symbol,r)}}async initializeUniversalAdapter(){let e=h7.createLogger((e,...t)=>{e&&this.handleAlertError(e),console.error(...t)}),t={projectId:this.options?.projectId,metadata:{name:this.options?.metadata?this.options?.metadata.name:"",description:this.options?.metadata?this.options?.metadata.description:"",url:this.options?.metadata?this.options?.metadata.url:"",icons:this.options?.metadata?this.options?.metadata.icons:[""]},logger:e};lL.H.setManualWCControl(!!this.options?.manualWCControl),this.universalProvider=this.options.universalProvider??await lU.A.init(t),this.listenWalletConnect()}listenWalletConnect(){this.universalProvider&&(this.universalProvider.on("display_uri",e=>{lk.x.setUri(e)}),this.universalProvider.on("connect",lk.x.finalizeWcConnection),this.universalProvider.on("disconnect",()=>{this.chainNamespaces.forEach(e=>{this.resetAccount(e)}),lk.x.resetWcConnection()}),this.universalProvider.on("chainChanged",e=>{let t=this.caipNetworks?.find(t=>t.id==e),r=this.getCaipNetwork();if(!t)return void this.setUnsupportedNetwork(e);r?.id!==t?.id&&this.setCaipNetwork(t)}),this.universalProvider.on("session_event",e=>{if(uE.isSessionEventData(e)){let{name:t,data:r}=e.params.event;"accountsChanged"===t&&Array.isArray(r)&&lD.w.isCaipAddress(r[0])&&this.syncAccount(lj.parseCaipAddress(r[0]))}}))}createUniversalProvider(){return!this.universalProviderInitPromise&&lD.w.isClient()&&this.options?.projectId&&(this.universalProviderInitPromise=this.initializeUniversalAdapter()),this.universalProviderInitPromise}
509async getUniversalProvider(){if(!this.universalProvider)try{await this.createUniversalProvider()}catch(e){l0.E.sendEvent({type:"error",event:"INTERNAL_SDK_ERROR",properties:{errorType:"UniversalProviderInitError",errorMessage:e instanceof Error?e.message:"Unknown",uncaught:!1}}),console.error("AppKit:getUniversalProvider - Cannot create provider",e)}return this.universalProvider}handleAlertError(e){let[t,r]=Object.entries(l6.UniversalProviderErrors).find(([,{message:t}])=>e.message.includes(t))??[],{message:i,alertErrorKey:n}=r??{};if(t&&i&&!this.reportedAlertErrors[t]){let e=l6.ALERT_ERRORS[n];e&&(l2.h.open(e,"error"),this.reportedAlertErrors[t]=!0)}}getAdapter(e){if(e)return this.chainAdapters?.[e]}createAdapter(e){if(!e)return;let t=e.namespace;t&&(this.createClients(),e.namespace=t,e.construct({namespace:t,projectId:this.options?.projectId,networks:this.caipNetworks}),this.chainNamespaces.includes(t)||this.chainNamespaces.push(t),this.chainAdapters&&(this.chainAdapters[t]=e))}async open(e){await this.injectModalUi(),e?.uri&&lk.x.setUri(e.uri),await lF.W.open(e)}async close(){await this.injectModalUi(),lF.W.close()}setLoading(e,t){lF.W.setLoading(e,t)}async disconnect(e){await lk.x.disconnect(e)}getError(){return""}getChainId(){return lz.W.state.activeCaipNetwork?.id}async switchNetwork(e){let t=this.caipNetworks?.find(t=>t.id===e.id);if(!t)return void l2.h.open(l6.ALERT_ERRORS.SWITCH_NETWORK_NOT_FOUND,"error");await lz.W.switchActiveNetwork(t)}getWalletProvider(){return lz.W.state.activeChain?ur.state.providers[lz.W.state.activeChain]:null}getWalletProviderType(){return ur.getProviderId(lz.W.state.activeChain)}subscribeProviders(e){return ur.subscribeProviders(e)}getThemeMode(){return l1.W.state.themeMode}getThemeVariables(){return l1.W.state.themeVariables}setThemeMode(e){l1.W.setThemeMode(e),(0,l5.JX)(l1.W.state.themeMode)}setTermsConditionsUrl(e){lL.H.setTermsConditionsUrl(e)}setPrivacyPolicyUrl(e){lL.H.setPrivacyPolicyUrl(e)}setThemeVariables(e){l1.W.setThemeVariables(e),(0,l5.ds)(l1.W.state.themeVariables)}subscribeTheme(e){return l1.W.subscribe(e)}getWalletInfo(){return lH.U.state.connectedWalletInfo}getAccount(e){let t=lR.a.getAuthConnector(e),r=lz.W.getAccountData(e);if(r)return{allAccounts:r.allAccounts,caipAddress:r.caipAddress,address:lD.w.getPlainAddress(r.caipAddress),isConnected:!!r.caipAddress,status:r.status,embeddedWalletInfo:t?{user:r.user,authProvider:r.socialProvider||"email",accountType:r.preferredAccountType,isSmartAccountDeployed:!!r.smartAccountDeployed}:void 0}}subscribeAccount(e,t){let r=()=>{let r=this.getAccount(t);r&&e(r)};t?lz.W.subscribeChainProp("accountState",r,t):lz.W.subscribe(r),lR.a.subscribe(r)}subscribeNetwork(e){return lz.W.subscribe(({activeCaipNetwork:t})=>{e({caipNetwork:t,chainId:t?.id,caipNetworkId:t?.caipNetworkId})})}subscribeWalletInfo(e){return lH.U.subscribeKey("connectedWalletInfo",e)}subscribeShouldUpdateToAddress(e){lH.U.subscribeKey("shouldUpdateToAddress",e)}subscribeCaipNetworkChange(e){lz.W.subscribeKey("activeCaipNetwork",e)}getState(){return lZ.z.state}subscribeState(e){return lZ.z.subscribe(e)}showErrorMessage(e){l3.P.showError(e)}showSuccessMessage(e){l3.P.showSuccess(e)}getEvent(){return{...l0.E.state}}subscribeEvents(e){return l0.E.subscribe(e)}replace(e){lY.I.replace(e)}redirect(e){lY.I.push(e)}popTransactionStack(e){lY.I.popTransactionStack(e)}isOpen(){return lF.W.state.open}isTransactionStackEmpty(){return 0===lY.I.state.transactionStack.length}isTransactionShouldReplaceView(){return lY.I.state.transactionStack[lY.I.state.transactionStack.length-1]?.replace}static getInstance(){return this.instance}updateFeatures(e){lL.H.setFeatures(e)}updateOptions(e){let t={...lL.H.state||{},...e};lL.H.setOptions(t)}setConnectMethodsOrder(e){lL.H.setConnectMethodsOrder(e)}setWalletFeaturesOrder(e){lL.H.setWalletFeaturesOrder(e)}setCollapseWallets(e){lL.H.setCollapseWallets(e)}setSocialsOrder(e){lL.H.setSocialsOrder(e)}getConnectMethodsOrder(){return l8.A.getConnectOrderMethod(lL.H.state.features,lR.a.getConnectors())}removeAdapter(e){let t=this.getIsConnectedState(),r=this.getAdapter(e);if(!r||!this.chainAdapters||t)return;let i=this.caipNetworks?.filter(t=>t.chainNamespace!==e);lz.W.removeAdapter(e),lR.a.removeAdapter(e),this.chainNamespaces=this.chainNamespaces.filter(t=>t!==e),this.caipNetworks=i,r.removeAllEventListeners(),Reflect.deleteProperty(this.chainAdapters,e)}addAdapter(e,t){let r=e.namespace;if(!this.connectionControllerClient||!this.networkControllerClient||!this.chainAdapters||!r)return;let i=this.extendCaipNetworks({...this.options,networks:t});this.caipNetworks=[...this.caipNetworks||[],...i],this.createAdapter(e),this.initChainAdapter(r),lz.W.addAdapter(e,{connectionControllerClient:this.connectionControllerClient,networkControllerClient:this.networkControllerClient},i)}addNetwork(e,t){if(this.chainAdapters&&!this.chainAdapters[e])throw Error(`Adapter for namespace ${e} doesn't exist`);let r=this.extendCaipNetwork(t,this.options);lz.W.addNetwork(r),this.caipNetworks&&!this.caipNetworks?.find(e=>e.id===r.id)&&this.caipNetworks.push(r)}removeNetwork(e,t){if(this.chainAdapters&&!this.chainAdapters[e])throw Error(`Adapter for namespace ${e} doesn't exist`);if(!this.caipNetworks?.find(e=>e.id===t))throw Error(`Network with ID ${t} not found`);if(!this.caipNetworks)return;let r=this.caipNetworks.filter(r=>r.chainNamespace===e&&r.id!==t);if(!r?.length)throw Error("Cannot remove last network for a namespace");lz.W.removeNetwork(e,t),this.caipNetworks=[...r]}}let uN=!1;class uO extends uC{async open(e){lR.a.isConnected()||await super.open(e)}async close(){await super.close(),this.options.manualWCControl&&lk.x.finalizeWcConnection()}async syncIdentity(e){return Promise.resolve()}async syncBalance(e){return Promise.resolve()}
509async injectModalUi(){if(!uN&&lD.w.isClient()){if(await Promise.all([r.e(4510),r.e(2247)]).then(r.bind(r,22247)),await Promise.all([r.e(4510),r.e(9135)]).then(r.bind(r,29135)),!document.querySelector("w3m-modal")){let e=document.createElement("w3m-modal");lL.H.state.disableAppend||lL.H.state.enableEmbedded||document.body.insertAdjacentElement("beforeend",e)}uN=!0}}}class uP extends Error{constructor(){super(),Object.setPrototypeOf(this,uP.prototype)}}class uT extends Error{constructor(e){super(`WalletConnect Adapter - Method ${e} is not supported by the wallet`),this.name="WalletConnectFeatureNotSupportedError"}}let uM={mainnet:`You are using a deprecated chain ID for Solana Mainnet, please use ${d.Mainnet} instead.`,devnet:`You are using a deprecated chain ID for Solana Devnet, please use ${d.Devnet} instead.`,wallet:"The connected wallet is using a deprecated chain ID for Solana. Please, contact them to upgrade. You can learn more at https://github.com/ChainAgnostic/namespaces/blob/main/solana/caip10.md#chain-ids"};function uR(e,t){let r=e.namespaces.solana?.accounts.map(e=>`solana:${e.split(":")[1]}`);if(t===d.Mainnet)return r?.find(e=>e===d.Mainnet)?d.Mainnet:(console.warn(uM.wallet),d.Deprecated_Mainnet);if(t===d.Devnet)return r?.find(e=>e===d.Devnet)?d.Devnet:(console.warn(uM.wallet),d.Deprecated_Devnet);throw Error("WalletConnect Solana Adapter: Unable to get a default chain from the session.")}class uk extends Error{constructor(){super("QR Code Modal was closed by user"),Object.setPrototypeOf(this,uk.prototype),this.name="QRCodeModalError"}}var uD=r(81029).Buffer;class uL{_UniversalProvider;_session;_modal;_projectId;_network;_ConnectQueueResolver;constructor(e){if(this.initClient(e.options),this._network=e.network,!e.options.projectId)throw Error("WalletConnect Adapter: Project ID is undefined");this._projectId=e.options.projectId}async connect(){var e;let t;if(this._UniversalProvider||await new Promise(e=>{this._ConnectQueueResolver=e}),!this._UniversalProvider)throw Error("WalletConnect Adapter - Universal Provider was undefined while calling 'connect()'");if(this._UniversalProvider.session){this._session=this._UniversalProvider.session;let e=uR(this._session,this._network);return this._network=e,this._UniversalProvider.setDefaultChain(e),{publicKey:this.publicKey}}await this.initModal();let r={optionalNamespaces:{solana:{chains:(t=[e=this._network],e===d.Mainnet||e===d.Deprecated_Mainnet?(t=[d.Mainnet,d.Deprecated_Mainnet],e===d.Deprecated_Mainnet&&console.warn(uM.mainnet)):(e===d.Deprecated_Devnet||e===d.Devnet)&&(t=[d.Devnet,d.Deprecated_Devnet],d.Deprecated_Devnet&&console.warn(uM.devnet)),t),methods:[a.signTransaction,a.signMessage],events:[]}}};this._modal?.open();let i=new AbortController,n=i.signal;this._modal?.subscribeState(e=>{e.open||i.abort(new uk)});try{let e=await Promise.race([this._UniversalProvider?.connect(r),new Promise((e,t)=>{n.addEventListener("abort",()=>{t(n.reason)})})]);if(this._modal?.close(),this._session=e,!e)throw new h.Y6;let t=uR(e,this._network);return this._network=t,this._UniversalProvider?.setDefaultChain(t),{publicKey:this.publicKey}}catch(e){throw this._modal?.close(),e}}async disconnect(){if(this._UniversalProvider?.session){if(await this.initModal(),!this._modal)throw Error("WalletConnect Adapter -Modal is undefined: unable to disconnect");await this.client.disconnect(),this._session=void 0}else throw new uP}get client(){if(this._UniversalProvider)return this._UniversalProvider;throw new uP}get session(){if(!this._session)throw new uP;return this._session}get publicKey(){if(this._UniversalProvider?.session&&this._session){let{address:e}=function(e){let[t,r,i]=e.split(":");return{namespace:t,reference:r,address:i}}(this._session?.namespaces.solana?.accounts[0]??"");return new p.PublicKey(e)}throw new uP}async signTransaction(e){this.checkIfWalletSupportsMethod(a.signTransaction);let t=(0,f.Y)(e),r=t?{}:e,{signature:i,transaction:n}=await this.client.client.request({chainId:this._network,topic:this.session.topic,request:{method:a.signTransaction,params:{...r,transaction:this.serialize(e)}}});return n?this.deserialize(n,t):(e.addSignature(this.publicKey,uD.from(ui.A.decode(i))),e)}async signMessage(e){this.checkIfWalletSupportsMethod(a.signMessage);let{signature:t}=await this.client.client.request({chainId:this._network,topic:this.session.topic,request:{method:a.signMessage,params:{pubkey:this.publicKey.toString(),message:ui.A.encode(e)}}});return ui.A.decode(t)}async signAndSendTransaction(e){this.checkIfWalletSupportsMethod(a.signAndSendTransaction);let{signature:t}=await this.client.client.request({chainId:this._network,topic:this.session.topic,request:{method:a.signAndSendTransaction,params:{transaction:this.serialize(e)}}});return t}async signAllTransactions(e){try{this.checkIfWalletSupportsMethod(a.signAllTransactions);let t=e.map(e=>this.serialize(e)),{transactions:r}=await this.client.client.request({chainId:this._network,topic:this.session.topic,request:{method:a.signAllTransactions,params:{transactions:t}}});return e.map((e,t)=>(0,f.Y)(e)?this.deserialize(r[t]??"",!0):this.deserialize(r[t]??""))}catch(t){if(t instanceof uT){let t=e.map(e=>this.signTransaction(e));return await Promise.all(t)}throw t}}async initClient(e){let t=await lM.init(e);this._UniversalProvider=t,this._ConnectQueueResolver&&this._ConnectQueueResolver(!0)}async initModal(){if(!this._modal){if(!this._UniversalProvider)throw Error("WalletConnect Adapter - cannot init modal when Universal Provider is undefined");this._modal=new uO({...{projectId:this._projectId,universalProvider:this._UniversalProvider,networks:[ub,uw,uv],manualWCControl:!0},basic:!0,sdkVersion:"html-core-1.7.2"})}}serialize(e){return uD.from(e.serialize({verifySignatures:!1})).toString("base64")}deserialize(e,t=!1){return t?p.VersionedTransaction.deserialize(uD.from(e,"base64")):p.Transaction.from(uD.from(e,"base64"))}checkIfWalletSupportsMethod(e){if(!this.session.namespaces.solana?.methods.includes(e))throw new uT(e)}}class uU extends c.Kl{name="WalletConnect";url="https://walletconnect.org";icon="data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE4NSIgdmlld0JveD0iMCAwIDMwMCAxODUiIHdpZHRoPSIzMDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0ibTYxLjQzODU0MjkgMzYuMjU2MjYxMmM0OC45MTEyMjQxLTQ3Ljg4ODE2NjMgMTI4LjI
509xMTk4NzEtNDcuODg4MTY2MyAxNzcuMTIzMjA5MSAwbDUuODg2NTQ1IDUuNzYzNDE3NGMyLjQ0NTU2MSAyLjM5NDQwODEgMi40NDU1NjEgNi4yNzY1MTEyIDAgOC42NzA5MjA0bC0yMC4xMzY2OTUgMTkuNzE1NTAzYy0xLjIyMjc4MSAxLjE5NzIwNTEtMy4yMDUzIDEuMTk3MjA1MS00LjQyODA4MSAwbC04LjEwMDU4NC03LjkzMTE0NzljLTM0LjEyMTY5Mi0zMy40MDc5ODE3LTg5LjQ0Mzg4Ni0zMy40MDc5ODE3LTEyMy41NjU1Nzg4IDBsLTguNjc1MDU2MiA4LjQ5MzYwNTFjLTEuMjIyNzgxNiAxLjE5NzIwNDEtMy4yMDUzMDEgMS4xOTcyMDQxLTQuNDI4MDgwNiAwbC0yMC4xMzY2OTQ5LTE5LjcxNTUwMzFjLTIuNDQ1NTYxMi0yLjM5NDQwOTItMi40NDU1NjEyLTYuMjc2NTEyMiAwLTguNjcwOTIwNHptMjE4Ljc2Nzc5NjEgNDAuNzczNzQ0OSAxNy45MjE2OTcgMTcuNTQ2ODk3YzIuNDQ1NTQ5IDIuMzk0Mzk2OSAyLjQ0NTU2MyA2LjI3NjQ3NjkuMDAwMDMxIDguNjcwODg5OWwtODAuODEwMTcxIDc5LjEyMTEzNGMtMi40NDU1NDQgMi4zOTQ0MjYtNi40MTA1ODIgMi4zOTQ0NTMtOC44NTYxNi4wMDAwNjItLjAwMDAxLS4wMDAwMS0uMDAwMDIyLS4wMDAwMjItLjAwMDAzMi0uMDAwMDMybC01Ny4zNTQxNDMtNTYuMTU0NTcyYy0uNjExMzktLjU5ODYwMi0xLjYwMjY1LS41OTg2MDItMi4yMTQwNCAwLS4wMDAwMDQuMDAwMDA0LS4wMDAwMDcuMDAwMDA4LS4wMDAwMTEuMDAwMDExbC01Ny4zNTI5MjEyIDU2LjE1NDUzMWMtMi40NDU1MzY4IDIuMzk0NDMyLTYuNDEwNTc1NSAyLjM5NDQ3Mi04Ljg1NjE2MTIuMDAwMDg3LS4wMDAwMTQzLS4wMDAwMTQtLjAwMDAyOTYtLjAwMDAyOC0uMDAwMDQ0OS0uMDAwMDQ0bC04MC44MTI0MTk0My03OS4xMjIxODVjLTIuNDQ1NTYwMjEtMi4zOTQ0MDgtMi40NDU1NjAyMS02LjI3NjUxMTUgMC04LjY3MDkxOTdsMTcuOTIxNzI5NjMtMTcuNTQ2ODY3M2MyLjQ0NTU2MDItMi4zOTQ0MDgyIDYuNDEwNTk4OS0yLjM5NDQwODIgOC44NTYxNjAyIDBsNTcuMzU0OTc3NSA1Ni4xNTUzNTdjLjYxMTM5MDguNTk4NjAyIDEuNjAyNjQ5LjU5ODYwMiAyLjIxNDAzOTggMCAuMDAwMDA5Mi0uMDAwMDA5LjAwMDAxNzQtLjAwMDAxNy4wMDAwMjY1LS4wMDAwMjRsNTcuMzUyMTAzMS01Ni4xNTUzMzNjMi40NDU1MDUtMi4zOTQ0NjMzIDYuNDEwNTQ0LTIuMzk0NTUzMSA4Ljg1NjE2MS0uMDAwMi4wMDAwMzQuMDAwMDMzNi4wMDAwNjguMDAwMDY3My4wMDAxMDEuMDAwMTAxbDU3LjM1NDkwMiA1Ni4xNTU0MzJjLjYxMTM5LjU5ODYwMSAxLjYwMjY1LjU5ODYwMSAyLjIxNDA0IDBsNTcuMzUzOTc1LTU2LjE1NDMyNDljMi40NDU1NjEtMi4zOTQ0MDkyIDYuNDEwNTk5LTIuMzk0NDA5MiA4Ljg1NjE2IDB6IiBmaWxsPSIjM2I5OWZjIi8+PC9zdmc+";supportedTransactionVersions=new Set(["legacy",0]);_publicKey;_connecting;_wallet;_config;_readyState;_onDisconnect;constructor(e){super(),this._publicKey=null,this._connecting=!1,this._config=e,this._wallet=null,this._readyState="undefined"==typeof window?l.Ok.Unsupported:l.Ok.Loadable,this._onDisconnect=this.disconnect.bind(this)}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==l.Ok.Loadable)throw new h.AE;this._connecting=!0,this._wallet=new uL({network:this._config.network===u.B.Mainnet?o.Mainnet:o.Devnet,options:this._config.options});let{publicKey:e}=await this._wallet.connect();this._publicKey=e,this.emit("connect",e),this._wallet.client.on("session_delete",this._onDisconnect)}catch(e){if("QRCodeModalError"===e.constructor.name||e instanceof Error&&"QRCodeModalError"===e.name)throw new h.KL;throw this._connecting=!1,e}finally{this._connecting=!1}}async disconnect(){let e=this._wallet;if(e){e.client.off("session_delete",this._onDisconnect),this._publicKey=null;try{e.client.session&&await e.disconnect()}catch(e){console.error("WalletConnectWalletAdapter: disconnect error",e),this.emit("error",new h.Y8(e?.message,e))}}this.emit("disconnect")}async signTransaction(e){try{let t=this._wallet;if(!t)throw new h.kW;try{return await t.signTransaction(e)}catch(e){throw new h.z4(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signMessage(e){try{let t=this._wallet;if(!t)throw new h.kW;try{return await t.signMessage(e)}catch(e){throw new h.K3(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signAndSendTransaction(e){try{let t=this._wallet;if(!t)throw new h.kW;try{return await t.signAndSendTransaction(e)}catch(e){throw new h.z4(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signAllTransactions(e){try{let t=this._wallet;if(!t)throw new h.kW;try{return await t.signAllTransactions(e)}catch(e){throw new h.z4(e?.message,e)}}catch(e){throw this.emit("error",e),e}}}},44020:(e,t,r)=>{"use strict";e.exports=function(e){var t;return e.mode.ECB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t),e.mode.ECB}(r(16611),r(99229))},44826:(e,t,r)=>{"use strict";r.d(t,{T:()=>g});var i=r(70524),n=r(28977),s=r(12319),o=r(32464),a=r(58653),c=r(58051),l=r(67695),h=r(55480),u=r(65374);
509let d={purchaseCurrencies:[{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"Ether",symbol:"ETH",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]}],paymentCurrencies:[{id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},{id:"EUR",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]}]},f=s.w.getBlockchainApiUrl(),p=(0,i.BX)({clientId:null,api:new o.Z({baseUrl:f,clientId:null}),supportedChains:{http:[],ws:[]}}),g={state:p,async get(e){let{st:t,sv:r}=g.getSdkProperties(),i=h.H.state.projectId,n={...e.params||{},st:t,sv:r,projectId:i};return p.api.get({...e,params:n})},getSdkProperties(){let{sdkType:e,sdkVersion:t}=h.H.state;return{st:e||"unknown",sv:t||"unknown"}},async isNetworkSupported(e){if(!e)return!1;try{p.supportedChains.http.length||await g.getSupportedNetworks()}catch(e){return!1}return p.supportedChains.http.includes(e)},async getSupportedNetworks(){let e=await g.get({path:"v1/supported-chains"});return p.supportedChains=e,e},async fetchIdentity({address:e,caipNetworkId:t}){if(!await g.isNetworkSupported(t))return{avatar:"",name:""};let r=a.i.getIdentityFromCacheForAddress(e);if(r)return r;let i=await g.get({path:`/v1/identity/${e}`,params:{sender:l.W.state.activeCaipAddress?s.w.getPlainAddress(l.W.state.activeCaipAddress):void 0}});return a.i.updateIdentityCache({address:e,identity:i,timestamp:Date.now()}),i},fetchTransactions:async({account:e,cursor:t,onramp:r,signal:i,cache:n,chainId:s})=>await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId)?g.get({path:`/v1/account/${e}/history`,params:{cursor:t,onramp:r,chainId:s},signal:i,cache:n}):{data:[],next:void 0},fetchSwapQuote:async({amount:e,userAddress:t,from:r,to:i,gasPrice:n})=>await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId)?g.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{amount:e,userAddress:t,from:r,to:i,gasPrice:n}}):{quotes:[]},fetchSwapTokens:async({chainId:e})=>await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId)?g.get({path:"/v1/convert/tokens",params:{chainId:e}}):{tokens:[]},fetchTokenPrice:async({addresses:e})=>await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId)?p.api.post({path:"/v1/fungible/price",body:{currency:"usd",addresses:e,projectId:h.H.state.projectId},headers:{"Content-Type":"application/json"}}):{fungibles:[]},fetchSwapAllowance:async({tokenAddress:e,userAddress:t})=>await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId)?g.get({path:"/v1/convert/allowance",params:{tokenAddress:e,userAddress:t},headers:{"Content-Type":"application/json"}}):{allowance:"0"},async fetchGasPrice({chainId:e}){let{st:t,sv:r}=g.getSdkProperties();if(!await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId))throw Error("Network not supported for Gas Price");return g.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json"},params:{chainId:e,st:t,sv:r}})},async generateSwapCalldata({amount:e,from:t,to:r,userAddress:i,disableEstimate:s}){if(!await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId))throw Error("Network not supported for Swaps");return p.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:e,eip155:{slippage:n.oU.CONVERT_SLIPPAGE_TOLERANCE},projectId:h.H.state.projectId,from:t,to:r,userAddress:i,disableEstimate:s}})},async generateApproveCalldata({from:e,to:t,userAddress:r}){let{st:i,sv:n}=g.getSdkProperties();if(!await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId))throw Error("Network not supported for Swaps");return g.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json"}
509,params:{userAddress:r,from:e,to:t,st:i,sv:n}})},async getBalance(e,t,r){let{st:i,sv:n}=g.getSdkProperties();if(!await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId))return u.P.showError("Token Balance Unavailable"),{balances:[]};let s=`${t}:${e}`,o=a.i.getBalanceCacheForCaipAddress(s);if(o)return o;let c=await g.get({path:`/v1/account/${e}/balance`,params:{currency:"usd",chainId:t,forceUpdate:r,st:i,sv:n}});return a.i.updateBalanceCache({caipAddress:s,balance:c,timestamp:Date.now()}),c},lookupEnsName:async e=>await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId)?g.get({path:`/v1/profile/account/${e}`,params:{apiVersion:"2"}}):{addresses:{},attributes:[]},reverseLookupEnsName:async({address:e})=>await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId)?g.get({path:`/v1/profile/reverse/${e}`,params:{sender:c.U.state.address,apiVersion:"2"}}):[],getEnsNameSuggestions:async e=>await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId)?g.get({path:`/v1/profile/suggestions/${e}`,params:{zone:"reown.id"}}):{suggestions:[]},registerEnsName:async({coinType:e,address:t,message:r,signature:i})=>await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId)?p.api.post({path:"/v1/profile/account",body:{coin_type:e,address:t,message:r,signature:i},headers:{"Content-Type":"application/json"}}):{success:!1},generateOnRampURL:async({destinationWallets:e,partnerUserId:t,defaultNetwork:r,purchaseAmount:i,paymentAmount:n})=>await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId)?(await p.api.post({path:"/v1/generators/onrampurl",params:{projectId:h.H.state.projectId},body:{destinationWallets:e,defaultNetwork:r,partnerUserId:t,defaultExperience:"buy",presetCryptoAmount:i,presetFiatAmount:n}})).url:"",async getOnrampOptions(){if(!await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId))return{paymentCurrencies:[],purchaseCurrencies:[]};try{return await g.get({path:"/v1/onramp/options"})}catch(e){return d}},async getOnrampQuote({purchaseCurrency:e,paymentCurrency:t,amount:r,network:i}){try{if(!await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId))return null;return await p.api.post({path:"/v1/onramp/quote",params:{projectId:h.H.state.projectId},body:{purchaseCurrency:e,paymentCurrency:t,amount:r,network:i}})}catch(e){return{coinbaseFee:{amount:r,currency:t.id},networkFee:{amount:r,currency:t.id},paymentSubtotal:{amount:r,currency:t.id},paymentTotal:{amount:r,currency:t.id},purchaseAmount:{amount:r,currency:t.id},quoteId:"mocked-quote-id"}}},getSmartSessions:async e=>await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId)?g.get({path:`/v1/sessions/${e}`}):[],revokeSmartSession:async(e,t,r)=>await g.isNetworkSupported(l.W.state.activeCaipNetwork?.caipNetworkId)?p.api.post({path:`/v1/sessions/${e}/revoke`,params:{projectId:h.H.state.projectId},body:{pci:t,signature:r}}):{success:!1},setClientId(e){p.clientId=e,p.api=new o.Z({baseUrl:f,clientId:e})}}},44839:function(e){e.exports=function(e,t,r){e=e||{};var i=t.prototype,n={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function s(e,t,r,n){return i.fromToBase(e,t,r,n)}r.en.relativeTime=n,i.fromToBase=function(t,i,s,o,a){for(var c,l,h,u=s.$locale().relativeTime||n,d=e.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],f=d.length,p=0;p<f;p+=1){var g=d[p];g.d&&(c=o?r(t).diff(s,g.d,!0):s.diff(t,g.d,!0));var m=(e.rounding||Math.round)(Math.abs(c));if(h=c>0,m<=g.r||!g.r){m<=1&&p>0&&(g=d[p-1]);var y=u[g.l];a&&(m=a(""+m)),l="string"==typeof y?y.replace("%d",m):y(m,i,g.l,h);break}}if(i)return l;var b=h?u.future:u.past;return"function"==typeof b?b(l):b.replace("%s",l)},i.to=function(e,t){return s(e,t,this,!0)},i.from=function(e,t){return s(e,t,this)};var o=function(e){return e.$u?r.utc():r()};i.toNow=function(e){return this.to(o(this),e)},i.fromNow=function(e){return this.from(o(this),e)}}},45069:(e,t,r)=>{"use strict";r.d(t,{W:()=>a});var i=r(70524),n=r(52617),s=r(66254);let o=(0,i.BX)({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),a={state:o,subscribe:e=>(0,i.B1)(o,()=>e(o)),setThemeMode(e){o.themeMode=e;try{let t=s.a.getAuthConnector();if(t){let r=a.getSnapshot().themeVariables;t.provider.syncTheme({themeMode:e,themeVariables:r,w3mThemeVariables:(0,n.o)(r,e)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(e){o.themeVariables={...o.themeVariables,...e};try{let e=s.a.getAuthConnector();if(e){let t=a.getSnapshot().themeVariables;e.provider.syncTheme({themeVariables:t,w3mThemeVariables:(0,n.o)(o.themeVariables,o.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}},getSnapshot:()=>(0,i.P9)(o)}},45669:(e,t,r)=>{"use strict";r.d(t,{DE:()=>a,Kl:()=>o,Xl:()=>c});var i=r(51470),n=r(36452),s=r(51901);class o extends i.Ce{async sendTransaction(e,t,r={}){let i=!0;try{if((0,s.Y)(e)){if(!this.supportedTransactionVersions)throw new n.UF("Sending versioned transactions isn't supported by this wallet");if(!this.supportedTransactionVersions.has(e.version))throw new n.UF(`Sending transaction version ${e.ver
509sion} isn't supported by this wallet`);try{let i=(e=await this.signTransaction(e)).serialize();return await t.sendRawTransaction(i,r)}catch(e){if(e instanceof n.z4)throw i=!1,e;throw new n.UF(e?.message,e)}}try{let{signers:i,...n}=r;e=await this.prepareTransaction(e,t,n),i?.length&&e.partialSign(...i);let s=(e=await this.signTransaction(e)).serialize();return await t.sendRawTransaction(s,n)}catch(e){if(e instanceof n.z4)throw i=!1,e;throw new n.UF(e?.message,e)}}catch(e){throw i&&this.emit("error",e),e}}async signAllTransactions(e){for(let t of e)if((0,s.Y)(t)){if(!this.supportedTransactionVersions)throw new n.z4("Signing versioned transactions isn't supported by this wallet");if(!this.supportedTransactionVersions.has(t.version))throw new n.z4(`Signing transaction version ${t.version} isn't supported by this wallet`)}let t=[];for(let r of e)t.push(await this.signTransaction(r));return t}}class a extends o{}class c extends a{}},46186:(e,t,r)=>{"use strict";function i(e){return"object"==typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function n(e){return i(e)&&"method"in e}function s(e){return i(e)&&(o(e)||a(e))}function o(e){return"result"in e}function a(e){return"error"in e}r.d(t,{U$:()=>a,p3:()=>n,tq:()=>s,xT:()=>o})},46342:(e,t)=>{let r,i=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];t.getSymbolSize=function(e){if(!e)throw Error('"version" cannot be null or undefined');if(e<1||e>40)throw Error('"version" should be in range from 1 to 40');return 4*e+17},t.getSymbolTotalCodewords=function(e){return i[e]},t.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},t.setToSJISFunction=function(e){if("function"!=typeof e)throw Error('"toSJISFunc" is not a valid function.');r=e},t.isKanjiModeEnabled=function(){return void 0!==r},t.toSJIS=function(e){return r(e)}},46524:(e,t,r)=>{"use strict";var i=r(20920),n=r(3285);function s(e,t,r){if(!(this instanceof s))return new s(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(i.toArray(t,r))}e.exports=s,s.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),n(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(t=0,this.inner=new this.Hash().update(e);t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},s.prototype.update=function(e,t){return this.inner.update(e,t),this},s.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},47083:(e,t,r)=>{"use strict";r.d(t,{lq:()=>ee});var i=r(20218),n=r(60316),s=(e=>(e.Start="magic_oauth_login_with_redirect_start",e.Verify="magic_oauth_login_with_redirect_verify",e.Po
509pup="magic_oauth_login_with_popup",e.VerifyTelegramData="magic_oauth_verify_telegram_data",e.VerifySteamData="magic_oauth_verify_steam_data",e.LoginWithGoogleIdToken="magic_auth_login_with_google_id_token",e))(s||{}),o=(e=>(e.InvalidRequest="invalid_request",e.InvalidClient="invalid_client",e.InvalidScope="invalid_scope",e.InvalidGrant="invalid_grant",e.UnauthorizedClient="unauthorized_client",e.UnsupportedResponseType="unsupported_response_type",e.UnsupportedGrantType="unsupported_grant_type",e.UnsupportedTokenType="unsupported_token_type",e.AccessDenied="access_denied",e.ServerError="server_error",e.TemporarilyUnavailable="temporarily_unavailable",e))(o||{}),a=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.ConnectionLost="CONNECTION_WAS_LOST",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(a||{}),c=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e.ProductAnnouncement="ANNOUNCEMENT",e))(c||{}),l=(e=>(e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser",e[e.UserRejectedAction=-10012]="UserRejectedAction",e[e.RequestCancelled=-10014]="RequestCancelled",e[e.RedirectLoginComplete=-10015]="RedirectLoginComplete",e[e.SessionTerminated=-10016]="SessionTerminated",e[e.PopupRequestOverriden=-10017]="PopupRequestOverriden",e[e.SanEmail=-10018]="SanEmail",e[e.DpopInvalidated=-10019]="DpopInvalidated",e[e.MaxAttemptsReached=-10031]="MaxAttemptsReached",e[e.UserRequiredMfa=-10033]="UserRequiredMfa",e))(l||{}),h=(e=>(e.PROVIDER="magic_3pw_provider",e.ADDRESS="magic_3pw_address",e.CHAIN_ID="magic_3pw_chainId",e))(h||{}),u=(e=>(e.WalletConnected="wallet_connected",e.WalletRejected="wallet_rejected",e.Web3ModalSelected="web3modal_selected",e))(u||{}),d=(e=>
509(e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithEmailOTP="magic_auth_login_with_email_otp",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.SetAuthorizationToken="magic_auth_set_authorization_token",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode",e.IntermediaryEvent="magic_intermediary_event",e.RequestAccounts="eth_requestAccounts",e.GetInfo="magic_get_info",e.ShowUI="magic_wallet",e.NFTPurchase="magic_nft_purchase",e.NFTCheckout="magic_nft_checkout",e.NFTTransfer="magic_nft_transfer",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e.MagicBoxHeartBeat="magic_box_heart_beat",e.AutoConnect="mc_auto_connect",e.Login="mc_login",e.EncryptV1="magic_auth_encrypt_v1",e.DecryptV1="magic_auth_decrypt_v1",e.ShowNFTs="magic_show_nfts",e.ShowOnRamp="magic_show_fiat_onramp",e.ShowSendTokensUI="magic_show_send_tokens_ui",e.ShowAddress="magic_show_address",e.ShowBalances="magic_show_balances",e.RevealPK="magic_reveal_key",e.EnableMFA="magic_auth_enable_mfa_flow",e.DisableMFA="magic_auth_disable_mfa_flow",e.GetMultichainPublicAddress="magic_get_multichain_public_address",e.Sign7702Authorization="magic_wallet_sign_7702_authorization",e.Send7702Transaction="eth_send7702Transaction",e))(d||{}),f=(e=>(e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",e.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",e.MAGIC_SEND_PRODUCT_ANNOUNCEMENT="MAGIC_SEND_PRODUCT_ANNOUNCEMENT",e.MAGIC_PONG="MAGIC_PONG",e.MAGIC_POPUP_RESPONSE="MAGIC_POPUP_RESPONSE",e.MAGIC_POPUP_OAUTH_VERIFY_RESPONSE="MAGIC_POPUP_OAUTH_VERIFY_RESPONSE",e.MAGIC_THIRD_PARTY_WALLET_REQUEST="MAGIC_THIRD_PARTY_WALLET_REQUEST",e.MAGIC_OPEN_MOBILE_URL="MAGIC_OPEN_MOBILE_URL",e))(f||{}),p=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e.MAGIC_THIRD_PARTY_WALLET_RESPONSE="MAGIC_THIRD_PARTY_WALLET_RESPONSE",e.MAGIC_THIRD_PARTY_WALLET_UPDATE="MAGIC_THIRD_PARTY_WALLET_EVENT",e.MAGIC_PING="MAGIC_PING",e))(p||{}),g=(e=>(e.UpdateEmail="update-email",e.MFA="mfa",e.Recovery="recovery",e))(g||{}),m=(e=>(e.Retry="retry",e))(m||{}),y=(e=>(e.EmailSent="email-sent",e.EmailNotDeliverable="email-not-deliverable",e))(y||{}),b=(e=>(e.VerifyEmailOtp="verify-email-otp",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e.Cancel="cancel",e))(b||{}),w=(e=>(e.VerifySmsOtp="verify-sms-otp",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e.Cancel="cancel",e.Retry="retry",e))(w||{}),v=(e=>(e.SmsOTPSent="sms-otp-sent",e.InvalidSmsOtp="invalid-sms-otp",e.ExpiredSmsOtp="expired-sms-otp",e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.LoginThrottled="login-throttled",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(v||{}),x=(e=>(e.EmailOTPSent="email-otp-sent",e.InvalidEmailOtp="invalid-email-otp",e.InvalidMfaOtp="invalid-mfa-otp",e.ExpiredEmailOtp="expired-email-otp",e.MfaSentHandle="mfa-sent-handle",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e.LoginThrottled="login-throttled",e.MaxAttemptsReached="max-attempts-reached",e))(x||{}),E=(e=>(e.Retry="device-retry",e))(E||{}),_=(e=>(e.DeviceApproved="device-approved",e.DeviceNeedsApproval="device-needs-approval",e.DeviceVerificationLinkExpired="device-verification-link-expired",e.DeviceVerificationEmailSent="device-verification-email-sent",e))(_||{}),I=(e=>
509(e.Retry="Recency/auth-factor-retry",e.Cancel="Recency/auth-factor-verification-cancel",e.VerifyEmailOtp="Recency/auth-factor-verify-email-otp",e.VerifyMFACode="Recency/verify-mfa-code",e))(I||{}),A=(e=>(e.PrimaryAuthFactorNeedsVerification="Recency/auth-factor-needs-verification",e.PrimaryAuthFactorVerified="Recency/auth-factor-verified",e.InvalidEmailOtp="Recency/auth-factor-invalid-email-otp",e.EmailExpired="Recency/auth-factor-verification-email-expired",e.EmailSent="Recency/auth-factor-verification-email-sent",e.EmailNotDeliverable="Recency/auth-factor-verification-email-not-deliverable",e))(A||{}),S=(e=>(e.RetryWithNewEmail="UpdateEmail/retry-with-new-email",e.Cancel="UpdateEmail/new-email-verification-cancel",e.VerifyEmailOtp="UpdateEmail/new-email-verify-otp",e))(S||{}),C=(e=>(e.NewAuthFactorNeedsVerification="UpdateEmail/new-email-needs-verification",e.EmailUpdated="UpdateEmail/email-updated",e.InvalidEmailOtp="UpdateEmail/new-email-invalid-email-otp",e.EmailExpired="UpdateEmail/new-email-verification-email-expired",e.EmailSent="UpdateEmail/new-email-verification-email-sent",e.EmailNotDeliverable="UpdateEmail/new-email-verification-email-not-deliverable",e.InvalidEmail="UpdateEmail/new-email-invalid",e.EmailAlreadyExists="UpdateEmail/new-email-already-exists",e))(C||{}),N=(e=>(e.IDTokenCreated="Auth/id-token-created",e))(N||{}),O=(e=>(e.Cancel="Farcaster/cancel",e))(O||{}),P=(e=>(e.MFASecretGenerated="mfa-secret-generated",e.InvalidMFAOtp="invalid-mfa-otp",e.MFARecoveryCodes="mfa-recovery-codes",e))(P||{}),T=(e=>(e.VerifyMFACode="verify-mfa-code",e.Cancel="cancel-mfa-setup",e))(T||{}),M=(e=>(e.MFACodeRequested="mfa-code-requested",e.InvalidMFAOtp="invalid-mfa-otp",e.InvalidRecoveryCode="invalid-recovery-code",e))(M||{}),R=(e=>(e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.Cancel="cancel-mfa-disable",e))(R||{}),k=(e=>(e.Harmony="HARMONY",e))(k||{}),D=(e=>(e.ClosedByUser="closed-by-user",e))(D||{}),L=(e=>(e.ClosedByUser="closed-by-user-on-received",e))(L||{}),U=(e=>(e.EnterNewPhoneNumber="enter-new-phone-number",e.EnterOtpCode="enter-otp-code",e.RecoveryFactorAlreadyExists="recovery-factor-already-exists",e.MalformedPhoneNumber="malformed-phone-number",e.InvalidOtpCode="invalid-otp-code",e.RecoveryFactorUpdated="recovery-factor-updated",e.RecoveryFactorDeleted="recovery-factor-deleted",e))(U||{}),B=(e=>(e.SendNewPhoneNumber="send-new-phone-number",e.SendOtpCode="send-otp-code",e.Cancel="cancel",e.StartEditPhoneNumber="start-edit-phone-number",e))(B||{}),j=(e=>(e.PhoneNumber="phone_number",e))(j||{}),$=(e=>(e.SmsOtpSent="sms-otp-sent",e.LoginThrottled="login-throttled",e.InvalidSmsOtp="invalid-sms-otp",e.SmsVerified="sms-verified",e.AccountRecovered="account-recovered",e.UpdateEmailRequired="update-email-required",e))($||{}),z=(e=>(e.Cancel="cancel",e.VerifyOtp="verify-otp-code",e.ResendSms="resend-sms-otp",e.UpdateEmail="update-email",e))(z||{}),q=(e=>(e.Success="nft-checkout-success",e.Failure="nft-checkout-failure",e.Initiated="nft-checkout-initiated",e.Disconnect="disconnect",e))(q||{}),H=(e=>(e.WalletInfoFetched="Wallet/wallet-info-fetched",e))(H||{}),F=(e=>(e.CloseMagicWindow="close-magic-window",e))(F||{}),W=(e=>(e.Cancel="cancel",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e))(W||{}),V=(e=>(e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(V||{}),K=(e=>(e.PopupUrl="popup-url",e))(K||{}),G=(e=>(e.PopupEvent="popup-event",e))(G||{}),Y=(e=>(e.Cancel="cancel",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e))(Y||{}),J=(e=>(e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(J||{}),X="u">typeof window&&!!window.crypto;function Q(e){let t;if(!X)throw Error("Secure random number generation is not available in this environment. PKCE requires crypto.getRandomValues.");let r=new Uint8Array(e);return window.crypto.getRandomValues(r),t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",Array.from(r).map(e=>t[e%t.length]).join("")}var Z="magic_oauth_pkce_verifier",ee=class extends i.YY.Internal{name="oauth2";config={};compat={"magic-sdk":">=2.4.6","@magic-sdk/react-native":!1,"@magic-sdk/react-native-bare":!1,"@magic-sdk/react-native-expo":!1};constructor(){super(),this.seamlessTelegramLogin()}loginWithGoogleIdToken(e){let t=this.utils.createJsonRpcRequestPayload("magic_auth_login_with_google_id_token",[e]);return this.request(t)}loginWithRedirect(e){return this.utils.createPromiEvent(async(t,r)=>{let i="steam"===e.provider,s,o={};if(!i){let e,t,r,i=(e=Q(128),t=Q(128),r=n.SHA256(t).toString(n.enc.Base64).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),{codeVerifier:t,codeChallenge:r,cryptoChallengeState:e});s=i.codeVerifier,o.codeChallenge=i.codeChallenge,o.cryptoChallengeState=i.cryptoChallengeState}let a=this.utils.createJsonRpcRequestPayload("magic_oauth_login_with_redirect_start",[{...e,apiKey:this.sdk.apiKey,platform:"web",...o}]),c=await this.request(a);if(c.error&&r(this.createError(c.error,c.error_description??"An error occurred.",{errorURI:c.error_uri,provider:c.provider})),c?.pkceMetadata&&s&&(sessionStorage.setItem(Z,JSON.stringify({codeVerifier:s,...c.pkceMetadata})),localStorage.setItem(Z,JSON.stringify({codeVerifier:s,...c.pkceMetadata}))),c?.oauthAuthoriationURI){let e=c.useMagicServerCallback?new URL(c.oauthAuthoriationURI,this.sdk.endpoint).href:c.oauthAuthoriationURI;c?.shouldReturnURI?t(e):window.location.href=e}t(null)})}getRedirectResult(e={}){let t=e?.optionalQueryString||window.location.search,r=window.location.origin+window.location.pathname;window.history.replaceState(null,"",r);let i=t.startsWith("?")?t.slice(1):t;return"http://specs.openid.net/auth/2.0"===new URLSearchParams(i).get("openid.ns")?(this.clearPKCEMetadata(),this.get
509SteamResult(i)):this.getResult(e,t)}clearPKCEMetadata(){sessionStorage.removeItem(Z),localStorage.removeItem(Z)}getSteamResult(e){let t=this.utils.createJsonRpcRequestPayload("magic_oauth_verify_steam_data",[{openidParams:e}]);return this.utils.createPromiEvent(async(e,r)=>{try{let i=await this.request(t);if(i.error)return void r(this.createError(i.error,i.error_description??"An error occurred.",{errorURI:i.error_uri,provider:i.provider}));e(i)}catch(e){r(e)}})}loginWithPopup(e){let{showMfaModal:t}=e,r=this.utils.createJsonRpcRequestPayload("magic_oauth_login_with_popup",[{...e,showUI:t,returnTo:window.location.href,apiKey:this.sdk.apiKey,platform:"web"}]),n=(0,i.ke)(async(i,s)=>{try{let o=this.request(r),a=e=>{this.createIntermediaryEvent(G.PopupEvent,r.id)(e.data)};e.shouldReturnURI&&o&&o.on(K.PopupUrl,e=>{window.addEventListener("message",a),n.emit(K.PopupUrl,e)}),t||(o.on(V.MfaSentHandle,()=>{n.emit(V.MfaSentHandle)}),o.on(V.InvalidMfaOtp,()=>{n.emit(V.InvalidMfaOtp)}),o.on(V.RecoveryCodeSentHandle,()=>{n.emit(V.RecoveryCodeSentHandle)}),o.on(V.InvalidRecoveryCode,()=>{n.emit(V.InvalidRecoveryCode)}),o.on(V.RecoveryCodeSuccess,()=>{n.emit(V.RecoveryCodeSuccess)}));let c=await o;window.removeEventListener("message",a),c.error?s(this.createError(c.error,c.error_description??"An error occurred.",{errorURI:c.error_uri,provider:c.provider})):i(c)}catch(e){s(e)}});return!t&&n&&(n.on(W.VerifyMFACode,e=>{this.createIntermediaryEvent(W.VerifyMFACode,r.id)(e)}),n.on(W.LostDevice,()=>{this.createIntermediaryEvent(W.LostDevice,r.id)()}),n.on(W.VerifyRecoveryCode,e=>{this.createIntermediaryEvent(W.VerifyRecoveryCode,r.id)(e)}),n.on(W.Cancel,()=>{this.createIntermediaryEvent(W.Cancel,r.id)()})),n}getResult(e,t){let{showMfaModal:r}=e,{hasStateMismatch:i,clientMetadata:n}=this.retrievePKCEMetadata(t),s=this.utils.createJsonRpcRequestPayload("magic_oauth_login_with_redirect_verify",[{authorizationResponseParams:t,magicApiKey:this.sdk.apiKey,platform:"web",showUI:r,...e,...n?{clientMetadata:n}:{}}]),o=this.utils.createPromiEvent(async(e,t)=>{if(!n)return t(this.createError("MISSING_PKCE_METADATA","OAuth session metadata not found â the session may have expired or storage was cleared",{}));if(i)return t(this.createError("STATE_MISMATCH","OAuth state parameter mismatch â request may have been tampered with",{}));let a=this.request(s);r||(a.on(V.MfaSentHandle,()=>{o.emit(V.MfaSentHandle)}),a.on(V.InvalidMfaOtp,()=>{o.emit(V.InvalidMfaOtp)}),a.on(V.RecoveryCodeSentHandle,()=>{o.emit(V.RecoveryCodeSentHandle)}),a.on(V.InvalidRecoveryCode,()=>{o.emit(V.InvalidRecoveryCode)}),a.on(V.RecoveryCodeSuccess,()=>{o.emit(V.RecoveryCodeSuccess)}));let c=await a;c.error&&t(this.createError(c.error,c.error_description??"An error occurred.",{errorURI:c.error_uri,provider:c.provider})),e(c)});return!r&&o&&(o.on(W.VerifyMFACode,e=>{this.createIntermediaryEvent(W.VerifyMFACode,s.id)(e)}),o.on(W.LostDevice,()=>{this.createIntermediaryEvent(W.LostDevice,s.id)()}),o.on(W.VerifyRecoveryCode,e=>{this.createIntermediaryEvent(W.VerifyRecoveryCode,s.id)(e)}),o.on(W.Cancel,()=>{this.createIntermediaryEvent(W.Cancel,s.id)()})),o}seamlessTelegramLogin(){try{if(!window.location.hash.toString().includes("#tgWebAppData"))return;let e=document.createElement("script");e.src="https://telegram.org/js/telegram-web-app.js",document.head.prepend(e),e.onload=async()=>{try{let e=window.Telegram?.WebApp.initData,t=this.utils.createJsonRpcRequestPayload("magic_oauth_verify_telegram_data",[{userData:e,isMiniApp:!0}]);await this.request(t)}catch(e){console.log("Error while verifying telegram data",e)}}}catch(e){console.log("Error while loading telegram-web-app script",e)}}retrievePKCEMetadata(e){let t=!1,r=sessionStorage.getItem(Z),i=localStorage.getItem(Z);sessionStorage.removeItem(Z),localStorage.removeItem(Z);let n=r?JSON.parse(r):i?JSON.parse(i):void 0;if(n){let r=new URLSearchParams(e).get("state");r&&r===n.state||(t=!0)}return{clientMetadata:n,hasStateMismatch:t}}}},47327:(e,t,r)=>{"use strict";function i(e){return function(t){return"function"==typeof t?(customElements.get(e)||customElements.define(e,t),t):function(e,t){let{kind:r,elements:i}=t;return{kind:r,elements:i,finisher(t){customElements.get(e)||customElements.define(e,t)}}}(e,t)}}r.d(t,{E:()=>i})},47413:(e,t,r)=>{"use strict";e.exports=function(e){var t,r,i,n,s,o;return r=(t=e.lib).WordArray,i=t.Hasher,n=e.algo,s=[],o=n.SHA1=i.extend({_doReset:function(){this._hash=new r.init([0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],a=r[3],c=r[4],l=0;l<80;l++){if(l<16)s[l]=0|e[t+l];else{var h=s[l-3]^s[l-8]^s[l-14]^s[l-16];s[l]=h<<1|h>>>31}var u=(i<<5|i>>>27)+c+s[l];l<20?u+=(n&o|~n&a)+0x5a827999:l<40?u+=(n^o^a)+0x6ed9eba1:l<60?u+=(n&o|n&a|o&a)-0x70e44324:u+=(n^o^a)-0x359d3e2a,c=a,a=o,o=n<<30|n>>>2,n=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[(i+64>>>9<<4)+14]=Math.floor(r/0x100000000),t[(i+64>>>9<<4)+15]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),e.SHA1=i._createHelper(o),e.HmacSHA1=i._createHmacHelper(o),e.SHA1}
509(r(16611))},47467:(e,t,r)=>{"use strict";e.exports=function(e){var t,r,i,n,s,o;return r=(t=e.x64).Word,i=t.WordArray,s=(n=e.algo).SHA512,o=n.SHA384=s.extend({_doReset:function(){this._hash=new i.init([new r.init(0xcbbb9d5d,0xc1059ed8),new r.init(0x629a292a,0x367cd507),new r.init(0x9159015a,0x3070dd17),new r.init(0x152fecd8,0xf70e5939),new r.init(0x67332667,0xffc00b31),new r.init(0x8eb44a87,0x68581511),new r.init(0xdb0c2e0d,0x64f98fa7),new r.init(0x47b5481d,0xbefa4fa4)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}}),e.SHA384=s._createHelper(o),e.HmacSHA384=s._createHmacHelper(o),e.SHA384}(r(16611),r(38530),r(67626))},47887:(e,t,r)=>{"use strict";t.sha1=r(48247),t.sha224=r(15612),t.sha256=r(40709),t.sha384=r(22633),t.sha512=r(31e3)},48247:(e,t,r)=>{"use strict";var i=r(20920),n=r(64874),s=r(4117),o=i.rotl32,a=i.sum32,c=i.sum32_5,l=s.ft_1,h=n.BlockHash,u=[0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xca62c1d6];function d(){if(!(this instanceof d))return new d;h.call(this),this.h=[0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0],this.W=Array(80)}i.inherits(d,h),e.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=o(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],s=this.h[1],h=this.h[2],d=this.h[3],f=this.h[4];for(i=0;i<r.length;i++){var p=~~(i/20),g=c(o(n,5),l(p,s,h,d),f,r[i],u[p]);f=d,d=h,h=o(s,30),s=n,n=g}this.h[0]=a(this.h[0],n),this.h[1]=a(this.h[1],s),this.h[2]=a(this.h[2],h),this.h[3]=a(this.h[3],d),this.h[4]=a(this.h[4],f)},d.prototype._digest=function(e){return"hex"===e?i.toHex32(this.h,"big"):i.split32(this.h,"big")}},48543:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.delay=void 0,t.delay=function(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}},48945:(e,t,r)=>{var i=r(81029),n=i.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(s(i,t),t.Buffer=o),o.prototype=Object.create(n.prototype),s(n,o),o.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return n(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return n(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i.SlowBuffer(e)}},48981:(e,t,r)=>{"use strict";r.d(t,{g:()=>f});var i=r(67934),n=r(55480),s=r(58653),o=r(72880),a=r(12319),c=r(88097),l=r(67695),h=r(66254),u=r(79355),d=r(18635);let f={getConnectorsByType(e,t,r){let{customWallets:i}=n.H.state,o=s.i.getRecentWallets(),a=d.A.filterOutDuplicateWallets(t),c=d.A.filterOutDuplicateWallets(r),l=e.filter(e=>"MULTI_CHAIN"===e.type),h=e.filter(e=>"ANNOUNCED"===e.type),u=e.filter(e=>"INJECTED"===e.type);return{custom:i,recent:o,external:e.filter(e=>"EXTERNAL"===e.type),multiChain:l,announced:h,injected:u,recommended:a,featured:c}},showConnector(e){let t=e.info?.rdns,r=!!t&&o.N.state.excludedWallets.some(e=>e.rdns===t),i=!!e.name&&o.N.state.excludedWallets.some(t=>u.y.isLowerCaseMatch(t.name,e.name));return("INJECTED"!==e.type||(!!a.w.isMobile()||"Browser Wallet"!==e.name)&&(!!t||!!c.x.checkInstalled())&&!r&&!i)&&("ANNOUNCED"!==e.type||!r&&!i)},getIsConnectedWithWC:()=>Array.from(l.W.state.chains.values()).some(e=>h.a.getConnectorId(e.namespace)===i.o.CONNECTOR_ID.WALLET_CONNECT),getConnectorTypeOrder({recommended:e,featured:t,custom:r,recent:i,announced:s,injected:o,multiChain:a,external:c,overriddenConnectors:l=n.H.state.features?.connectorTypeOrder??[]}){let h=f.getIsConnectedWithWC(),u=[{type:"walletConnect",isEnabled:n.H.state.enableWalletConnect&&!h},{type:"recent",isEnabled:i.length>0},{type:"injected",isEnabled:[...o,...s,...a].length>0},{type:"featured",isEnabled:t.length>0},{type:"custom",isEnabled:r&&r.length>0},{type:"external",isEnabled:c.length>0},{type:"recommended",isEnabled:e.length>0}].filter(e=>e.isEnabled),d=new Set(u.map(e=>e.type)),p=l.filter(e=>d.has(e)).map(e=>({type:e,isEnabled:!0})),g=u.filter(({type:e})=>!p.some(({type:t})=>t===e));return Array.from(new Set([...p,...g].map(({type:e})=>e)))}}},49327:(e,t,r)=>{"use strict";e.exports=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();
509function r(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var o=0;o<r;o++)e[t+o]^=n[o]}return t.Encryptor=t.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize;r.call(this,e,t,n,i),this._prevBlock=e.slice(t,t+n)}}),t.Decryptor=t.extend({processBlock:function(e,t){var i=this._cipher,n=i.blockSize,s=e.slice(t,t+n);r.call(this,e,t,n,i),this._prevBlock=s}}),t}(),e.mode.CFB}(r(16611),r(99229))},50155:(e,t,r)=>{"use strict";r.d(t,{IJsonRpcProvider:()=>o.kF,formatJsonRpcError:()=>s.dZ,formatJsonRpcRequest:()=>s.e_,formatJsonRpcResult:()=>s.Im,getBigIntRpcId:()=>s.eX,isHttpUrl:()=>a.q$,isJsonRpcError:()=>c.U$,isJsonRpcRequest:()=>c.p3,isJsonRpcResponse:()=>c.tq,isJsonRpcResult:()=>c.xT,isLocalhostUrl:()=>a.z,isWsUrl:()=>a.A1,parseConnectionError:()=>i.eF,payloadId:()=>s.ER}),r(55402);var i=r(92153),n=r(10824);r.o(n,"IJsonRpcProvider")&&r.d(t,{IJsonRpcProvider:function(){return n.IJsonRpcProvider}}),r.o(n,"formatJsonRpcError")&&r.d(t,{formatJsonRpcError:function(){return n.formatJsonRpcError}}),r.o(n,"formatJsonRpcRequest")&&r.d(t,{formatJsonRpcRequest:function(){return n.formatJsonRpcRequest}}),r.o(n,"formatJsonRpcResult")&&r.d(t,{formatJsonRpcResult:function(){return n.formatJsonRpcResult}}),r.o(n,"getBigIntRpcId")&&r.d(t,{getBigIntRpcId:function(){return n.getBigIntRpcId}}),r.o(n,"isHttpUrl")&&r.d(t,{isHttpUrl:function(){return n.isHttpUrl}}),r.o(n,"isJsonRpcError")&&r.d(t,{isJsonRpcError:function(){return n.isJsonRpcError}}),r.o(n,"isJsonRpcRequest")&&r.d(t,{isJsonRpcRequest:function(){return n.isJsonRpcRequest}}),r.o(n,"isJsonRpcResponse")&&r.d(t,{isJsonRpcResponse:function(){return n.isJsonRpcResponse}}),r.o(n,"isJsonRpcResult")&&r.d(t,{isJsonRpcResult:function(){return n.isJsonRpcResult}}),r.o(n,"isLocalhostUrl")&&r.d(t,{isLocalhostUrl:function(){return n.isLocalhostUrl}}),r.o(n,"isReactNative")&&r.d(t,{isReactNative:function(){return n.isReactNative}}),r.o(n,"isWsUrl")&&r.d(t,{isWsUrl:function(){return n.isWsUrl}}),r.o(n,"payloadId")&&r.d(t,{payloadId:function(){return n.payloadId}});var s=r(89530),o=r(22926),a=r(94754),c=r(46186)},50786:function(e,t,r){!function(e,t){"use strict";function i(e,t){if(!e)throw Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function s(e,t,r){if(s.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&(("le"===t||"be"===t)&&(r=t,t=10),this._init(e||0,t||10,r||"be"))}
vendor: 34,349 bytes, line 509
509"object"==typeof e?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{u="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(47790).Buffer}catch(e){}function o(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+e)}function a(e,t,r){var i=o(e,r);return r-1>=t&&(i|=o(e,r-1)<<4),i}function c(e,t,r,n){for(var s=0,o=0,a=Math.min(e.length,r),c=t;c<a;c++){var l=e.charCodeAt(c)-48;s*=n,o=l>=49?l-49+10:l>=17?l-17+10:l,i(l>=0&&o<n,"Invalid character"),s+=o}return s}function l(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(s.isBN=function(e){return e instanceof s||null!==e&&"object"==typeof e&&e.constructor.wordSize===s.wordSize&&Array.isArray(e.words)},s.max=function(e,t){return e.cmp(t)>0?e:t},s.min=function(e,t){return 0>e.cmp(t)?e:t},s.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},s.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<0x4000000?(this.words=[0x3ffffff&e],this.length=1):e<0x10000000000000?(this.words=[0x3ffffff&e,e/0x4000000&0x3ffffff],this.length=2):(i(e<0x20000000000000),this.words=[0x3ffffff&e,e/0x4000000&0x3ffffff,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},s.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=Array(this.length);for(var n,s,o=0;o<this.length;o++)this.words[o]=0;var a=0;if("be"===r)for(o=e.length-1,n=0;o>=0;o-=3)s=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[n]|=s<<a&0x3ffffff,this.words[n+1]=s>>>26-a&0x3ffffff,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(o=0,n=0;o<e.length;o+=3)s=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[n]|=s<<a&0x3ffffff,this.words[n+1]=s>>>26-a&0x3ffffff,(a+=24)>=26&&(a-=26,n++);return this._strip()},s.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var i,n=0;n<this.length;n++)this.words[n]=0;var s=0,o=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=a(e,t,n)<<s,this.words[o]|=0x3ffffff&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=a(e,t,n)<<s,this.words[o]|=0x3ffffff&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;this._strip()},s.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=0x3ffffff;n*=t)i++;i--,n=n/t|0;for(var s=e.length-r,o=s%i,a=Math.min(s,s-o)+r,l=0,h=r;h<a;h+=i)l=c(e,h,h+i,t),this.imuln(n),this.words[0]+l<0x4000000?this.words[0]+=l:this._iaddn(l);if(0!==o){var u=1;for(l=c(e,h,e.length,t),h=0;h<o;h++)u*=t;this.imuln(u),this.words[0]+l<0x4000000?this.words[0]+=l:this._iaddn(l)}this._strip()},s.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},s.prototype._move=function(e){l(e,this)},s.prototype.clone=function(){var e=new s(null);return this.copy(e),e},s.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(e){s.prototype.inspect=h}else s.prototype.inspect=h;function h(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var u,d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],f=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,0x2000000,0x290d741,0x1000000,0x2e90edd,0x39aa400,0x267bf47,0x1000000,0x290d741,1e7,0x12959c3,0x222c000,0x3bd7765,7529536,0xadcea1,0x1000000,0x1704f61,0x206fc40,0x2cddcf9,64e6,4084101,5153632,6436343,7962624,9765625,0xb54ba0,0xdaf26b,0x1069c00,0x138f9ad,243e5,0x1b4d89f,0x2000000,0x25528a1,0x2b54a20,0x3216b93,0x39aa400];function g(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],s=0|t.words[0],o=n*s,a=0x3ffffff&o,c=o/0x4000000|0;r.words[0]=a;for(var l=1;l<i;l++){for(var h=c>>>26,u=0x3ffffff&c,d=Math.min(l,t.length-1),f=Math.max(0,l-e.length+1);f<=d;f++){var p=l-f|0;h+=(o=(n=0|e.words[p])*(s=0|t.words[f])+u)/0x4000000|0,u=0x3ffffff&o}r.words[l]=0|u,c=0|h}return 0!==c?r.words[l]=0|c:r.length--,r._strip()}s.prototype.toString=function(e,t){if(t=0|t||1,16===(e=e||10)||"hex"===e){for(var r="",n=0,s=0,o=0;o<this.length;o++){var a=this.words[o],c=((a<<n|s)&0xffffff).toString(16);s=a>>>24-n&0xffffff,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?d[6-c.length]+c+r:c+r}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=f[e],h=p[e];r="";var u=this.clone();for(u.negative=0;!u.isZero();){var g=u.modrn(h).toString(e);r=(u=u.idivn(h)).isZero()?g+r:d[l-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=0x4000000*this.words[1]:3===this.length&&1===this.words[2]?e+=0x10000000000000+0x4000000*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},s.prototype.toJSON=function(){return this.toString(16,2)},u&&(s.prototype.toBuffer=function(e,t){return this.toArrayLike(u,e,t)}),s.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},s.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,"byte array longer than desired length"),i(s>0,"Requested array length <= 0");var o=e.allocUnsafe?e.allocUnsafe(s):new e(s);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,n),o},s.prototype._toArrayLikeLE=function(e,t){for(var r=0,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;e[r++]=255&o,r<e.length&&(e[r++]=o>>8&255),r<e.length&&(e[r++]=o>>16&255),6===s?(r<e.length&&(e[r++]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r<e.length)for(e[r++]=i;r<e.length;)e[r++]=0},s.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;e[r--]=255&o,r>=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===s?(r>=0&&(e[r--]=o>>24&255),i=0,s=0):(i=o>>>24,s+=2)}if(r>=0)for(e[r--]=i;r>=0;)e[r--]=0},Math.clz32?s.prototype._countBits=function(e){return 32-Math.clz32(e)}:s.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},s.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return(8191&t)==0&&(r+=13,t>>>=13),(127&t)==0&&(r+=7,t>>>=7),(15&t)==0&&(r+=4,t>>>=4),(3&t)==0&&(r+=2,t>>>=2),(1&t)==0&&r++,r},s.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},s.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},s.prototype.ior=function(e){return i((this.negative|e.negative)==0),this.iuor(e)},s.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},s.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},s.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},s.prototype.iand=function(e){return i((this.negative|e.negative)==0),this.iuand(e)},s.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},s.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},s.prototype.iuxor=function(e){this.length>e.length?(t=this,r=e):(t=e,r=this);for(var t,r,i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this._strip()},s.prototype.ixor=function(e){return i((this.negative|e.negative)==0),this.iuxor(e)},s.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},s.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},s.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=0x3ffffff&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&0x3ffffff>>26-r),this._strip()},s.prototype.notn=function(e){return this.clone().inotn(e)},s.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<<n:this.words[r]=this.words[r]&~(1<<n),this._strip()},s.prototype.iadd=function(e){if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var t,r,i,n=0,s=0;s<i.length;s++)t=(0|r.words[s])+(0|i.words[s])+n,this.words[s]=0x3ffffff&t,n=t>>>26;for(;0!==n&&s<r.length;s++)t=(0|r.words[s])+n,this.words[s]=0x3ffffff&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},s.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},s.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t,r,i=this.iadd(e);return e.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(t=this,r=e):(t=e,r=this);for(var s=0,o=0;o<r.length;o++)s=(i=(0|t.words[o])-(0|r.words[o])+s)>>26,this.words[o]=0x3ffffff&i;for(;0!==s&&o<t.length;o++)s=(i=(0|t.words[o])+s)>>26,this.words[o]=0x3ffffff&i;if(0===s&&o<t.length&&t!==this)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=Math.max(this.length,o),t!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,r){var i,n,s,o=e.words,a=t.words,c=r.words,l=0,h=0|o[0],u=8191&h,d=h>>>13,f=0|o[1],p=8191&f,g=f>>>13,m=0|o[2],y=8191&m,b=m>>>13,w=0|o[3],v=8191&w,x=w>>>13,E=0|o[4],_=8191&E,I=E>>>13,A=0|o[5],S=8191&A,C=A>>>13,N=0|o[6],O=8191&N,P=N>>>13,T=0|o[7],M=8191&T,R=T>>>13,k=0|o[8],D=8191&k,L=k>>>13,U=0|o[9],B=8191&U,j=U>>>13,$=0|a[0],z=8191&$,q=$>>>13,H=0|a[1],F=8191&H,W=H>>>13,V=0|a[2],K=8191&V,G=V>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Q=0|a[4],Z=8191&Q,ee=Q>>>13,et=0|a[5],er=8191&et,ei=et>>>13,en=0|a[6],es=8191&en,eo=en>>>13,ea=0|a[7],ec=8191&ea,el=ea>>>13,eh=0|a[8],eu=8191&eh,ed=eh>>>13,ef=0|a[9],ep=8191&ef,eg=ef>>>13;r.negative=e.negative^t.negative,r.length=19,i=Math.imul(u,z);var em=(l+i|0)+((8191&(n=(n=Math.imul(u,q))+Math.imul(d,z)|0))<<13)|0;l=((s=Math.imul(d,q))+(n>>>13)|0)+(em>>>26)|0,em&=0x3ffffff,i=Math.imul(p,z),n=(n=Math.imul(p,q))+Math.imul(g,z)|0,s=Math.imul(g,q),i=i+Math.imul(u,F)|0;var ey=(l+i|0)+((8191&(n=(n=n+Math.imul(u,W)|0)+Math.imul(d,F)|0))<<13)|0;l=((s=s+Math.imul(d,W)|0)+(n>>>13)|0)+(ey>>>26)|0,ey&=0x3ffffff,i=Math.imul(y,z),n=(n=Math.imul(y,q))+Math.imul(b,z)|0,s=Math.imul(b,q),i=i+Math.imul(p,F)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(g,F)|0,s=s+Math.imul(g,W)|0,i=i+Math.imul(u,K)|0;var eb=(l+i|0)+((8191&(n=(n=n+Math.imul(u,G)|0)+Math.imul(d,K)|0))<<13)|0;l=((s=s+Math.imul(d,G)|0)+(n>>>13)|0)+(eb>>>26)|0,eb&=0x3ffffff,i=Math.imul(v,z),n=(n=Math.imul(v,q))+Math.imul(x,z)|0,s=Math.imul(x,q),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,F)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(g,K)|0,s=s+Math.imul(g,G)|0,i=i+Math.imul(u,J)|0;var ew=(l+i|0)+((8191&(n=(n=n+Math.imul(u,X)|0)+Math.imul(d,J)|0))<<13)|0;l=((s=s+Math.imul(d,X)|0)+(n>>>13)|0)+(ew>>>26)|0,ew&=0x3ffffff,i=Math.imul(_,z),n=(n=Math.imul(_,q))+Math.imul(I,z)|0,s=Math.imul(I,q),i=i+Math.imul(v,F)|0,n=(n=n+Math.imul(v,W)|0)+Math.imul(x,F)|0,s=s+Math.imul(x,W)|0,i=i+Math.imul(y,K)|0,n=(n=n+Math.imul(y,G)|0)+Math.imul(b,K)|0,s=s+Math.imul(b,G)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(g,J)|0,s=s+Math.imul(g,X)|0,i=i+Math.imul(u,Z)|0;var ev=(l+i|0)+((8191&(n=(n=n+Math.imul(u,ee)|0)+Math.imul(d,Z)|0))<<13)|0;l=((s=s+Math.imul(d,ee)|0)+(n>>>13)|0)+(ev>>>26)|0,ev&=0x3ffffff,i=Math.imul(S,z),n=(n=Math.imul(S,q))+Math.imul(C,z)|0,s=Math.imul(C,q),i=i+Math.imul(_,F)|0,n=(n=n+Math.imul(_,W)|0)+Math.imul(I,F)|0,s=s+Math.imul(I,W)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,G)|0)+Math.imul(x,K)|0,s=s+Math.imul(x,G)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(b,J)|0,s=s+Math.imul(b,X)|0,i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(g,Z)|0,s=s+Math.imul(g,ee)|0,i=i+Math.imul(u,er)|0;var ex=(l+i|0)+((8191&(n=(n=n+Math.imul(u,ei)|0)+Math.imul(d,er)|0))<<13)|0;l=((s=s+Math.imul(d,ei)|0)+(n>>>13)|0)+(ex>>>26)|0,ex&=0x3ffffff,i=Math.imul(O,z),n=(n=Math.imul(O,q))+Math.imul(P,z)|0,s=Math.imul(P,q),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(C,F)|0,s=s+Math.imul(C,W)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,G)|0)+Math.imul(I,K)|0,s=s+Math.imul(I,G)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,X)|0)+Math.imul(x,J)|0,s=s+Math.imul(x,X)|0,i=i+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,ee)|0)+Math.imul(b,Z)|0,s=s+Math.imul(b,ee)|0,i=i+Math.imul(p,er)|0,n=(n=n+Math.imul(p,ei)|0)+Math.imul(g,er)|0,s=s+Math.imul(g,ei)|0,i=i+Math.imul(u,es)|0;var eE=(l+i|0)+((8191&(n=(n=n+Math.imul(u,eo)|0)+Math.imul(d,es)|0))<<13)|0;l=((s=s+Math.imul(d,eo)|0)+(n>>>13)|0)+(eE>>>26)|0,eE&=0x3ffffff,i=Math.imul(M,z),n=(n=Math.imul(M,q))+Math.imul(R,z)|0,s=Math.imul(R,q),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(P,F)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,G)|0)+Math.imul(C,K)|0,s=s+Math.imul(C,G)|0,i=i+Math.imul(_,J)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(I,J)|0,s=s+Math.imul(I,X)|0,i=i+Math.imul(v,Z)|0,n=(n=n+Math.imul(v,ee)|0)+Math.imul(x,Z)|0,s=s+Math.imul(x,ee)|0,i=i+Math.imul(y,er)|0,n=(n=n+Math.imul(y,ei)|0)+Math.imul(b,er)|0,s=s+Math.imul(b,ei)|0,i=i+Math.imul(p,es)|0,n=(n=n+Math.imul(p,eo)|0)+Math.imul(g,es)|0,s=s+Math.imul(g,eo)|0,i=i+Math.imul(u,ec)|0;var e_=(l+i|0)+((8191&(n=(n=n+Math.imul(u,el)|0)+Math.imul(d,ec)|0))<<13)|0;l=((s=s+Math.imul(d,el)|0)+(n>>>13)|0)+(e_>>>26)|0,e_&=0x3ffffff,i=Math.imul(D,z),n=(n=Math.imul(D,q))+Math.imul(L,z)|0,s=Math.imul(L,q),i=i+Math.imul(M,F)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(R,F)|0,s=s+Math.imul(R,W)|0,i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,G)|0)+Math.imul(P,K)|0,s=s+Math.imul(P,G)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(C,J)|0,s=s+Math.imul(C,X)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(I,Z)|0,s=s+Math.imul(I,ee)|0,i=i+Math.imul(v,er)|0,n=(n=n+Math.imul(v,ei)|0)+Math.imul(x,er)|0,s=s+Math.imul(x,ei)|0,i=i+Math.imul(y,es)|0,n=(n=n+Math.imul(y,eo)|0)+Math.imul(b,es)|0,s=s+Math.imul(b,eo)|0,i=i+Math.imul(p,ec)|0,n=(n=n+Math.imul(p,el)|0)+Math.imul(g,ec)|0,s=s+Math.imul(g,el)|0,i=i+Math.imul(u,eu)|0;var eI=(l+i|0)+((8191&(n=(n=n+Math.imul(u,ed)|0)+Math.imul(d,eu)|0))<<13)|0;l=((s=s+Math.imul(d,ed)|0)+(n>>>13)|0)+(eI>>>26)|0,eI&=0x3ffffff,i=Math.imul(B,z),n=(n=Math.imul(B,q))+Math.imul(j,z)|0,s=Math.imul(j,q),i=i+Math.imul(D,F)|0,n=(n=n+Math.imul(D,W)|0)+Math.imul(L,F)|0,s=s+Math.imul(L,W)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,G)|0)+Math.imul(R,K)|0,s=s+Math.imul(R,G)|0,i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(P,J)|0,s=s+Math.imul(P,X)|0,i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(C,Z)|0,s=s+Math.imul(C,ee)|0,i=i+Math.imul(_,er)|0,n=(n=n+Math.imul(_,ei)|0)+Math.imul(I,er)|0,s=s+Math.imul(I,ei)|0,i=i+Math.imul(v,es)|0,n=(n=n+Math.imul(v,eo)|0)+Math.imul(x,es)|0,s=s+Math.imul(x,eo)|0,i=i+Math.imul(y,ec)|0,n=(n=n+Math.imul(y,el)|0)+Math.imul(b,ec)|0,s=s+Math.imul(b,el)|0,i=i+Math.imul(p,eu)|0,n=(n=n+Math.imul(p,ed)|0)+Math.imul(g,eu)|0,s=s+Math.imul(g,ed)|0,i=i+Math.imul(u,ep)|0;var eA=(l+i|0)+((8191&(n=(n=n+Math.imul(u,eg)|0)+Math.imul(d,ep)|0))<<13)|0;l=((s=s+Math.imul(d,eg)|0)+(n>>>13)|0)+(eA>>>26)|0,eA&=0x3ffffff,i=Math.imul(B,F),n=(n=Math.imul(B,W))+Math.imul(j,F)|0,s=Math.imul(j,W),i=i+Math.imul(D,K)|0,n=(n=n+Math.imul(D,G)|0)+Math.imul(L,K)|0,s=s+Math.imul(L,G)|0,i=i+Math.imul(M,J)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(R,J)|0,s=s+Math.imul(R,X)|0,i=i+Math.imul(O,Z)|0,n=(n=n+Math.imul(O,ee)|0)+Math.imul(P,Z)|0,s=s+Math.imul(P,ee)|0,i=i+Math.imul(S,er)|0,n=(n=n+Math.imul(S,ei)|0)+Math.imul(C,er)|0,s=s+Math.imul(C,ei)|0,i=i+Math.imul(_,es)|0,n=(n=n+Math.imul(_,eo)|0)+Math.imul(I,es)|0,s=s+Math.imul(I,eo)|0,i=i+Math.imul(v,ec)|0,n=(n=n+Math.imul(v,el)|0)+Math.imul(x,ec)|0,s=s+Math.imul(x,el)|0,i=i+Math.imul(y,eu)|0,n=(n=n+Math.imul(y,ed)|0)+Math.imul(b,eu)|0,s=s+Math.imul(b,ed)|0,i=i+Math.imul(p,ep)|0;var eS=(l+i|0)+((8191&(n=(n=n+Math.imul(p,eg)|0)+Math.imul(g,ep)|0))<<13)|0;l=((s=s+Math.imul(g,eg)|0)+(n>>>13)|0)+(eS>>>26)|0,eS&=0x3ffffff,i=Math.imul(B,K),n=(n=Math.imul(B,G))+Math.imul(j,K)|0,s=Math.imul(j,G),i=i+Math.imul(D,J)|0,n=(n=n+Math.imul(D,X)|0)+Math.imul(L,J)|0,s=s+Math.imul(L,X)|0,i=i+Math.imul(M,Z)|0,n=(n=n+Math.imul(M,ee)|0)+Math.imul(R,Z)|0,s=s+Math.imul(R,ee)|0,i=i+Math.imul(O,er)|0,n=(n=n+Math.imul(O,ei)|0)+Math.imul(P,er)|0,s=s+Math.imul(P,ei)|0,i=i+Math.imul(S,es)|0,n=(n=n+Math.imul(S,eo)|0)+Math.imul(C,es)|0,s=s+Math.imul(C,eo)|0,i=i+Math.imul(_,ec)|0,n=(n=n+Math.imul(_,el)|0)+Math.imul(I,ec)|0,s=s+Math.imul(I,el)|0,i=i+Math.imul(v,eu)|0,n=(n=n+Math.imul(v,ed)|0)+Math.imul(x,eu)|0,s=s+Math.imul(x,ed)|0,i=i+Math.imul(y,ep)|0;var eC=(l+i|0)+((8191&(n=(n=n+Math.imul(y,eg)|0)+Math.imul(b,ep)|0))<<13)|0;l=((s=s+Math.imul(b,eg)|0)+(n>>>13)|0)+(eC>>>26)|0,eC&=0x3ffffff,i=Math.imul(B,J),n=(n=Math.imul(B,X))+Math.imul(j,J)|0,s=Math.imul(j,X),i=i+Math.imul(D,Z)|0,n=(n=n+Math.imul(D,ee)|0)+Math.imul(L,Z)|0,s=s+Math.imul(L,ee)|0,i=i+Math.imul(M,er)|0,n=(n=n+Math.imul(M,ei)|0)+Math.imul(R,er)|0,s=s+Math.imul(R,ei)|0,i=i+Math.imul(O,es)|0,n=(n=n+Math.imul(O,eo)|0)+Math.imul(P,es)|0,s=s+Math.imul(P,eo)|0,i=i+Math.imul(S,ec)|0,n=(n=n+Math.imul(S,el)|0)+Math.imul(C,ec)|0,s=s+Math.imul(C,el)|0,i=i+Math.imul(_,eu)|0,n=(n=n+Math.imul(_,ed)|0)+Math.imul(I,eu)|0,s=s+Math.imul(I,ed)|0,i=i+Math.imul(v,ep)|0;var eN=(l+i|0)+((8191&(n=(n=n+Math.imul(v,eg)|0)+Math.imul(x,ep)|0))<<13)|0;l=((s=s+Math.imul(x,eg)|0)+(n>>>13)|0)+(eN>>>26)|0,eN&=0x3ffffff,i=Math.imul(B,Z),n=(n=Math.imul(B,ee))+Math.imul(j,Z)|0,s=Math.imul(j,ee),i=i+Math.imul(D,er)|0,n=(n=n+Math.imul(D,ei)|0)+Math.imul(L,er)|0,s=s+Math.imul(L,ei)|0,i=i+Math.imul(M,es)|0,n=(n=n+Math.imul(M,eo)|0)+Math.imul(R,es)|0,s=s+Math.imul(R,eo)|0,i=i+Math.imul(O,ec)|0,n=(n=n+Math.imul(O,el)|0)+Math.imul(P,ec)|0,s=s+Math.imul(P,el)|0,i=i+Math.imul(S,eu)|0,n=(n=n+Math.imul(S,ed)|0)+Math.imul(C,eu)|0,s=s+Math.imul(C,ed)|0,i=i+Math.imul(_,ep)|0;var eO=(l+i|0)+((8191&(n=(n=n+Math.imul(_,eg)|0)+Math.imul(I,ep)|0))<<13)|0;l=((s=s+Math.imul(I,eg)|0)+(n>>>13)|0)+(eO>>>26)|0,eO&=0x3ffffff,i=Math.imul(B,er),n=(n=Math.imul(B,ei))+Math.imul(j,er)|0,s=Math.imul(j,ei),i=i+Math.imul(D,es)|0,n=(n=n+Math.imul(D,eo)|0)+Math.imul(L,es)|0,s=s+Math.imul(L,eo)|0,i=i+Math.imul(M,ec)|0,n=(n=n+Math.imul(M,el)|0)+Math.imul(R,ec)|0,s=s+Math.imul(R,el)|0,i=i+Math.imul(O,eu)|0,n=(n=n+Math.imul(O,ed)|0)+Math.imul(P,eu)|0,s=s+Math.imul(P,ed)|0,i=i+Math.imul(S,ep)|0;var eP=(l+i|0)+((8191&(n=(n=n+Math.imul(S,eg)|0)+Math.imul(C,ep)|0))<<13)|0;l=((s=s+Math.imul(C,eg)|0)+(n>>>13)|0)+(eP>>>26)|0,eP&=0x3ffffff,i=Math.imul(B,es),n=(n=Math.imul(B,eo))+Math.imul(j,es)|0,s=Math.imul(j,eo),i=i+Math.imul(D,ec)|0,n=(n=n+Math.imul(D,el)|0)+Math.imul(L,ec)|0,s=s+Math.imul(L,el)|0,i=i+Math.imul(M,eu)|0,n=(n=n+Math.imul(M,ed)|0)+Math.imul(R,eu)|0,s=s+Math.imul(R,ed)|0,i=i+Math.imul(O,ep)|0;var eT=(l+i|0)+((8191&(n=(n=n+Math.imul(O,eg)|0)+Math.imul(P,ep)|0))<<13)|0;l=((s=s+Math.imul(P,eg)|0)+(n>>>13)|0)+(eT>>>26)|0,eT&=0x3ffffff,i=Math.imul(B,ec),n=(n=Math.imul(B,el))+Math.imul(j,ec)|0,s=Math.imul(j,el),i=i+Math.imul(D,eu)|0,n=(n=n+Math.imul(D,ed)|0)+Math.imul(L,eu)|0,s=s+Math.imul(L,ed)|0,i=i+Math.imul(M,ep)|0;var eM=(l+i|0)+((8191&(n=(n=n+Math.imul(M,eg)|0)+Math.imul(R,ep)|0))<<13)|0;l=((s=s+Math.imul(R,eg)|0)+(n>>>13)|0)+(eM>>>26)|0,eM&=0x3ffffff,i=Math.imul(B,eu),n=(n=Math.imul(B,ed))+Math.imul(j,eu)|0,s=Math.imul(j,ed),i=i+Math.imul(D,ep)|0;var eR=(l+i|0)+((8191&(n=(n=n+Math.imul(D,eg)|0)+Math.imul(L,ep)|0))<<13)|0;l=((s=s+Math.imul(L,eg)|0)+(n>>>13)|0)+(eR>>>26)|0,eR&=0x3ffffff,i=Math.imul(B,ep);var ek=(l+i|0)+((8191&(n=(n=Math.imul(B,eg))+Math.imul(j,ep)|0))<<13)|0;return l=((s=Math.imul(j,eg))+(n>>>13)|0)+(ek>>>26)|0,ek&=0x3ffffff,c[0]=em,c[1]=ey,c[2]=eb,c[3]=ew,c[4]=ev,c[5]=ex,c[6]=eE,c[7]=e_,c[8]=eI,c[9]=eA,c[10]=eS,c[11]=eC,c[12]=eN,c[13]=eO,c[14]=eP,c[15]=eT,c[16]=eM,c[17]=eR,c[18]=ek,0!==l&&(c[19]=l,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,s=0;s<r.length-1;s++){var o=n;n=0;for(var a=0x3ffffff&i,c=Math.min(s,t.length-1),l=Math.max(0,s-e.length+1);l<=c;l++){var h=s-l,u=(0|e.words[h])*(0|t.words[l]),d=0x3ffffff&u;o=o+(u/0x4000000|0)|0,a=0x3ffffff&(d=d+a|0),n+=(o=o+(d>>>26)|0)>>>26,o&=0x3ffffff}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r._strip()}function b(e,t){this.x=e,this.y=t}Math.imul||(m=g),s.prototype.mulTo=function(e,t){var r,i=this.length+e.length;return 10===this.length&&10===e.length?r=m(this,e,t):i<63?r=g(this,e,t):r=y(this,e,t),r},b.prototype.makeRBT=function(e){for(var t=Array(e),r=s.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},b.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},b.prototype.permute=function(e,t,r,i,n,s){for(var o=0;o<s;o++)i[o]=t[e[o]],n[o]=r[e[o]]},b.prototype.transform=function(e,t,r,i,n,s){this.permute(s,e,t,r,i,n);for(var o=1;o<n;o<<=1)for(var a=o<<1,c=Math.cos(2*Math.PI/a),l=Math.sin(2*Math.PI/a),h=0;h<n;h+=a)for(var u=c,d=l,f=0;f<o;f++){var p=r[h+f],g=i[h+f],m=r[h+f+o],y=i[h+f+o],b=u*m-d*y;y=u*y+d*m,m=b,r[h+f]=p+m,i[h+f]=g+y,r[h+f+o]=p-m,i[h+f+o]=g-y,f!==a&&(b=c*u-l*d,d=c*d+l*u,u=b)}},b.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},b.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},b.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=0x3ffffff&n,r=n<0x4000000?0:n/0x4000000|0}return e},b.prototype.convert13b=function(e,t,r,n){for(var s=0,o=0;o<t;o++)s+=0|e[o],r[2*o]=8191&s,s>>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*t;o<n;++o)r[o]=0;i(0===s),i((-8192&s)==0)},b.prototype.stub=function(e){for(var t=Array(e),r=0;r<e;r++)t[r]=0;return t},b.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),s=this.stub(i),o=Array(i),a=Array(i),c=Array(i),l=Array(i),h=Array(i),u=Array(i),d=r.words;d.length=i,this.convert13b(e.words,e.length,o,i),this.convert13b(t.words,t.length,l,i),this.transform(o,s,a,c,i,n),this.transform(l,s,h,u,i,n);for(var f=0;f<i;f++){var p=a[f]*h[f]-c[f]*u[f];c[f]=a[f]*u[f]+c[f]*h[f],a[f]=p}return this.conjugate(a,c,i),this.transform(a,c,d,s,i,n),this.conjugate(d,s,i),this.normalize13b(d,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r._strip()},s.prototype.mul=function(e){var t=new s(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},s.prototype.mulf=function(e){var t=new s(null);return t.words=Array(this.length+e.length),y(this,e,t)},s.prototype.imul=function(e){return this.clone().mulTo(e,this)},s.prototype.imuln=function(e){var t=e<0;t&&(e=-e),i("number"==typeof e),i(e<0x4000000);for(var r=0,n=0;n<this.length;n++){var s=(0|this.words[n])*e,o=(0x3ffffff&s)+(0x3ffffff&r);r>>=26,r+=(s/0x4000000|0)+(o>>>26),this.words[n]=0x3ffffff&o}return 0!==r&&(this.words[n]=r,this.length++),this.length=0===e?1:this.length,t?this.ineg():this},s.prototype.muln=function(e){return this.clone().imuln(e)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=e.words[i]>>>n&1}return t}(e);if(0===t.length)return new s(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},s.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,s=0x3ffffff>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t<this.length;t++){var a=this.words[t]&s,c=(0|this.words[t])-a<<r;this.words[t]=c|o,o=a>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this._strip()},s.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},s.prototype.iushrn=function(e,t,r){i("number"==typeof e&&e>=0);var n=t?(t-t%26)/26:0,s=e%26,o=Math.min((e-s)/26,this.length),a=0x3ffffff^0x3ffffff>>>s<<s;if(n-=o,n=Math.max(0,n),r){for(var c=0;c<o;c++)r.words[c]=this.words[c];r.length=o}if(0===o);else if(this.length>o)for(this.length-=o,c=0;c<this.length;c++)this.words[c]=this.words[c+o];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=n);c--){var h=0|this.words[c];this.words[c]=l<<26-s|h>>>s,l=h&a}return r&&0!==l&&(r.words[r.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},s.prototype.shln=function(e){return this.clone().ishln(e)},s.prototype.ushln=function(e){return this.clone().iushln(e)},s.prototype.shrn=function(e){return this.clone().ishrn(e)},s.prototype.ushrn=function(e){return this.clone().iushrn(e)},s.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return!(this.length<=r)&&!!(this.words[r]&1<<t)},s.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==t&&r++,this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=0x3ffffff^0x3ffffff>>>t<<t),0===this.length&&(this.words[0]=0,this.length=1),this._strip())},s.prototype.maskn=function(e){return this.clone().imaskn(e)},s.prototype.iaddn=function(e){return(i("number"==typeof e),i(e<0x4000000),e<0)?this.isubn(-e):0!==this.negative?(1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0):(this.negative=0,this.isubn(e),this.negative=1),this):this._iaddn(e)},s.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=0x4000000;t++)this.words[t]-=0x4000000,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},s.prototype.isubn=function(e){if(i("number"==typeof e),i(e<0x4000000),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=0x4000000,this.words[t+1]-=1;return this._strip()},s.prototype.addn=function(e){return this.clone().iaddn(e)},s.prototype.subn=function(e){return this.clone().isubn(e)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(e,t,r){var n,s,o=e.length+r;this._expand(o);var a=0;for(n=0;n<e.length;n++){s=(0|this.words[n+r])+a;var c=(0|e.words[n])*t;s-=0x3ffffff&c,a=(s>>26)-(c/0x4000000|0),this.words[n+r]=0x3ffffff&s}for(;n<this.length-r;n++)a=(s=(0|this.words[n+r])+a)>>26,this.words[n+r]=0x3ffffff&s;if(0===a)return this._strip();for(i(-1===a),a=0,n=0;n<this.length;n++)a=(s=-(0|this.words[n])+a)>>26,this.words[n]=0x3ffffff&s;return this.negative=1,this._strip()},s.prototype._wordDiv=function(e,t){var r,i=this.length-e.length,n=this.clone(),o=e,a=0|o.words[o.length-1];0!=(i=26-this._countBits(a))&&(o=o.ushln(i),n.iushln(i),a=0|o.words[o.length-1]);var c=n.length-o.length;if("mod"!==t){(r=new s(null)).length=c+1,r.words=Array(r.length);for(var l=0;l<r.length;l++)r.words[l]=0}var h=n.clone()._ishlnsubmul(o,1,c);0===h.negative&&(n=h,r&&(r.words[c]=1));for(var u=c-1;u>=0;u--){var d=(0|n.words[o.length+u])*0x4000000+(0|n.words[o.length+u-1]);for(d=Math.min(d/a|0,0x3ffffff),n._ishlnsubmul(o,d,u);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,u),n.isZero()||(n.negative^=1);r&&(r.words[u]=d)}return r&&r._strip(),n._strip(),"div"!==t&&0!==i&&n.iushrn(i),{div:r||null,mod:n}},s.prototype.divmod=function(e,t,r){var n,o,a;return(i(!e.isZero()),this.isZero())?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(n=a.div.neg()),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:n,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(n=a.div.neg()),{div:n,mod:a.mod}):(this.negative&e.negative)!=0?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):e.length>this.length||0>this.cmp(e)?{div:new s(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new s(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new s(this.modrn(e.words[0]))}:this._wordDiv(e,t)},s.prototype.div=function(e){return this.divmod(e,"div",!1).div},s.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},s.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},s.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},s.prototype.modrn=function(e){var t=e<0;t&&(e=-e),i(e<=0x3ffffff);for(var r=0x4000000%e,n=0,s=this.length-1;s>=0;s--)n=(r*n+(0|this.words[s]))%e;return t?-n:n},s.prototype.modn=function(e){return this.modrn(e)},s.prototype.idivn=function(e){var t=e<0;t&&(e=-e),i(e<=0x3ffffff);for(var r=0,n=this.length-1;n>=0;n--){var s=(0|this.words[n])+0x4000000*r;this.words[n]=s/e|0,r=s%e}return this._strip(),t?this.ineg():this},s.prototype.divn=function(e){return this.clone().idivn(e)},s.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new s(1),o=new s(0),a=new s(0),c=new s(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),u=t.clone();!t.isZero();){for(var d=0,f=1;(t.words[0]&f)==0&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(h),o.isub(u)),n.iushrn(1),o.iushrn(1);for(var p=0,g=1;(r.words[0]&g)==0&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(h),c.isub(u)),a.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(a),o.isub(c)):(r.isub(t),a.isub(n),c.isub(o))}return{a:a,b:c,gcd:r.iushln(l)}},s.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t,r=this,n=e.clone();r=0!==r.negative?r.umod(e):r.clone();for(var o=new s(1),a=new s(0),c=n.clone();r.cmpn(1)>0&&n.cmpn(1)>0;){for(var l=0,h=1;(r.words[0]&h)==0&&l<26;++l,h<<=1);if(l>0)for(r.iushrn(l);l-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);for(var u=0,d=1;(n.words[0]&d)==0&&u<26;++u,d<<=1);if(u>0)for(n.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);r.cmp(n)>=0?(r.isub(n),o.isub(a)):(n.isub(r),a.isub(o))}return 0>(t=0===r.cmpn(1)?o:a).cmpn(0)&&t.iadd(e),t},s.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var s=t;t=r,r=s}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},s.prototype.invm=function(e){return this.egcd(e).a.umod(e)},s.prototype.isEven=function(){return(1&this.words[0])==0},s.prototype.isOdd=function(){return(1&this.words[0])==1},s.prototype.andln=function(e){return this.words[0]&e},s.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var s=n,o=r;0!==s&&o<this.length;o++){var a=0|this.words[o];a+=s,s=a>>>26,a&=0x3ffffff,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(e){var t,r=e<0;
509if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=0x3ffffff,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},s.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return -1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},s.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return -1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},s.prototype.gtn=function(e){return 1===this.cmpn(e)},s.prototype.gt=function(e){return 1===this.cmp(e)},s.prototype.gten=function(e){return this.cmpn(e)>=0},s.prototype.gte=function(e){return this.cmp(e)>=0},s.prototype.ltn=function(e){return -1===this.cmpn(e)},s.prototype.lt=function(e){return -1===this.cmp(e)},s.prototype.lten=function(e){return 0>=this.cmpn(e)},s.prototype.lte=function(e){return 0>=this.cmp(e)},s.prototype.eqn=function(e){return 0===this.cmpn(e)},s.prototype.eq=function(e){return 0===this.cmp(e)},s.red=function(e){return new A(e)},s.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(e){return this.red=e,this},s.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},s.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},s.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},s.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},s.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},s.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},s.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},s.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new s(t,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function x(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"==typeof e){var t=s._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){A.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new s(null);return e.words=Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength();while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},n(x,v),x.prototype.split=function(e,t){for(var r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9){e.words[0]=0,e.length=1;return}var n=e.words[9];for(i=10,t.words[t.length++]=4194303&n;i<e.length;i++){var s=0|e.words[i];e.words[i-10]=(4194303&s)<<4|n>>>22,n=s}n>>>=22,e.words[i-10]=n,0===n&&e.length>10?e.length-=10:e.length-=9},x.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=0x3ffffff&t,t=64*i+(t/0x4000000|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(E,v),n(_,v),n(I,v),I.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=(0|e.words[r])*19+t,n=0x3ffffff&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},s._prime=function(e){var t;if(w[e])return w[e];if("k256"===e)t=new x;else if("p224"===e)t=new E;else if("p192"===e)t=new _;else if("p25519"===e)t=new I;else throw Error("Unknown prime "+e);return w[e]=t,t},A.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){i((e.negative|t.negative)==0,"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new s(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),c=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new s(2*h*h).toRed(this);0!==this.pow(h,l).cmp(c);)h.redIAdd(c);for(var u=this.pow(h,n),d=this.pow(e,n.addn(1).iushrn(1)),f=this.pow(e,n),p=o;0!==f.cmp(a);){for(var g=f,m=0;0!==g.cmp(a);m++)g=g.redSqr();i(m<p);var y=this.pow(u,new s(1).iushln(p-m-1));d=d.redMul(y),u=y.redSqr(),f=f.redMul(u),p=m}return d},A.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},A.prototype.pow=function(e,t){if(t.isZero())return new s(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=Array(16);r[0]=new s(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],o=0,a=0,c=t.bitLength()%26;for(0===c&&(c=26),i=t.length-1;i>=0;i--){for(var l=t.words[i],h=c-1;h>=0;h--){var u=l>>h&1;if(n!==r[0]&&(n=this.sqr(n)),0===u&&0===o){a=0;continue}o<<=1,o|=u,(4==++a||0===i&&0===h)&&(n=this.mul(n,r[o]),a=0,o=0)}c=26}return n},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new S(e)},n(S,A),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):0>n.cmpn(0)&&(s=n.iadd(this.m)),s._forceRed(this)},S.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):0>n.cmpn(0)&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},50915:(e,t,r)=>{let i=r(10429);t.mul=function(e,t){let r=new Uint8Array(e.length+t.length-1);for(let n=0;n<e.length;n++)for(let s=0;s<t.length;s++)r[n+s]^=i.mul(e[n],t[s]);return r},t.mod=function(e,t){let r=new Uint8Array(e);for(;r.length-t.length>=0;){let e=r[0];for(let n=0;n<t.length;n++)r[n]^=i.mul(t[n],e);let n=0;for(;n<r.length&&0===r[n];)n++;r=r.slice(n)}return r},t.generateECPolynomial=function(e){let r=new Uint8Array([1]);for(let n=0;n<e;n++)r=t.mul(r,new Uint8Array([1,i.exp(n)]));return r}},51470:(e,t,r)=>{"use strict";r.d(t,{Br:()=>c,Ce:()=>o,Ok:()=>i,qG:()=>a});var i,n=r(68463),s=r(36452);!function(e){e.Installed="Installed",e.NotDetected="NotDetected",e.Loadable="Loadable",e.Unsupported="Unsupported"}(i||(i={}));class o extends n.A{get connected(){return!!this.publicKey}async autoConnect(){await this.connect()}async prepareTransaction(e,t,r={}){let i=this.publicKey;if(!i)throw new s.kW;return e.feePayer=e.feePayer||i,e.recentBlockhash=e.recentBlockhash||(await t.getLatestBlockhash({commitment:r.preflightCommitment,minContextSlot:r.minContextSlot})).blockhash,e}}function a(e){if("undefined"==typeof window||"undefined"==typeof document)return;let t=[];function r(){if(e())for(let e of t)e()}let i=setInterval(r,1e3);t.push(()=>clearInterval(i)),"loading"===document.readyState&&(document.addEventListener("DOMContentLoaded",r,{once:!0}),t.push(()=>document.removeEventListener("DOMContentLoaded",r))),"complete"!==document.readyState&&(window.addEventListener("load",r,{once:!0}),t.push(()=>window.removeEventListener("load",r))),r()}function c(){if(!navigator)return!1;let e=navigator.userAgent.toLowerCase(),t=e.includes("iphone")||e.includes("ipad"),r=e.includes("safari");return t&&r}},51826:(e,t,r)=>{"use strict";r.d(t,{Vw:()=>d,Fc:()=>l,Id:()=>u,O8:()=>o,qv:()=>c,po:()=>p,Ow:()=>a,ZJ:()=>h,DH:()=>s,ld:()=>f});let i="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;var n=r(77946);function s(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function o(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function a(e,t){return e<<32-t|e>>>t}let c=68===new Uint8Array(new Uint32Array([0x11223344]).buffer)[0];function l(e){for(let r=0;r<e.length;r++){var t;e[r]=(t=e[r])<<24&0xff000000|t<<8&0xff0000|t>>>8&65280|t>>>24&255}}function h(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(e)),(0,n.DO)(e),e}function u(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];(0,n.DO)(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){let n=e[t];r.set(n,i),i+=n.length}return r}class d{clone(){return this._cloneInto()}}function f(e){let t=t=>e().update(h(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function p(e=32){if(i&&"function"==typeof i.getRandomValues)return i.getRandomValues(new Uint8Array(e));if(i&&"function"==typeof i.randomBytes)return i.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}},51838:(e,t,r)=>{"use strict";var i=r(81029).Buffer;
509Object.defineProperty(t,"__esModule",{value:!0}),t.toBigIntLE=function(e){{let t=i.from(e);t.reverse();let r=t.toString("hex");return 0===r.length?BigInt(0):BigInt(`0x${r}`)}},t.toBigIntBE=function(e){{let t=e.toString("hex");return 0===t.length?BigInt(0):BigInt(`0x${t}`)}},t.toBufferLE=function(e,t){{let r=e.toString(16),n=i.from(r.padStart(2*t,"0").slice(0,2*t),"hex");return n.reverse(),n}},t.toBufferBE=function(e,t){{let r=e.toString(16);return i.from(r.padStart(2*t,"0").slice(0,2*t),"hex")}}},51901:(e,t,r)=>{"use strict";function i(e){return"version"in e}r.d(t,{Y:()=>i})},52321:(e,t,r)=>{"use strict";r.d(t,{JW:()=>S,XX:()=>F,c0:()=>C,ge:()=>q,qy:()=>A,s6:()=>N});let i=globalThis,n=e=>e,s=i.trustedTypes,o=s?s.createPolicy("lit-html",{createHTML:e=>e}):void 0,a="$lit$",c=`lit$${Math.random().toFixed(9).slice(2)}$`,l="?"+c,h=`<${l}>`,u=document,d=()=>u.createComment(""),f=e=>null===e||"object"!=typeof e&&"function"!=typeof e,p=Array.isArray,g=e=>p(e)||"function"==typeof e?.[Symbol.iterator],m="[ \n\f\r]",y=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,b=/-->/g,w=/>/g,v=RegExp(`>|${m}(?:([^\\s"'>=/]+)(${m}*=${m}*(?:[^ 510\f\r"'\`<>=]|("|')|))|$)`,"g"),x=/'/g,E=/"/g,_=/^(?:script|style|textarea|title)$/i,I=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),A=I(1),S=I(2),C=(I(3),Symbol.for("lit-noChange")),N=Symbol.for("lit-nothing"),O=new WeakMap,P=u.createTreeWalker(u,129);function T(e,t){if(!p(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==o?o.createHTML(t):t}let M=(e,t)=>{let r=e.length-1,i=[],n,s=2===t?"<svg>":3===t?"<math>":"",o=y;for(let t=0;t<r;t++){let r=e[t],l,u,d=-1,f=0;for(;f<r.length&&(o.lastIndex=f,null!==(u=o.exec(r)));)f=o.lastIndex,o===y?"!--"===u[1]?o=b:void 0!==u[1]?o=w:void 0!==u[2]?(_.test(u[2])&&(n=RegExp("</"+u[2],"g")),o=v):void 0!==u[3]&&(o=v):o===v?">"===u[0]?(o=n??y,d=-1):void 0===u[1]?d=-2:(d=o.lastIndex-u[2].length,l=u[1],o=void 0===u[3]?v:'"'===u[3]?E:x):o===E||o===x?o=v:o===b||o===w?o=y:(o=v,n=void 0);let p=o===v&&e[t+1].startsWith("/>")?" ":"";s+=o===y?r+h:d>=0?(i.push(l),r.slice(0,d)+a+r.slice(d)+c+p):r+c+(-2===d?t:p)}return[T(e,s+(e[r]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]};class R{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let n=0,o=0,h=e.length-1,u=this.parts,[f,p]=M(e,t);if(this.el=R.createElement(f,r),P.currentNode=this.el.content,2===t||3===t){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=P.nextNode())&&u.length<h;){if(1===i.nodeType){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(a)){let t=p[o++],r=i.getAttribute(e).split(c),s=/([.?@])?(.*)/.exec(t);u.push({type:1,index:n,name:s[2],strings:r,ctor:"."===s[1]?B:"?"===s[1]?j:"@"===s[1]?$:U}),i.removeAttribute(e)}else e.startsWith(c)&&(u.push({type:6,index:n}),i.removeAttribute(e));if(_.test(i.tagName)){let e=i.textContent.split(c),t=e.length-1;if(t>0){i.textContent=s?s.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],d()),P.nextNode(),u.push({type:2,index:++n});i.append(e[t],d())}}}else if(8===i.nodeType)if(i.data===l)u.push({type:2,index:n});else{let e=-1;for(;-1!==(e=i.data.indexOf(c,e+1));)u.push({type:7,index:n}),e+=c.length-1}n++}}static createElement(e,t){let r=u.createElement("template");return r.innerHTML=e,r}}function k(e,t,r=e,i){if(t===C)return t;let n=void 0!==i?r._$Co?.[i]:r._$Cl,s=f(t)?void 0:t._$litDirective$;return n?.constructor!==s&&(n?._$AO?.(!1),void 0===s?n=void 0:(n=new s(e))._$AT(e,r,i),void 0!==i?(r._$Co??=[])[i]=n:r._$Cl=n),void 0!==n&&(t=k(e,n._$AS(e,t.values),n,i)),t}class D{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??u).importNode(t,!0);P.currentNode=i;let n=P.nextNode(),s=0,o=0,a=r[0];for(;void 0!==a;){if(s===a.index){let t;2===a.type?t=new L(n,n.nextSibling,this,e):1===a.type?t=new a.ctor(n,a.name,a.strings,this,e):6===a.type&&(t=new z(n,this,e)),this._$AV.push(t),a=r[++o]}s!==a?.index&&(n=P.nextNode(),s++)}return P.currentNode=u,i}p(e){let t=0;for(let r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class L{get _$AU(){return this._$AM?._$AU??this._$Cv}
510constructor(e,t,r,i){this.type=2,this._$AH=N,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){f(e=k(this,e,t))?e===N||null==e||""===e?(this._$AH!==N&&this._$AR(),this._$AH=N):e!==this._$AH&&e!==C&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):g(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==N&&f(this._$AH)?this._$AA.nextSibling.data=e:this.T(u.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=R.createElement(T(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let e=new D(i,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=O.get(e.strings);return void 0===t&&O.set(e.strings,t=new R(e)),t}k(e){p(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let n of e)i===t.length?t.push(r=new L(this.O(d()),this.O(d()),this,this.options)):r=t[i],r._$AI(n),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=n(e).nextSibling;n(e).remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class U{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,n){this.type=1,this._$AH=N,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=n,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=N}_$AI(e,t=this,r,i){let n=this.strings,s=!1;if(void 0===n)(s=!f(e=k(this,e,t,0))||e!==this._$AH&&e!==C)&&(this._$AH=e);else{let i,o,a=e;for(e=n[0],i=0;i<n.length-1;i++)(o=k(this,a[r+i],t,i))===C&&(o=this._$AH[i]),s||=!f(o)||o!==this._$AH[i],o===N?e=N:e!==N&&(e+=(o??"")+n[i+1]),this._$AH[i]=o}s&&!i&&this.j(e)}j(e){e===N?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class B extends U{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===N?void 0:e}}class j extends U{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==N)}}class $ extends U{constructor(e,t,r,i,n){super(e,t,r,i,n),this.type=5}
510_$AI(e,t=this){if((e=k(this,e,t,0)??N)===C)return;let r=this._$AH,i=e===N&&r!==N||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,n=e!==N&&(r===N||i);i&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class z{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){k(this,e)}}let q={M:a,P:c,A:l,C:1,L:M,R:D,D:g,V:k,I:L,H:U,N:j,U:$,B:B,F:z},H=i.litHtmlPolyfillSupport;H?.(R,L),(i.litHtmlVersions??=[]).push("3.3.2");let F=(e,t,r)=>{let i=r?.renderBefore??t,n=i._$litPart$;if(void 0===n){let e=r?.renderBefore??null;i._$litPart$=n=new L(t.insertBefore(d(),e),e,void 0,r??{})}return n._$AI(e),n}},52502:(e,t,r)=>{"use strict";r.d(t,{h:()=>a});var i=r(70524),n=r(98866),s=r(55480);let o=(0,i.BX)({message:"",variant:"info",open:!1}),a={state:o,subscribeKey:(e,t)=>(0,n.u$)(o,e,t),open(e,t){let{debug:r}=s.H.state,{shortMessage:i,longMessage:n}=e;r&&(o.message=i,o.variant=t,o.open=!0),n&&console.error("function"==typeof n?n():n)},close(){o.open=!1,o.message="",o.variant="info"}}},52617:(e,t,r)=>{"use strict";function i(e,t){return"light"===t?{"--w3m-accent":e?.["--w3m-accent"]||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":e?.["--w3m-accent"]||"hsla(230, 100%, 67%, 1)","--w3m-background":"#121313"}}r.d(t,{o:()=>i})},52686:(e,t)=>{function r(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw Error("Invalid hex color: "+e);(3===t.length||4===t.length)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),6===t.length&&t.push("F","F");let r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+t.slice(0,6).join("")}}t.getOptions=function(e){e||(e={}),e.color||(e.color={});let t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,i=e.width&&e.width>=21?e.width:void 0,n=e.scale||4;return{width:i,scale:i?4:n,margin:t,color:{dark:r(e.color.dark||"#000000ff"),light:r(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},t.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},t.getImageWidth=function(e,r){let i=t.getScale(e,r);return Math.floor((e+2*r.margin)*i)},t.qrToImageData=function(e,r,i){let n=r.modules.size,s=r.modules.data,o=t.getScale(n,i),a=Math.floor((n+2*i.margin)*o),c=i.margin*o,l=[i.color.light,i.color.dark];for(let t=0;t<a;t++)for(let r=0;r<a;r++){let h=(t*a+r)*4,u=i.color.light;t>=c&&r>=c&&t<a-c&&r<a-c&&(u=l[+!!s[Math.floor((t-c)/o)*n+Math.floor((r-c)/o)]]),e[h++]=u.r,e[h++]=u.g,e[h++]=u.b,e[h]=u.a}}},52749:(e,t,r)=>{var i="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r.g&&r.g,n=function(){function e(){this.fetch=!1,this.DOMException=i.DOMException}return e.prototype=i,new e}();!function(e){!function(t){var i=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==r.g&&r.g||{},n={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};if(n.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function a(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function c(e){return"string"!=typeof e&&(e=String(e)),e}function l(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n.iterable&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){if(2!=e.length)throw TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function u(e){if(!e._noBody){if(e.bodyUsed)return Promise.reject(TypeError("Already read"));e.bodyUsed=!0}}function d(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function f(e){var t=new FileReader,r=d(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(e){if(this.bodyUsed=this.bodyUsed,this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(n.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(n.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(n.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else{var t;n.arrayBuffer&&n.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):n.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||o(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e)}else this._noBody=!0,this._bodyText="";!this.headers.get("content-type")&&("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n.blob&&(this.blob=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(!this._bodyFormData)return Promise.resolve(new Blob([this._bodyText]));throw Error("could not read FormData body as blob")}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=u(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(n.blob)return this.blob().then(f);throw Error("could not read as ArrayBuffer")},this.text=function(){var e,t,r,i,n,s=u(this);if(s)return s;if(this._bodyBlob)return e=this._bodyBlob,r=d(t=new FileReader),n=(i=/charset=([A-Za-z0-9_-]+)/.exec(e.type))?i[1]:"utf-8",t.readAsText(e,n),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(!this._bodyFormData)return Promise.resolve(this._bodyText);throw Error("could not read FormData body as text")},n.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(e,t){e=a(e),t=c(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},h.prototype.delete=function(e){delete this.map[a(e)]},h.prototype.get=function(e){return e=a(e),this.has(e)?this.map[e]:null},h.prototype.has=function(e){return this.map.hasOwnProperty(a(e))},h.prototype.set=function(e,t){this.map[a(e)]=c(t)},h.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},h.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),l(e)},h.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),l(e)},h.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),l(e)},n.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);var m=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function y(e,t){if(!(this instanceof y))throw TypeError('Please use the "new" operator, this DOM object c
510onstructor cannot be called as a function.');var r,n,s=(t=t||{}).body;if(e instanceof y){if(e.bodyUsed)throw TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new h(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,s||null==e._bodyInit||(s=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",(t.headers||!this.headers)&&(this.headers=new h(t.headers)),this.method=(n=(r=t.method||this.method||"GET").toUpperCase(),m.indexOf(n)>-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in i)return new AbortController().signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(s),("GET"===this.method||"HEAD"===this.method)&&("no-store"===t.cache||"no-cache"===t.cache)){var o=/([?&])_=[^&]*/;o.test(this.url)?this.url=this.url.replace(o,"$1_="+new Date().getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+new Date().getTime()}}function b(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}}),t}function w(e,t){if(!(this instanceof w))throw TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.status<200||this.status>599)throw RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},g.call(y.prototype),g.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var v=[301,302,303,307,308];w.redirect=function(e,t){if(-1===v.indexOf(t))throw RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},t.DOMException=i.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function x(e,r){return new Promise(function(s,o){var l=new y(e,r);if(l.signal&&l.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function d(){u.abort()}if(u.onload=function(){var e,t,r={statusText:u.statusText,headers:(e=u.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e}).forEach(function(e){var r=e.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();try{t.append(i,n)}catch(e){console.warn("Response "+e.message)}}}),t)};0===l.url.indexOf("file://")&&(u.status<200||u.status>599)?r.status=200:r.status=u.status,r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var i="response"in u?u.response:u.responseText;setTimeout(function(){s(new w(i,r))},0)},u.onerror=function(){setTimeout(function(){o(TypeError("Network request failed"))},0)},u.ontimeout=function(){setTimeout(function(){o(TypeError("Network request timed out"))},0)},u.onabort=function(){setTimeout(function(){o(new t.DOMException("Aborted","AbortError"))},0)},u.open(l.method,function(e){try{return""===e&&i.location.href?i.location.href:e}catch(t){return e}}(l.url),!0),"include"===l.credentials?u.withCredentials=!0:"omit"===l.credentials&&(u.withCredentials=!1),"responseType"in u&&(n.blob?u.responseType="blob":n.arrayBuffer&&(u.responseType="arraybuffer")),r&&"object"==typeof r.headers&&!(r.headers instanceof h||i.Headers&&r.headers instanceof i.Headers)){var f=[];
510Object.getOwnPropertyNames(r.headers).forEach(function(e){f.push(a(e)),u.setRequestHeader(e,c(r.headers[e]))}),l.headers.forEach(function(e,t){-1===f.indexOf(t)&&u.setRequestHeader(t,e)})}else l.headers.forEach(function(e,t){u.setRequestHeader(t,e)});l.signal&&(l.signal.addEventListener("abort",d),u.onreadystatechange=function(){4===u.readyState&&l.signal.removeEventListener("abort",d)}),u.send(void 0===l._bodyInit?null:l._bodyInit)})}x.polyfill=!0,i.fetch||(i.fetch=x,i.Headers=h,i.Request=y,i.Response=w),t.Headers=h,t.Request=y,t.Response=w,t.fetch=x,Object.defineProperty(t,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var s=i.fetch?i:n;(t=s.fetch).default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,e.exports=t},52769:(e,t,r)=>{let i=r(91791),n=r(93711),s=r(85289),o=r(23308);function a(e,t,r,s,o){let a=[].slice.call(arguments,1),c=a.length,l="function"==typeof a[c-1];if(!l&&!i())throw Error("Callback required as last argument");if(l){if(c<2)throw Error("Too few arguments provided");2===c?(o=r,r=t,t=s=void 0):3===c&&(t.getContext&&void 0===o?(o=s,s=void 0):(o=s,s=r,r=t,t=void 0))}else{if(c<1)throw Error("Too few arguments provided");return 1===c?(r=t,t=s=void 0):2!==c||t.getContext||(s=r,r=t,t=void 0),new Promise(function(i,o){try{let o=n.create(r,s);i(e(o,t,s))}catch(e){o(e)}})}try{let i=n.create(r,s);o(null,e(i,t,s))}catch(e){o(e)}}t.create=n.create,t.toCanvas=a.bind(null,s.render),t.toDataURL=a.bind(null,s.renderToDataURL),t.toString=a.bind(null,function(e,t,r){return o.render(e,r)})},53475:(e,t,r)=>{"use strict";e.exports=function(e){var t=e.lib.WordArray,r=e.enc;function i(e){return e<<8&0xff00ff00|e>>>8&0xff00ff}return r.Utf16=r.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n+=2){var s=t[n>>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n<r;n++)i[n>>>1]|=e.charCodeAt(n)<<16-n%2*16;return t.create(i,2*r)}},r.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],s=0;s<r;s+=2){var o=i(t[s>>>2]>>>16-s%4*8&65535);n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var r=e.length,n=[],s=0;s<r;s++)n[s>>>1]|=i(e.charCodeAt(s)<<16-s%2*16);return t.create(n,2*r)}},e.enc.Utf16}(r(16611))},53832:(e,t,r)=>{"use strict";e.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(r(16611),r(99229))},53896:(e,t)=>{let r="[0-9]+",i="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",n="(?:(?![A-Z0-9 $%*+\\-./:]|"+(i=i.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";t.KANJI=RegExp(i,"g"),t.BYTE_KANJI=RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=RegExp(n,"g"),t.NUMERIC=RegExp(r,"g"),t.ALPHANUMERIC=RegExp("[A-Z $%*+\\-./:]+","g");let s=RegExp("^"+i+"$"),o=RegExp("^"+r+"$"),a=RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(e){return s.test(e)},t.testNumeric=function(e){return o.test(e)},t.testAlphanumeric=function(e){return a.test(e)}},53985:(e,t,r)=>{"use strict";e.exports=function(e){var t,r,i,n,s,o,a;return r=(t=e.lib).Base,i=t.WordArray,s=(n=e.algo).SHA256,o=n.HMAC,a=n.PBKDF2=r.extend({cfg:r.extend({keySize:4,hasher:s,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=o.create(r.hasher,e),s=i.create(),a=i.create([1]),c=s.words,l=a.words,h=r.keySize,u=r.iterations;c.length<h;){var d=n.update(t).finalize(a);n.reset();for(var f=d.words,p=f.length,g=d,m=1;m<u;m++){g=n.finalize(g),n.reset();for(var y=g.words,b=0;b<p;b++)f[b]^=y[b]}s.concat(d),l[0]++}return s.sigBytes=4*h,s}}),e.PBKDF2=function(e,t,r){return a.create(r).compute(e,t)},e.PBKDF2}(r(16611),r(92475),r(83247))},54415:(e,t,r)=>{let i=r(89158);function n(e){this.mode=i.NUMERIC,this.data=e.toString()}n.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(e){let t,r;for(t=0;t+3<=this.data.length;t+=3)r=parseInt(this.data.substr(t,3),10),e.put(r,10);let i=this.data.length-t;i>0&&(r=parseInt(this.data.substr(t),10),e.put(r,3*i+1))},e.exports=n},55402:(e,t,r)=>{"use strict";r.d(t,{Uf:()=>o,XW:()=>a,fO:()=>n,jf:()=>s,zR:()=>i});let i="INTERNAL_ERROR",n="SERVER_ERROR",s=[-32700,-32600,-32601,-32602,-32603],o={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[i]:{code:-32603,message:"Internal error"},[n]:{code:-32e3,message:"Server error"}},a=n},55480:(e,t,r)=>{"use strict";r.d(t,{H:()=>l});var i=r(70524),n=r(98866),s=r(28977),o=r(12319);let a={getFeatureValue(e,t){let r=t?.[e];return void 0===r?s.oU.DEFAULT_FEATURES[e]:r}
510,filterSocialsByPlatform(e){if(!e||!e.length)return e;if(o.w.isTelegram()){if(o.w.isIos())return e.filter(e=>"google"!==e);if(o.w.isMac())return e.filter(e=>"x"!==e);if(o.w.isAndroid())return e.filter(e=>!["facebook","x"].includes(e))}return e}},c=(0,i.BX)({features:s.oU.DEFAULT_FEATURES,projectId:"",sdkType:"appkit",sdkVersion:"html-wagmi-undefined",defaultAccountTypes:s.oU.DEFAULT_ACCOUNT_TYPES,enableNetworkSwitch:!0}),l={state:c,subscribeKey:(e,t)=>(0,n.u$)(c,e,t),setOptions(e){Object.assign(c,e)},setFeatures(e){if(!e)return;c.features||(c.features=s.oU.DEFAULT_FEATURES);let t={...c.features,...e};c.features=t,c.features.socials&&(c.features.socials=a.filterSocialsByPlatform(c.features.socials))},setProjectId(e){c.projectId=e},setCustomRpcUrls(e){c.customRpcUrls=e},setAllWallets(e){c.allWallets=e},setIncludeWalletIds(e){c.includeWalletIds=e},setExcludeWalletIds(e){c.excludeWalletIds=e},setFeaturedWalletIds(e){c.featuredWalletIds=e},setTokens(e){c.tokens=e},setTermsConditionsUrl(e){c.termsConditionsUrl=e},setPrivacyPolicyUrl(e){c.privacyPolicyUrl=e},setCustomWallets(e){c.customWallets=e},setIsSiweEnabled(e){c.isSiweEnabled=e},setIsUniversalProvider(e){c.isUniversalProvider=e},setSdkVersion(e){c.sdkVersion=e},setMetadata(e){c.metadata=e},setDisableAppend(e){c.disableAppend=e},setEIP6963Enabled(e){c.enableEIP6963=e},setDebug(e){c.debug=e},setEnableWalletConnect(e){c.enableWalletConnect=e},setEnableWalletGuide(e){c.enableWalletGuide=e},setEnableAuthLogger(e){c.enableAuthLogger=e},setEnableWallets(e){c.enableWallets=e},setHasMultipleAddresses(e){c.hasMultipleAddresses=e},setSIWX(e){c.siwx=e},setConnectMethodsOrder(e){c.features={...c.features,connectMethodsOrder:e}},setWalletFeaturesOrder(e){c.features={...c.features,walletFeaturesOrder:e}},setSocialsOrder(e){c.features={...c.features,socials:e}},setCollapseWallets(e){c.features={...c.features,collapseWallets:e}},setEnableEmbedded(e){c.enableEmbedded=e},setAllowUnsupportedChain(e){c.allowUnsupportedChain=e},setManualWCControl(e){c.manualWCControl=e},setEnableNetworkSwitch(e){c.enableNetworkSwitch=e},setDefaultAccountTypes(e={}){Object.entries(e).forEach(([e,t])=>{t&&(c.defaultAccountTypes[e]=t)})},setUniversalProviderConfigOverride(e){c.universalProviderConfigOverride=e},getUniversalProviderConfigOverride:()=>c.universalProviderConfigOverride,getSnapshot:()=>(0,i.P9)(c)}},55762:e=>{"use strict";e.exports=function(){throw Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},55955:(e,t,r)=>{"use strict";r.d(t,{b:()=>a,v:()=>c});var i=r(12115);let n=[],s={autoConnect:!1,connecting:!1,connected:!1,disconnecting:!1,select(){o("call","select")},connect:()=>Promise.reject(o("call","connect")),disconnect:()=>Promise.reject(o("call","disconnect")),sendTransaction:()=>Promise.reject(o("call","sendTransaction")),signTransaction:()=>Promise.reject(o("call","signTransaction")),signAllTransactions:()=>Promise.reject(o("call","signAllTransactions")),signMessage:()=>Promise.reject(o("call","signMessage")),signIn:()=>Promise.reject(o("call","signIn"))};function o(e,t){let r=Error(`You have tried to ${e} "${t}" on a WalletContext without providing one. Make sure to render a WalletProvider as an ancestor of the component that uses WalletContext.`);return console.error(r),r}Object.defineProperty(s,"wallets",{get:()=>(o("read","wallets"),n)}),Object.defineProperty(s,"wallet",{get:()=>(o("read","wallet"),null)}),Object.defineProperty(s,"publicKey",{get:()=>(o("read","publicKey"),null)});let a=(0,i.createContext)(s);function c(){return(0,i.useContext)(a)}},57190:(e,t,r)=>{"use strict";r.d(t,{qM:()=>ef});var i=r(20218),n=r(76688),s=Object.create,o=Object.defineProperty,a=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,l=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,u=(e=>"u">typeof require?require:"u">typeof Proxy?new Proxy(e,{get:(e,t)=>("u">typeof require?require:e)[t]}):e)(function(e){if("u">typeof require)return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),d=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),f=(e,t,r)=>(r=null!=e?s(l(e)):{},((e,t,r,i)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of c(t))h.call(e,n)||n===r||o(e,n,{get:()=>t[n],enumerable:!(i=a(t,n))||i.enumerable});return e}
510)(!t&&e&&e.__esModule?r:o(r,"default",{value:e,enumerable:!0}),e)),p=d((e,t)=>{!function(r){if("object"==typeof e&&"u">typeof t)t.exports=r();else if("function"==typeof define&&define.amd)define([],r);else("u">typeof window?window:"u">typeof global?global:"u">typeof self?self:this).localforage=r()}(function(){return(function e(t,r,i){function n(o,a){if(!r[o]){if(!t[o]){var c="function"==typeof u&&u;if(!a&&c)return c(o,!0);if(s)return s(o,!0);var l=Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var h=r[o]={exports:{}};t[o][0].call(h.exports,function(e){return n(t[o][1][e]||e)},h,h.exports,e,t,r,i)}return r[o].exports}for(var s="function"==typeof u&&u,o=0;o<i.length;o++)n(i[o]);return n})({1:[function(e,t,r){(function(e){var r,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var n=0,s=new i(h),o=e.document.createTextNode("");s.observe(o,{characterData:!0}),r=function(){o.data=n=++n%2}}else if(!e.setImmediate&&"u">typeof e.MessageChannel){var a=new e.MessageChannel;a.port1.onmessage=h,r=function(){a.port2.postMessage(0)}}else r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){h(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(h,0)};var c,l=[];function h(){c=!0;for(var e,t,r=l.length;r;){for(t=l,l=[],e=-1;++e<r;)t[e]();r=l.length}c=!1}t.exports=function(e){1!==l.push(e)||c||r()}}).call(this,"u">typeof global?global:"u">typeof self?self:"u">typeof window?window:{})},{}],2:[function(e,t,r){var i=e(1);function n(){}var s={},o=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==n&&f(this,e)}function h(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function u(e,t,r){i(function(){var i;try{i=t(r)}catch(t){return s.reject(e,t)}i===e?s.reject(e,TypeError("Cannot resolve promise with itself")):s.resolve(e,i)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function f(e,t){var r=!1;function i(t){r||(r=!0,s.reject(e,t))}function n(t){r||(r=!0,s.resolve(e,t))}var o=p(function(){t(n,i)});"error"===o.status&&i(o.value)}function p(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=l,l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var r=new this.constructor(n);return this.state!==c?u(r,this.state===a?e:t,this.outcome):this.queue.push(new h(r,e,t)),r},h.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},h.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},h.prototype.callRejected=function(e){s.reject(this.promise,e)},h.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},s.resolve=function(e,t){var r=p(d,t);if("error"===r.status)return s.reject(e,r.value);var i=r.value;if(i)f(e,i);else{e.state=a,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var r=-1,i=e.queue.length;++r<i;)e.queue[r].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:s.resolve(new this(n),e)},l.reject=function(e){var t=new this(n);return s.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(TypeError("must be an array"));var r=e.length,i=!1;if(!r)return this.resolve([]);for(var o=Array(r),a=0,c=-1,l=new this(n);++c<r;)!function(e,n){t.resolve(e).then(function(e){o[n]=e,++a!==r||i||(i=!0,s.resolve(l,o))},function(e){i||(i=!0,s.reject(l,e))})}(e[c],c);return l},l.race=function(e){var t,r=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(TypeError("must be an array"));var i=e.length,o=!1;if(!i)return this.resolve([]);for(var a=-1,c=new this(n);++a<i;){t=e[a],r.resolve(t).then(function(e){o||(o=!0,s.resolve(c,e))},function(e){o||(o=!0,s.reject(c,e))})}return c}},{1:1}],3:[function(e,t,r){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,"u">typeof global?global:"u">typeof self?self:"u">typeof window?window:{})},{2:2}],4:[function(e,t,r){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=function(){try{if("u">typeof indexedDB)return indexedDB;if("u">typeof webkitIndexedDB)return webkitIndexedDB;if("u">typeof mozIndexedDB)return mozIndexedDB;if("u">typeof OIndexedDB)return OIndexedDB;if("u">typeof msIndexedDB)return msIndexedDB}catch{return}}();function s(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(s){if("TypeError"!==s.name)throw s;for(var r="u">typeof BlobBuilder?BlobBuilder:"u">typeof MSBlobBuilder?MSBlobBuilder:"u">typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,i=new r,n=0;n<e.length;n+=1)i.append(e[n]);return i.getBlob(t.type)}}typeof Promise>"u"&&e(3);var o=Promise;function a(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function c(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function l(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function h(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var u="local-forage-detect-blob-support",d=void 0,f={},p=Object.prototype.toString,g="readonly",m="readwrite";function y(e){var t=f[e.name],r={};r.promise=new o(function(e,t){r.resolve=e,r.reject=t}),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then(function(){return r.promise}):t.dbReady=r.promise}function b(e){var t=f[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function w(e,t){var r=f[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function v(e,t){return new o(function(r,i){if(f[e.name]=f[e.name]||S(),e.db)if(!t)return r(e.db);else y(e),e.db.close();var s=[e.name];t&&s.push(e.version);var o=n.open.apply(n,s);t&&(o.onupgradeneeded=function(t){var r=o.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(u)}catch(r){if("ConstraintError"===r.name)console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.');else throw r}}),o.onerror=function(e){e.preventDefault(),i(o.error)},o.onsuccess=function(){var t=o.result;t.onversionchange=function(e){e.target.close()},r(t),b(e)}})}function x(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),i=e.version<e.db.version,n=e.version>e.db.version;if(i&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),n||r){if(r){var s=e.db.version+1;s>e.version&&(e.version=s)}return!0}return!1}function E(e){return s([function(e){for(var t=e.length,r=new ArrayBuffer(t),i=new Uint8Array(r),n=0;n<t;n++)i[n]=e.charCodeAt(n);return r}(atob(e.data))],{type:e.type})}function _(e){return e&&e.__local_forage_encoded_blob}function I(e){var t=this,r=t._initReady().then(function(){var e=f[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return c(r,e,e),r}
510function A(e,t,r,i){void 0===i&&(i=1);try{var n=e.db.transaction(e.storeName,t);r(null,n)}catch(n){if(i>0&&(!e.db||"InvalidStateError"===n.name||"NotFoundError"===n.name))return o.resolve().then(function(){if(!e.db||"NotFoundError"===n.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),v(e,!0)}).then(function(){return(function(e){y(e);for(var t=f[e.name],r=t.forages,i=0;i<r.length;i++){var n=r[i];n._dbInfo.db&&(n._dbInfo.db.close(),n._dbInfo.db=null)}return e.db=null,v(e,!1).then(function(t){return e.db=t,x(e)?v(e,!0):t}).then(function(i){e.db=t.db=i;for(var n=0;n<r.length;n++)r[n]._dbInfo.db=i}).catch(function(t){throw w(e,t),t})})(e).then(function(){A(e,t,r,i-1)})}).catch(r);r(n)}}function S(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}var C={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var i in e)r[i]=e[i];var n=f[r.name];n||(n=S(),f[r.name]=n),n.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=I);var s=[];function a(){return o.resolve()}for(var c=0;c<n.forages.length;c++){var l=n.forages[c];l!==t&&s.push(l._initReady().catch(a))}var h=n.forages.slice(0);return o.all(s).then(function(){return r.db=n.db,v(r,!1)}).then(function(e){return r.db=e,x(r,t._defaultConfig.version)?v(r,!0):e}).then(function(e){r.db=n.db=e,t._dbInfo=r;for(var i=0;i<h.length;i++){var s=h[i];s!==t&&(s._dbInfo.db=r.db,s._dbInfo.version=r.version)}})},_support:function(){try{if(!n||!n.open)return!1;var e="u">typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"u">typeof indexedDB&&"u">typeof IDBKeyRange}catch{return!1}}(),iterate:function(e,t){var r=this,i=new o(function(t,i){r.ready().then(function(){A(r._dbInfo,g,function(n,s){if(n)return i(n);try{var o=s.objectStore(r._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var r=o.result;if(r){var i=r.value;_(i)&&(i=E(i));var n=e(i,r.key,a++);void 0!==n?t(n):r.continue()}else t()},o.onerror=function(){i(o.error)}}catch(e){i(e)}})}).catch(i)});return a(i,t),i},getItem:function(e,t){var r=this;e=l(e);var i=new o(function(t,i){r.ready().then(function(){A(r._dbInfo,g,function(n,s){if(n)return i(n);try{var o=s.objectStore(r._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),_(e)&&(e=E(e)),t(e)},o.onerror=function(){i(o.error)}}catch(e){i(e)}})}).catch(i)});return a(i,t),i},setItem:function(e,t,r){var i=this;e=l(e);var n=new o(function(r,n){var a;i.ready().then(function(){var e;return a=i._dbInfo,"[object Blob]"===p.call(t)?(e=a.db,"boolean"==typeof d?o.resolve(d):new o(function(t){var r=e.transaction(u,m),i=s([""]);r.objectStore(u).put(i,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/);t(navigator.userAgent.match(/Edge\//)||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1}).then(function(e){return d=e})).then(function(e){return e?t:new o(function(e,r){var i=new FileReader;i.onerror=r,i.onloadend=function(r){e({__local_forage_encoded_blob:!0,data:btoa(r.target.result||""),type:t.type})},i.readAsBinaryString(t)})}):t}).then(function(t){A(i._dbInfo,m,function(s,o){if(s)return n(s);try{var a=o.objectStore(i._dbInfo.storeName);null===t&&(t=void 0);var c=a.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),r(t)},o.onabort=o.onerror=function(){var e=c.error?c.error:c.transaction.error;n(e)}}catch(e){n(e)}})}).catch(n)});return a(n,r),n},removeItem:function(e,t){var r=this;e=l(e);var i=new o(function(t,i){r.ready().then(function(){A(r._dbInfo,m,function(n,s){if(n)return i(n);try{var o=s.objectStore(r._dbInfo.storeName).delete(e);s.oncomplete=function(){t()},s.onerror=function(){i(o.error)},s.onabort=function(){var e=o.error?o.error:o.transaction.error;i(e)}}catch(e){i(e)}})}).catch(i)});return a(i,t),i},clear:function(e){var t=this,r=new o(function(e,r){t.ready().then(function(){A(t._dbInfo,m,function(i,n){if(i)return r(i);try{var s=n.objectStore(t._dbInfo.storeName).clear();n.oncomplete=function(){e()},n.onabort=n.onerror=function(){var e=s.error?s.error:s.transaction.error;r(e)}}catch(e){r(e)}})}).catch(r)});return a(r,e),r},length:function(e){var t=this,r=new o(function(e,r){t.ready().then(function(){A(t._dbInfo,g,function(i,n){if(i)return r(i);try{var s=n.objectStore(t._dbInfo.storeName).count();s.onsuccess=function(){e(s.result)},s.onerror=function(){r(s.error)}}catch(e){r(e)}})}).catch(r)});return a(r,e),r},key:function(e,t){var r=this,i=new o(function(t,i){if(e<0)return void t(null);r.ready().then(function(){A(r._dbInfo,g,function(n,s){if(n)return i(n);try{var o=s.objectStore(r._dbInfo.storeName),a=!1,c=o.openKeyCursor();c.onsuccess=function(){var r=c.result;if(!r)return void t(null);0===e||a?t(r.key):(a=!0,r.advance(e))},c.onerror=function(){i(c.error)}}catch(e){i(e)}})}).catch(i)});return a(i,t),i},keys:function(e){var t=this,r=new o(function(e,r){t.ready().then(function(){A(t._dbInfo,g,function(i,n){if(i)return r(i);try{var s=n.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];s.onsuccess=function(){var t=s.result;if(!t)return void e(o);o.push(t.key),t.continue()},s.onerror=function(){r(s.error)}}catch(e){r(e)}})}).catch(r)});return a(r,e),r},dropInstance:function(e,t){t=h.apply(this,arguments);var r,i=this.config();if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||i.name,e.storeName=e.storeName||i.storeName),e.name){var s=e.name===i.name&&this._dbInfo.db?o.resolve(this._dbInfo.db):v(e,!1).then(function(t){var r=f[e.name],i=r.forages;r.db=t;for(var n=0;n<i.length;n++)i[n]._dbInfo.db=t;return t});r=e.storeName?s.then(function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1;y(e);var i=f[e.name],s=i.forages;t.close();for(var a=0;a<s.length;a++){var c=s[a];c._dbInfo.db=null,c._dbInfo.version=r}return new o(function(t,i){var s=n.open(e.name,r);s.onerror=function(e){s.result.close(),i(e)},s.onupgradeneeded=function(){s.result.deleteObjectStore(e.storeName)},s.onsuccess=function(){var e=s.result;e.close(),t(e)}}).then(function(e){i.db=e;for(var t=0;t<s.length;t++){var r=s[t];r._dbInfo.db=e,b(r._dbInfo)}}).catch(function(t){throw(w(e,t)||o.resolve()).catch(function(){}),t})}}):s.then(function(t){y(e);var r=f[e.name],i=r.forages;t.close();for(var s=0;s<i.length;s++)i[s]._dbInfo.db=null;return new o(function(t,r){var i=n.deleteDatabase(e.name);i.onerror=function(){var e=i.result;e&&e.close(),r(i.error)},i.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},i.onsuccess=function(){var e=i.result;e&&e.close(),t(e)}}).then(function(e){r.db=e;for(var t=0;t<i.length;t++)b(i[t]._dbInfo)}).catch(function(t){throw(w(e,t)||o.resolve()).catch(function(){}),t})})}else r=o.reject("Invalid arguments");return a(r,t),r}},N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
510+/",O=/^~~local_forage_type~([^~]+)~/,P="__lfsc__:",T=P.length,M="arbf",R="blob",k="si08",D="ui08",L="uic8",U="si16",B="si32",j="ur16",$="ui32",z="fl32",q="fl64",H=T+M.length,F=Object.prototype.toString;function W(e){var t,r,i,n,s,o=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var l=new ArrayBuffer(o),h=new Uint8Array(l);for(t=0;t<a;t+=4)r=N.indexOf(e[t]),i=N.indexOf(e[t+1]),n=N.indexOf(e[t+2]),s=N.indexOf(e[t+3]),h[c++]=r<<2|i>>4,h[c++]=(15&i)<<4|n>>2,h[c++]=(3&n)<<6|63&s;return l}function V(e){var t,r=new Uint8Array(e),i="";for(t=0;t<r.length;t+=3)i+=N[r[t]>>2],i+=N[(3&r[t])<<4|r[t+1]>>4],i+=N[(15&r[t+1])<<2|r[t+2]>>6],i+=N[63&r[t+2]];return r.length%3==2?i=i.substring(0,i.length-1)+"=":r.length%3==1&&(i=i.substring(0,i.length-2)+"=="),i}var K={serialize:function(e,t){var r="";if(e&&(r=F.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===F.call(e.buffer))){var i,n=P;e instanceof ArrayBuffer?(i=e,n+=M):(i=e.buffer,"[object Int8Array]"===r?n+=k:"[object Uint8Array]"===r?n+=D:"[object Uint8ClampedArray]"===r?n+=L:"[object Int16Array]"===r?n+=U:"[object Uint16Array]"===r?n+=j:"[object Int32Array]"===r?n+=B:"[object Uint32Array]"===r?n+=$:"[object Float32Array]"===r?n+=z:"[object Float64Array]"===r?n+=q:t(Error("Failed to get type for BinaryArray"))),t(n+V(i))}else if("[object Blob]"===r){var s=new FileReader;s.onload=function(){t(P+R+("~~local_forage_type~"+e.type+"~")+V(this.result))},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,T)!==P)return JSON.parse(e);var t,r=e.substring(H),i=e.substring(T,H);if(i===R&&O.test(r)){var n=r.match(O);t=n[1],r=r.substring(n[0].length)}var o=W(r);switch(i){case M:return o;case R:return s([o],{type:t});case k:return new Int8Array(o);case D:return new Uint8Array(o);case L:return new Uint8ClampedArray(o);case U:return new Int16Array(o);case j:return new Uint16Array(o);case B:return new Int32Array(o);case $:return new Uint32Array(o);case z:return new Float32Array(o);case q:return new Float64Array(o);default:throw Error("Unkown type: "+i)}},stringToBuffer:W,bufferToString:V};function G(e,t,r,i){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,i)}function Y(e,t,r,i,n,s){e.executeSql(r,i,n,function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(e,a){a.rows.length?s(e,o):G(e,t,function(){e.executeSql(r,i,n,s)},s)},s):s(e,o)},s)}function J(e,t,r,i){var n=this;e=l(e);var s=new o(function(s,o){n.ready().then(function(){void 0===t&&(t=null);var a=t,c=n._dbInfo;c.serializer.serialize(t,function(t,l){l?o(l):c.db.transaction(function(r){Y(r,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],function(){s(a)},function(e,t){o(t)})},function(t){if(t.code===t.QUOTA_ERR){if(i>0)return void s(J.apply(n,[e,a,r,i-1]));o(t)}})})}).catch(o)});return a(s,r),s}function X(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}var Q=function(e,t){for(var r,i=e.length,n=0;n<i;){if((r=e[n])===t||"number"==typeof r&&"number"==typeof t&&isNaN(r)&&isNaN(t))return!0;n++}return!1},Z=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ee={},et={},er={INDEXEDDB:C,WEBSQL:{_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var i in e)r[i]="string"!=typeof e[i]?e[i].toString():e[i];var n=new o(function(e,i){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return i(e)}r.db.transaction(function(n){G(n,r,function(){t._dbInfo=r,e()},function(e,t){i(t)})},i)});return r.serializer=K,n},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,i=new o(function(t,i){r.ready().then(function(){var n=r._dbInfo;n.db.transaction(function(r){Y(r,n,"SELECT * FROM "+n.storeName,[],function(r,i){for(var s=i.rows,o=s.length,a=0;a<o;a++){var c=s.item(a),l=c.value;
510if(l&&(l=n.serializer.deserialize(l)),void 0!==(l=e(l,c.key,a+1)))return void t(l)}t()},function(e,t){i(t)})})}).catch(i)});return a(i,t),i},getItem:function(e,t){var r=this;e=l(e);var i=new o(function(t,i){r.ready().then(function(){var n=r._dbInfo;n.db.transaction(function(r){Y(r,n,"SELECT * FROM "+n.storeName+" WHERE key = ? LIMIT 1",[e],function(e,r){var i=r.rows.length?r.rows.item(0).value:null;i&&(i=n.serializer.deserialize(i)),t(i)},function(e,t){i(t)})})}).catch(i)});return a(i,t),i},setItem:function(e,t,r){return J.apply(this,[e,t,r,1])},removeItem:function(e,t){var r=this;e=l(e);var i=new o(function(t,i){r.ready().then(function(){var n=r._dbInfo;n.db.transaction(function(r){Y(r,n,"DELETE FROM "+n.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){i(t)})})}).catch(i)});return a(i,t),i},clear:function(e){var t=this,r=new o(function(e,r){t.ready().then(function(){var i=t._dbInfo;i.db.transaction(function(t){Y(t,i,"DELETE FROM "+i.storeName,[],function(){e()},function(e,t){r(t)})})}).catch(r)});return a(r,e),r},length:function(e){var t=this,r=new o(function(e,r){t.ready().then(function(){var i=t._dbInfo;i.db.transaction(function(t){Y(t,i,"SELECT COUNT(key) as c FROM "+i.storeName,[],function(t,r){e(r.rows.item(0).c)},function(e,t){r(t)})})}).catch(r)});return a(r,e),r},key:function(e,t){var r=this,i=new o(function(t,i){r.ready().then(function(){var n=r._dbInfo;n.db.transaction(function(r){Y(r,n,"SELECT key FROM "+n.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,r){t(r.rows.length?r.rows.item(0).key:null)},function(e,t){i(t)})})}).catch(i)});return a(i,t),i},keys:function(e){var t=this,r=new o(function(e,r){t.ready().then(function(){var i=t._dbInfo;i.db.transaction(function(t){Y(t,i,"SELECT key FROM "+i.storeName,[],function(t,r){for(var i=[],n=0;n<r.rows.length;n++)i.push(r.rows.item(n).key);e(i)},function(e,t){r(t)})})}).catch(r)});return a(r,e),r},dropInstance:function(e,t){t=h.apply(this,arguments);var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName);var i,n=this;return a(i=e.name?new o(function(t){var i;i=e.name===r.name?n._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:i,storeNames:[e.storeName]}:new o(function(e,t){i.transaction(function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(t,r){for(var n=[],s=0;s<r.rows.length;s++)n.push(r.rows.item(s).name);e({db:i,storeNames:n})},function(e,r){t(r)})},function(e){t(e)})}))}).then(function(e){return new o(function(t,r){e.db.transaction(function(i){for(var n=[],s=0,a=e.storeNames.length;s<a;s++)n.push(function(e){return new o(function(t,r){i.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){r(t)})})}(e.storeNames[s]));o.all(n).then(function(){t()}).catch(function(e){r(e)})},function(e){r(e)})})}):o.reject("Invalid arguments"),t),i}},LOCALSTORAGE:{_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=X(e,this._defaultConfig),!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return!0}}()||localStorage.length>0?(this._dbInfo=t,t.serializer=K,o.resolve()):o.reject()},_support:function(){try{return"u">typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}(),iterate:function(e,t){var r=this,i=r.ready().then(function(){for(var t=r._dbInfo,i=t.keyPrefix,n=i.length,s=localStorage.length,o=1,a=0;a<s;a++){var c=localStorage.key(a);if(0===c.indexOf(i)){var l=localStorage.getItem(c);if(l&&(l=t.serializer.deserialize(l)),void 0!==(l=e(l,c.substring(n),o++)))return l}}});return a(i,t),i},getItem:function(e,t){var r=this;e=l(e);var i=r.ready().then(function(){var t=r._dbInfo,i=localStorage.getItem(t.keyPrefix+e);return i&&(i=t.serializer.deserialize(i)),i});return a(i,t),i},setItem:function(e,t,r){var i=this;e=l(e);var n=i.ready().then(function(){void 0===t&&(t=null);var r=t;return new o(function(n,s){var o=i._dbInfo;o.serializer.serialize(t,function(t,i){if(i)s(i);else try{localStorage.setItem(o.keyPrefix+e,t),n(r)}catch(e){("QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&s(e),s(e)}})})});return a(n,r),n},removeItem:function(e,t){var r=this;e=l(e);var i=r.ready().then(function(){var t=r._dbInfo;localStorage.removeItem(t.keyPrefix+e)});return a(i,t),i},clear:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var i=localStorage.key(r);0===i.indexOf(e)&&localStorage.removeItem(i)}});return a(r,e),r},length:function(e){var t=this.keys().then(function(e){return e.length});return a(t,e),t},key:function(e,t){var r=this,i=r.ready().then(function(){var t,i=r._dbInfo;try{t=localStorage.key(e)}catch{t=null}return t&&(t=t.substring(i.keyPrefix.length)),t});return a(i,t),i},keys:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo,r=localStorage.length,i=[],n=0;n<r;n++){var s=localStorage.key(n);0===s.indexOf(e.keyPrefix)&&i.push(s.substring(e.keyPrefix.length))}return i});return a(r,e),r},dropInstance:function(e,t){if(t=h.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config();e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var i,n=this;return a(i=e.name?new o(function(t){t(e.storeName?X(e,n._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}}):o.reject("Invalid arguments"),t),i}}},ei=[er.INDEXEDDB._driver,er.WEBSQL._driver,er.LOCALSTORAGE._driver],en=["dropInstance"],es=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(en),eo={description:"",driver:ei.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ea(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(Z(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}t.exports=new(function(){function e(t){if(!(this instanceof e))throw TypeError("Cannot call a class as a function");for(var r in er)if(er.hasOwnProperty(r)){var i=er[r],n=i._driver;this[r]=n,ee[n]||this.defineDriver(i)}this._defaultConfig=ea({},eo),this._config=ea({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return e.prototype.config=function(e){if((typeof e>"u"?"undefined":i(e))!=="object")return"string"==typeof e?this._config[e]:this._config;if(this._ready)return Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)},e.prototype.defineDriver=function(e,t,r){var i=new o(function(t,r){try{var i=e._driver,n=Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(n);for(var s=es.concat("_initStorage"),c=0,l=s.length;c<l;c++){var h=s[c];
510if((!Q(en,h)||e[h])&&"function"!=typeof e[h])return void r(n)}for(var u=function(e){return function(){var t=Error("Method "+e+" is not implemented by the current driver"),r=o.reject(t);return a(r,arguments[arguments.length-1]),r}},d=0,f=en.length;d<f;d++){var p=en[d];e[p]||(e[p]=u(p))}var g=function(r){ee[i]&&console.info("Redefining LocalForage driver: "+i),ee[i]=e,et[i]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(g,r):g(!!e._support):g(!0)}catch(e){r(e)}});return c(i,t,r),i},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var i=ee[e]?o.resolve(ee[e]):o.reject(Error("Driver not found."));return c(i,t,r),i},e.prototype.getSerializer=function(e){var t=o.resolve(K);return c(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return c(r,e,e),r},e.prototype.setDriver=function(e,t,r){var i=this;Z(e)||(e=[e]);var n=this._getSupportedDrivers(e);function s(){i._config.driver=i.driver()}function a(e){return i._extend(e),s(),i._ready=i._initStorage(i._config),i._ready}var l=null!==this._driverSet?this._driverSet.catch(function(){return o.resolve()}):o.resolve();return this._driverSet=l.then(function(){var e=n[0];return i._dbInfo=null,i._ready=null,i.getDriver(e).then(function(e){i._driver=e._driver,s(),i._wrapLibraryMethodsWithReady(),i._initDriver=function(){var e=0;return function t(){for(;e<n.length;){var r=n[e];return e++,i._dbInfo=null,i._ready=null,i.getDriver(r).then(a).catch(t)}s();var c=Error("No available storage method found.");return i._driverSet=o.reject(c),i._driverSet}()}})}).catch(function(){s();var e=Error("No available storage method found.");return i._driverSet=o.reject(e),i._driverSet}),c(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!et[e]},e.prototype._extend=function(e){ea(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,i=e.length;r<i;r++){var n=e[r];this.supports(n)&&t.push(n)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=es.length;e<t;e++)!function(e,t){e[t]=function(){var r=arguments;return e.ready().then(function(){return e[t].apply(e,r)})}}(this,es[e])},e.prototype.createInstance=function(t){return new e(t)},e}())},{3:3}]},{},[4])(4)})}),g=d((e,t)=>{var r,i,n,s,o,a,c,l,h,u,d,f,p,g,m,y,b,w,v,x,E,_,I;!function(e){var r="object"==typeof global?global:"object"==typeof self?self:"object"==typeof this?this:{};function i(e,t){return e!==r&&("function"==typeof Object.create?Object.defineProperty(e,"__esModule",{value:!0}):e.__esModule=!0),function(r,i){return e[r]=t?t(r,i):i}}"function"==typeof define&&define.amd?define("tslib",["exports"],function(t){e(i(r,i(t)))}):"object"==typeof t&&"object"==typeof t.exports?e(i(r,i(t.exports))):e(i(r))}(function(e){var t=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};r=function(e,r){function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)},i=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},n=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r},s=function(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},o=function(e,t){return function(r,i){t(r,i,e)}},a=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},c=function(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((i=i.apply(e,t||[])).next())})},l=function(e,t){var r,i,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){var c=[s,a];if(r)throw TypeError("Generator is already executing.");for(;o;)try{if(r=1,i&&(n=2&c[0]?i.return:c[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,c[1])).done)return n;switch(i=0,n&&(c=[2&c[0],n.value]),c[0]){case 0:case 1:n=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,i=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!n||c[1]>n[0]&&c[1]<n[3])){o.label=c[1];break}if(6===c[0]&&o.label<n[1]){o.label=n[1],n=c;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(c);break}n[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],i=0}finally{r=n=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},I=function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]},h=function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||(t[r]=e[r])},u=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);
510if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},d=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o},f=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(d(arguments[t]));return e},p=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var i=Array(e),n=0,t=0;t<r;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i},g=function(e){return this instanceof g?(this.v=e,this):new g(e)},m=function(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var i,n=r.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){n[e]&&(i[e]=function(t){return new Promise(function(r,i){s.push([e,t,r,i])>1||a(e,t)})})}function a(e,t){try{var r;(r=n[e](t)).value instanceof g?Promise.resolve(r.value.v).then(c,l):h(s[0][2],r)}catch(e){h(s[0][3],e)}}function c(e){a("next",e)}function l(e){a("throw",e)}function h(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},y=function(e){var t,r;return t={},i("next"),i("throw",function(e){throw e}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,n){t[i]=e[i]?function(t){return(r=!r)?{value:g(e[i](t)),done:"return"===i}:n?n(t):t}:n}},b=function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof u?u(e):e[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise(function(i,n){var s,o,a;s=i,o=n,a=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){s({value:e,done:a})},o)})}}},w=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},v=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t},x=function(e){return e&&e.__esModule?e:{default:e}},E=function(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)},_=function(e,t,r){if(!t.has(e))throw TypeError("attempted to set private field on non-instance");return t.set(e,r),r},e("__extends",r),e("__assign",i),e("__rest",n),e("__decorate",s),e("__param",o),e("__metadata",a),e("__awaiter",c),e("__generator",l),e("__exportStar",h),e("__createBinding",I),e("__values",u),e("__read",d),e("__spread",f),e("__spreadArrays",p),e("__await",g),e("__asyncGenerator",m),e("__asyncDelegator",y),e("__asyncValues",b),e("__makeTemplateOb
510ject",w),e("__importStar",v),e("__importDefault",x),e("__classPrivateFieldGet",E),e("__classPrivateFieldSet",_)})}),m=f(p()),y={};((e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})})(y,{_driver:()=>X,_initStorage:()=>ee,_support:()=>eh,clear:()=>et,dropInstance:()=>er,getItem:()=>ei,iterate:()=>en,key:()=>es,keys:()=>eo,length:()=>ea,removeItem:()=>ec,setItem:()=>el});var{__extends:b,__assign:w,__rest:v,__decorate:x,__param:E,__metadata:_,__awaiter:I,__generator:A,__exportStar:S,__createBinding:C,__values:N,__read:O,__spread:P,__spreadArrays:T,__await:M,__asyncGenerator:R,__asyncDelegator:k,__asyncValues:D,__makeTemplateObject:L,__importStar:U,__importDefault:B,__classPrivateFieldGet:j,__classPrivateFieldSet:$}=f(g(),1).default,z=/^~~local_forage_type~([^~]+)~/,q=Object.prototype.toString;function H(e){var t=.75*e.length,r=e.length;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);for(var i=new ArrayBuffer(t),n=new Uint8Array(i),s=0,o=0;s<r;s+=4){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[s]),c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[s+1]),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[s+2]),h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(e[s+3]);n[o++]=a<<2|c>>4,n[o++]=(15&c)<<4|l>>2,n[o++]=(3&l)<<6|63&h}return i}function F(e){for(var t=new Uint8Array(e),r="",i=0;i<t.length;i+=3)r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[t[i]>>2],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t[i])<<4|t[i+1]>>4],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t[i+1])<<2|t[i+2]>>6],r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[63&t[i+2]];return t.length%3==2?r=r.substring(0,r.length-1)+"=":t.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}function W(e,t){return(e.name||t.name)+"/"+(e.storeName||t.storeName)+"/"}function V(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function K(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}function G(e,t){var r=this;if(t=K.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var i=this.config();e.name=e.name||i.name,e.storeName=e.storeName||i.storeName}return{promise:e.name?new Promise(function(t){t(e.storeName?W(e,r._defaultConfig):e.name+"/")}):Promise.reject("Invalid arguments"),callback:t}}function Y(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}var J={bufferToString:F,deserialize:function(e){if("__lfsc__:"!==e.substring(0,9))return JSON.parse(e);var t,r=e.substring(13),i=e.substring(9,13);if("blob"===i&&z.test(r)){var n=r.match(z);t=n[1],r=r.substring(n[0].length)}var s=H(r);switch(i){case"arbf":return s;case"blob":return function(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(s){if("TypeError"!==s.name)throw s;for(var r="u">typeof BlobBuilder?BlobBuilder:"u">typeof MSBlobBuilder?MSBlobBuilder:"u">typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,i=new r,n=0;n<e.length;n+=1)i.append(e[n]);return i.getBlob(t.type)}}([s],{type:t});case"si08":return new Int8Array(s);case"ui08":return new Uint8Array(s);case"uic8":return new Uint8ClampedArray(s);case"si16":return new Int16Array(s);case"ur16":return new Uint16Array(s);case"si32":return new Int32Array(s);case"ui32":return new Uint32Array(s);case"fl32":return new Float32Array(s);case"fl64":return new Float64Array(s);default:throw Error("Unkown type: "+i)}},serialize:function(e,t){var r="";if(e&&(r=q.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===q.call(e.buffer))){var i=void 0,n="__lfsc__:";e instanceof ArrayBuffer?(i=e,n+="arbf"):(i=e.buffer,"[object Int8Array]"===r?n+="si08":"[object Uint8Array]"===r?n+="ui08":"[object Uint8ClampedArray]"===r?n+="uic8":"[object Int16Array]"===r?n+="si16":"[object Uint16Array]"===r?n+="ur16":"[object Int32Array]"===r?n+="si32":"[object Uint32Array]"===r?n+="ui32":"[object Float32Array]"===r?n+="fl32":"[object Float64Array
510]"===r?n+="fl64":t(Error("Failed to get type for BinaryArray"))),t(n+F(i))}else if("[object Blob]"===r){var s=new FileReader;s.onload=function(){t("__lfsc__:blob"+("~~local_forage_type~"+e.type+"~")+F(this.result))},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},stringToBuffer:H},X="localforage-driver-memory",Q={},Z=function(){function e(e){this.kp=e,this.data={}}return e.resolve=function(t){return Q[t]||(Q[t]=new e(t)),Q[t]},e.prototype.clear=function(){this.data={}},e.prototype.drop=function(){this.clear(),delete Q[this.kp]},e.prototype.get=function(e){return this.data[e]},e.prototype.key=function(e){return this.keys()[e]},e.prototype.keys=function(){return Object.keys(this.data)},e.prototype.rm=function(e){delete this.data[e]},e.prototype.set=function(e,t){this.data[e]=t},e}();function ee(e){var t=e?function e(t){if(null===t||"object"!=typeof t||"isActiveClone"in t)return t;var r,i,n=t instanceof Date?new Date(t):t.constructor();try{for(var s=N(Object.keys(t)),o=s.next();!o.done;o=s.next()){var a=o.value;Object.prototype.hasOwnProperty.call(t,a)&&(t.isActiveClone=null,n[a]=e(t[a]),delete t.isActiveClone)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return n}(e):{},r=W(t,this._defaultConfig),i=Z.resolve(r);return this._dbInfo=t,this._dbInfo.serializer=J,this._dbInfo.keyPrefix=r,this._dbInfo.mStore=i,Promise.resolve()}function et(e){var t=this,r=this.ready().then(function(){t._dbInfo.mStore.clear()});return V(r,e),r}function er(e,t){var r=G.apply(this,arguments),i=r.promise,n=r.callback;return V(i.then(function(e){Z.resolve(e).drop()}),n),i}function ei(e,t){var r=this;e=Y(e);var i=this.ready().then(function(){var t=r._dbInfo.mStore.get(e);return null==t?null:r._dbInfo.serializer.deserialize(t)});return V(i,t),i}function en(e,t){var r=this,i=this.ready().then(function(){for(var t=r._dbInfo.mStore,i=t.keys(),n=0;n<i.length;n++){var s=t.get(i[n]);if(s&&(s=r._dbInfo.serializer.deserialize(s)),void 0!==(s=e(s,i[n],n+1)))return s}});return V(i,t),i}function es(e,t){var r=this,i=this.ready().then(function(){var t;try{t=r._dbInfo.mStore.key(e),void 0===t&&(t=null)}catch{t=null}return t});return V(i,t),i}function eo(e){var t=this,r=this.ready().then(function(){return t._dbInfo.mStore.keys()});return V(r,e),r}function ea(e){var t=this.keys().then(function(e){return e.length});return V(t,e),t}function ec(e,t){var r=this;e=Y(e);var i=this.ready().then(function(){r._dbInfo.mStore.rm(e)});return V(i,t),i}function el(e,t,r){var i=this;e=Y(e);var n=this.ready().then(function(){void 0===t&&(t=null);var r=t;return new Promise(function(n,s){i._dbInfo.serializer.serialize(t,function(t,o){if(o)s(o);else try{i._dbInfo.mStore.set(e,t),n(r)}catch(e){s(e)}})})});return V(n,r),n}var eh=!0,eu={display:"none",position:"fixed",top:"0",right:"0",width:"100%",height:"100%",borderRadius:"0",border:"none",opacity:"0",zIndex:"-1"},ed=class extends i.WO{activeElement=null;iframe;relayerSrc=(0,i.kC)(`/send?params=${encodeURIComponent(this.parameters)}`,this.endpoint).href;init(){this.test="hello",this.iframe=new Promise(e=>{let t=()=>{var t;if(t=encodeURIComponent(this.parameters),[].slice.call(document.querySelectorAll(".magic-iframe")).find(e=>e.src.includes(t)))(0,i.M8)().log();else{let t=document.createElement("iframe");t.classList.add("magic-iframe"),t.dataset.magicIframeLabel=(0,i.kC)(this.endpoint).host,t.title="Secure Modal",t.src=this.relayerSrc,t.allow="clipboard-read; clipboard-write",function(e){for(let[t,r]of Object.entries(eu))e.style[t]=r}(t),document.body.appendChild(t),e(t)}};["loaded","interactive","complete"].includes(document.readyState)?t():window.addEventListener("load",t,!1)}),this.iframe.then(e=>{e instanceof HTMLIFrameElement&&e.addEventListener("load",async()=>{this.heartbeatDebounce()})}),window.addEventListener("message",e=>{if(e.origin===this.endpoint&&e.data.msgType){if(e.data.msgType.includes(n.rK.MAGIC_PONG))this.lastPongTime=Date.now();else if(e.data.msgType.includes(n.rK.MAGIC_THIRD_PARTY_WALLET_REQUEST))return void this.thirdPartyWalletRequestHandler(e.data);if(e.data&&this.messageHandlers.size)for(let t of(e.data.response=e.data.response??{}
510,this.stopHeartBeat(),this.messageHandlers.values()))t(e)}}),window.addEventListener("beforeunload",()=>{this.stopHeartBeat()})}async showOverlay(){let e=await this.iframe;e.style.display="block",e.style.zIndex="2147483647",e.style.opacity="1",this.activeElement=document.activeElement,e.focus()}async hideOverlay(){let e=await this.iframe;e.style.display="none",e.style.zIndex="-1",e.style.opacity="0",this.activeElement?.focus&&this.activeElement.focus(),this.activeElement=null}async _post(e){let t=await this.iframe;if(t&&t.contentWindow)t.contentWindow.postMessage(e,this.endpoint);else throw(0,i.qw)()}async checkRelayerExistsInDOM(){let e=await this.iframe;return!!e&&!!e.contentWindow&&!![].slice.call(document.querySelectorAll(".magic-iframe")).find(e=>e.src.includes(encodeURIComponent(this.parameters)))}async reloadRelayer(){let e=await this.iframe;if(this.stopHeartBeat(),!e){this.init(),console.warn("Magic SDK: Modal lost, re-initiating");return}if(!e.contentWindow){document.body.appendChild(e),console.warn("Magic SDK: Modal did not append in the iframe, re-initiating");return}e&&(e.src=this.relayerSrc)}},ef=(0,i.JH)(i._L,{platform:"web",sdkName:"magic-sdk",version:"33.7.1",defaultEndpoint:"https://auth.magic.link/",ViewController:ed,configureStorage:async()=>{let e=m.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"});return await e.defineDriver(y),await e.setDriver([m.default.INDEXEDDB,m.default.LOCALSTORAGE,X]),e}})},57317:(e,t,r)=>{"use strict";r.d(t,{A:()=>b,V:()=>b});var i=r(16459),n=r(52749),s=r.n(n),o=r(25042),a=r(50155),c=Object.defineProperty,l=Object.defineProperties,h=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable,p=(e,t,r)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,g=(e,t)=>{for(var r in t||(t={}))d.call(t,r)&&p(e,r,t[r]);if(u)for(var r of u(t))f.call(t,r)&&p(e,r,t[r]);return e},m=(e,t)=>l(e,h(t));let y={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class b{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new i.EventEmitter,this.isAvailable=!1,this.registering=!1,!(0,a.isHttpUrl)(e))throw Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{let t=(0,o.h)(e),r=await (await s()(this.url,m(g({},y),{body:t}))).json();this.onPayload({data:r})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!(0,a.isHttpUrl)(e))throw Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){let e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise((e,t)=>{this.events.once("register_error",e=>{this.resetMaxListeners(),t(e)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return t(Error("HTTP connection is missing or invalid"));e()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){let t=(0,o.h)({id:1,jsonrpc:"2.0",method:"test",params:[]});await s()(e,m(g({},y),{body:t}))}this.onOpen()}catch(t){let e=this.parseError(t);throw this.events.emit("register_error",e),this.onClose(),e}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;let t="string"==typeof e.data?(0,o.j)(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let r=this.parseError(t),i=r.message||r.toString(),n=(0,a.formatJsonRpcError)(e,i);this.events.emit("payload",n)}parseError(e,t=this.url){return(0,a.parseConnectionError)(e,t,"HTTP")}
510resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}}},58051:(e,t,r)=>{"use strict";r.d(t,{U:()=>h});var i=r(70524),n=r(28977),s=r(12319),o=r(44826),a=r(67695),c=r(65374);let l=(0,i.BX)({currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[]}),h={state:l,replaceState(e){e&&Object.assign(l,(0,i.KR)(e))},subscribe:e=>a.W.subscribeChainProp("accountState",t=>{if(t)return e(t)}),subscribeKey(e,t,r){let i;return a.W.subscribeChainProp("accountState",r=>{if(r){let n=r[e];i!==n&&(i=n,t(n))}},r)},setStatus(e,t){a.W.setAccountProp("status",e,t)},getCaipAddress:e=>a.W.getAccountProp("caipAddress",e),setCaipAddress(e,t){let r=e?s.w.getPlainAddress(e):void 0;t===a.W.state.activeChain&&(a.W.state.activeCaipAddress=e),a.W.setAccountProp("caipAddress",e,t),a.W.setAccountProp("address",r,t)},setBalance(e,t,r){a.W.setAccountProp("balance",e,r),a.W.setAccountProp("balanceSymbol",t,r)},setProfileName(e,t){a.W.setAccountProp("profileName",e,t)},setProfileImage(e,t){a.W.setAccountProp("profileImage",e,t)},setUser(e,t){a.W.setAccountProp("user",e,t)},setAddressExplorerUrl(e,t){a.W.setAccountProp("addressExplorerUrl",e,t)},setSmartAccountDeployed(e,t){a.W.setAccountProp("smartAccountDeployed",e,t)},setCurrentTab(e){a.W.setAccountProp("currentTab",e,a.W.state.activeChain)},setTokenBalance(e,t){e&&a.W.setAccountProp("tokenBalance",e,t)},setShouldUpdateToAddress(e,t){a.W.setAccountProp("shouldUpdateToAddress",e,t)},setAllAccounts(e,t){a.W.setAccountProp("allAccounts",e,t)},addAddressLabel(e,t,r){let i=a.W.getAccountProp("addressLabels",r)||new Map;i.set(e,t),a.W.setAccountProp("addressLabels",i,r)},removeAddressLabel(e,t){let r=a.W.getAccountProp("addressLabels",t)||new Map;r.delete(e),a.W.setAccountProp("addressLabels",r,t)},setConnectedWalletInfo(e,t){a.W.setAccountProp("connectedWalletInfo",e,t,!1)},setPreferredAccountType(e,t){a.W.setAccountProp("preferredAccountType",e,t)},setSocialProvider(e,t){e&&a.W.setAccountProp("socialProvider",e,t)},setSocialWindow(e,t){a.W.setAccountProp("socialWindow",e?(0,i.KR)(e):void 0,t)},setFarcasterUrl(e,t){a.W.setAccountProp("farcasterUrl",e,t)},async fetchTokenBalance(e){l.balanceLoading=!0;let t=a.W.state.activeCaipNetwork?.caipNetworkId,r=a.W.state.activeCaipNetwork?.chainNamespace,i=a.W.state.activeCaipAddress,h=i?s.w.getPlainAddress(i):void 0;if(l.lastRetry&&!s.w.isAllowedRetry(l.lastRetry,30*n.oU.ONE_SEC_MS))return l.balanceLoading=!1,[];try{if(h&&t&&r){let e=(await o.T.getBalance(h,t)).balances.filter(e=>"0"!==e.quantity.decimals);return this.setTokenBalance(e,r),l.lastRetry=void 0,l.balanceLoading=!1,e}}catch(t){l.lastRetry=Date.now(),e?.(t),c.P.showError("Token Balance Unavailable")}finally{l.balanceLoading=!1}return[]},resetAccount(e){a.W.resetAccount(e)}}},58222:(e,t,r)=>{"use strict";r.d(t,{xW:()=>b,sH:()=>eH,dI:()=>eF});var i={};r.r(i),r.d(i,{identity:()=>O});var n={};r.r(n),r.d(n,{base2:()=>P});var s={};r.r(s),r.d(s,{base8:()=>T});var o={};r.r(o),r.d(o,{base10:()=>M});var a={};r.r(a),r.d(a,{base16:()=>R,base16upper:()=>k});var c={};r.r(c),r.d(c,{base32:()=>D,base32hex:()=>j,base32hexpad:()=>z,base32hexpadupper:()=>q,base32hexupper:()=>$,base32pad:()=>U,base32padupper:()=>B,base32upper:()=>L,base32z:()=>H});var l={};r.r(l),r.d(l,{base36:()=>F,base36upper:()=>W});var h={};r.r(h),r.d(h,{base58btc:()=>V,base58flickr:()=>K});var u={};r.r(u),r.d(u,{base64:()=>G,base64pad:()=>Y,base64url:()=>J,base64urlpad:()=>X});var d={};r.r(d),r.d(d,{base256emoji:()=>et});var f={};r.r(f),r.d(f,{sha256:()=>ef,sha512:()=>ep});var p={};r.r(p),r.d(p,{identity:()=>eg});var g={};r.r(g),r.d(g,{code:()=>ey,decode:()=>ew,encode:()=>eb,name:()=>em});var m={};function y(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function b(e,t){t||(t=e.reduce((e,t)=>e+t.length,0));let r=y(t),i=0;for(let t of e)r.set(t,i),i+=t.length;return r}r.r(m),r.d(m,{code:()=>e_,decode:()=>eA,encode:()=>eI,name:()=>eE});let w=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==r[o])throw TypeError(s+" is ambiguous");r[o]=n}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function u(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[0]){for(var i=0,n=0;e[t]===c;)i++,t++;for(var s=(e.length-t)*l+1>>>0,o=new Uint8Array(s);e[t];){var h=r[e.charCodeAt(t)];if(255===h)return;for(var u=0,d=s-1;(0!==h||u<n)&&-1!==d;d--,u++)h+=a*o[d]>>>0,o[d]=h%256>>>0,h=h/256>>>0;if(0!==h)throw Error("Non-zero carry");n=u,t++}if(" "!==e[t]){for(var f=s-n;f!==s&&0===o[f];)f++;for(var p=new Uint8Array(i+(s-f)),g=i;f!==s;)p[g++]=o[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*h+1>>>0,l=new Uint8Array(o);n!==s;){for(var u=t[n],d=0,f=o-1;(0!==u||d<i)&&-1!==f;f--,d++)u+=256*l[f]>>>0,l[f]=u%a>>>0,u=u/a>>>0;if(0!==u)throw Error("Non-zero carry");i=d,n++}for(var p=o-i;p!==o&&0===l[p];)p++;for(var g=c.repeat(r);p<o;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:u,decode:function(e){var r=u(e);if(r)return r;throw Error(`Non-${t} character`)}}};new Uint8Array(0);let v=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error("Unknown type, must be binary type")};class x{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class E{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name}
510 decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return I(this,e)}}class _{constructor(e){this.decoders=e}or(e){return I(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}let I=(e,t)=>new _({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class A{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new x(e,t,r),this.decoder=new E(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let S=({name:e,prefix:t,encode:r,decode:i})=>new A(e,t,r,i),C=({prefix:e,name:t,alphabet:r})=>{let{encode:i,decode:n}=w(r,t);return S({prefix:e,name:t,encode:i,decode:e=>v(n(e))})},N=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>S({prefix:t,name:e,encode:e=>((e,t,r)=>{let i="="===t[t.length-1],n=(1<<r)-1,s="",o=0,a=0;for(let i=0;i<e.length;++i)for(a=a<<8|e[i],o+=8;o>r;)o-=r,s+=t[n&a>>o];if(o&&(s+=t[n&a<<r-o]),i)for(;s.length*r&7;)s+="=";return s})(e,i,r),decode:t=>((e,t,r,i)=>{let n={};for(let e=0;e<t.length;++e)n[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;let o=new Uint8Array(s*r/8|0),a=0,c=0,l=0;for(let t=0;t<s;++t){let s=n[e[t]];if(void 0===s)throw SyntaxError(`Non-${i} character`);c=c<<r|s,(a+=r)>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw SyntaxError("Unexpected end of data");return o})(t,i,r,e)}),O=S({prefix:"\0",name:"identity",encode:e=>new TextDecoder().decode(e),decode:e=>new TextEncoder().encode(e)}),P=N({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),T=N({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),M=C({prefix:"9",name:"base10",alphabet:"0123456789"}),R=N({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),k=N({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),D=N({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),L=N({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),U=N({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),B=N({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),j=N({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$=N({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),z=N({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),q=N({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),H=N({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),F=C({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),W=C({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),V=C({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),K=C({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),G=N({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Y=N({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),J=N({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),X=N({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Q=Array.from("\uD83D\uDE80\uD83E\uDE90â\uD83D\uDEF0\uD83C\uDF0C\uD83C\uDF11\uD83C\uDF12\uD83C\uDF13\uD83C\uDF14\uD83C\uDF15\uD83C\uDF16\uD83C\uDF17\uD83C\uDF18\uD83C\uDF0D\uD83C\uDF0F\uD83C\uDF0E\uD83D\uDC09â\uD83D\uDCBB\uD83D\uDDA5\uD83D\uDCBE\uD83D\uDCBF\uD83D\uDE02â¤\uD83D\uDE0D\uD83E\uDD23\uD83D\uDE0A\uD83D\uDE4F\uD83D\uDC95\uD83D\uDE2D\uD83D\uDE18\uD83D\uDC4D\uD83D\uDE05\uD83D\uDC4F\uD83D\uDE01\uD83D\uDD25\uD83E\uDD70\uD83D\uDC94\uD83D\uDC96\uD83D\uDC99\uD83D\uDE22\uD83E\uDD14\uD83D\uDE06\uD83D\uDE44\uD83D\uDCAA\uD83D\uDE09âº\uD83D\uDC4C\uD83E\uDD17\uD83D\uDC9C\uD83D\uDE14\uD83D\uDE0E\uD83D\uDE07\uD83C\uDF39\uD83E\uDD26\uD83C\uDF89\uD83D\uDC9Eââ¨\uD83E\uDD37\uD83D\uDE31\uD83D\uDE0C\uD83C\uDF38\uD83D\uDE4C\uD83D\uDE0B\uD83D\uDC97\uD83D\uDC9A\uD83D\uDE0F\uD83D\uDC9B\uD83D\uDE42\uD83D\uDC93\uD83E\uDD29\uD83D\uDE04\uD83D\uDE00\uD83D\uDDA4\uD83D\uDE03\uD83D\uDCAF\uD83D\uDE48\uD83D\uDC47\uD83C\uDFB6\uD83D\uDE12\uD83E\uDD2Dâ£\uD83D\uDE1C\uD83D\uDC8B\uD83D\uDC40\uD83D\uDE2A\uD83D\uDE11\uD83D\uDCA5\uD83D\uDE4B\uD83D\uDE1E\uD83D\uDE29\uD83D\uDE21\uD83E\uDD2A\uD83D\uDC4A\uD83E\uDD73\uD83D\uDE25\uD83E\uDD24\uD83D\uDC49\uD83D\uDC83\uD83D\uDE33â\uD83D\uDE1A\uD83D\uDE1D\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE2C\uD83D\uDE43\uD83C\uDF40\uD83C\uDF37\uD83D\uDE3B\uD83D\uDE13ââ
\uD83E\uDD7A\uD83C\uDF08\uD83D\uDE08\uD83E\uDD18\uD83D\uDCA6â\uD83D\uDE23\uD83C\uDFC3\uD83D\uDC90â¹\uD83C\uDF8A\uD83D\uDC98\uD83D\uDE20â\uD83D\uDE15\uD83C\uDF3A\uD83C\uDF82\uD83C\uDF3B\uD83D\uDE10\uD83D\uDD95\uD83D\uDC9D\uD83D\uDE4A\uD83D\uDE39\uD83D\uDDE3\uD83D\uDCAB\uD83D\uDC80\uD83D\uDC51\uD83C\uDFB5\uD83E\uDD1E\uD83D\uDE1B\uD83D\uDD34\uD83D\uDE24\uD83C\uDF3C\uD83D\uDE2Bâ½\uD83E\uDD19â\uD83C\uDFC6\uD83E\uDD2B\uD83D\uDC48\uD83D\uDE2E\uD83D\uDE46\uD83C\uDF7B\uD83C\uDF43\uD83D\uDC36\uD83D\uDC81\uD83D\uDE32\uD83C\uDF3F\uD83E\uDDE1\uD83C\uDF81â¡\uD83C\uDF1E\uD83C\uDF88ââ\uD83D\uDC4B\uD83D\uDE30\uD83E\uDD28\uD83D\uDE36\uD83E\uDD1D\uD83D\uDEB6\uD83D\uDCB0\uD83C\uDF53\uD83D\uDCA2\uD83E\uDD1F\uD83D\uDE41\uD83D\uDEA8\uD83D\uDCA8\uD83E\uDD2Câ\uD83C\uDF80\uD83C\uDF7A\uD83E\uDD13\uD83D\uDE19\uD83D\uDC9F\uD83C\uDF31\uD83D\uDE16\uD83D\uDC76\uD83E\uDD74â¶â¡â\uD83D\uDC8E\uD83D\uDCB8â¬\uD83D\uDE28\uD83C\uDF1A\uD83E\uDD8B\uD83D\uDE37\uD83D\uDD7Aâ \uD83D\uDE45\uD83D\uDE1F\uD83D\uDE35\uD83D\uDC4E\uD83E\uDD32\uD83E\uDD20\uD83E\uDD27\uD83D\uDCCC\uD83D\uDD35\uD83D\uDC85\uD83E\uDDD0\uD83D\uDC3E\uD83C\uDF52\uD83D\uDE17\uD83E\uDD11\uD83C\uDF0A\uD83E\uDD2F\uD83D\uDC37â\uD83D\uDCA7\uD83D\uDE2F\uD83D\uDC86\uD83D\uDC46\uD83C\uDFA4\uD83D\uDE47\uD83C\uDF51â\uD83C\uDF34\uD83D\uDCA3\uD83D\uDC38\uD83D\uDC8C\uD83D\uDCCD\uD83E\uDD40\uD83E\uDD22\uD83D\uDC45\uD83D\uDCA1\uD83D\uDCA9\uD83D\uDC50\uD83D\uDCF8\uD83D\uDC7B\uD83E\uDD10\uD83E\uDD2E\uD83C\uDFBC\uD83E\uDD75\uD83D\uDEA9\uD83C\uDF4E\uD83C\uDF4A\uD83D\uDC7C\uD83D\uDC8D\uD83D\uDCE3\uD83E\uDD42"),Z=Q.reduce((e,t,r)=>(e[r]=t,e),[]),ee=Q.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]),et=S({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>
510e+=Z[t],"")},decode:function(e){let t=[];for(let r of e){let e=ee[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}});function er(e,t,r){t=t||[];for(var i=r=r||0;e>=0x80000000;)t[r++]=255&e|128,e/=128;for(;-128&e;)t[r++]=255&e|128,e>>>=7;return t[r]=0|e,er.bytes=r-i+1,t}function ei(e,t){var r,i=0,t=t||0,n=0,s=t,o=e.length;do{if(s>=o)throw ei.bytes=0,RangeError("Could not decode varint");r=e[s++],i+=n<28?(127&r)<<n:(127&r)*Math.pow(2,n),n+=7}while(r>=128);return ei.bytes=s-t,i}let en={encode:er,decode:ei,encodingLength:function(e){return e<128?1:e<16384?2:e<2097152?3:e<0x10000000?4:e<0x800000000?5:e<0x40000000000?6:e<0x2000000000000?7:e<0x100000000000000?8:e<0x8000000000000000?9:10}},es=(e,t=0)=>[en.decode(e,t),en.decode.bytes],eo=(e,t,r=0)=>(en.encode(e,t,r),t),ea=e=>en.encodingLength(e),ec=(e,t)=>{let r=t.byteLength,i=ea(e),n=i+ea(r),s=new Uint8Array(n+r);return eo(e,s,0),eo(r,s,i),s.set(t,n),new el(e,r,t,s)};class el{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}let eh=({name:e,code:t,encode:r})=>new eu(e,t,r);class eu{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?ec(this.code,t):t.then(e=>ec(this.code,e))}throw Error("Unknown type, must be binary type")}}let ed=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),ef=eh({name:"sha2-256",code:18,encode:ed("SHA-256")}),ep=eh({name:"sha2-512",code:19,encode:ed("SHA-512")}),eg={code:0,name:"identity",encode:v,digest:e=>ec(0,v(e))},em="raw",ey=85,eb=e=>v(e),ew=e=>v(e),ev=new TextEncoder,ex=new TextDecoder,eE="json",e_=512,eI=e=>ev.encode(JSON.stringify(e)),eA=e=>JSON.parse(ex.decode(e));
510class eS{constructor(e,t,r,i){this.code=t,this.version=e,this.multihash=r,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:eD,byteLength:eD,code:ek,version:ek,multihash:ek,bytes:ek,_baseCache:eD,asCID:eD})}toV0(){if(0===this.version)return this;{let{code:e,multihash:t}=this;if(e!==eP)throw Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==eT)throw Error("Cannot convert non sha2-256 multihash CID to CIDv0");return eS.createV0(t)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,r=ec(e,t);return eS.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){var t,r;return e&&this.code===e.code&&this.version===e.version&&((t=this.multihash)===(r=e.multihash)||t.code===r.code&&t.size===r.size&&((e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0})(t.bytes,r.bytes))}toString(e){let{bytes:t,version:r,_baseCache:i}=this;return 0===r?eN(t,i,e||V.encoder):eO(t,i,e||D.encoder)}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return eL(/^0\.0/,eU),!!(e&&(e[eR]||e.asCID===e))}get toBaseEncodedString(){throw Error("Deprecated, use .toString()")}get codec(){throw Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw Error('"multibaseName" property is deprecated')}get prefix(){throw Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof eS)return e;if(null!=e&&e.asCID===e){let{version:t,code:r,multihash:i,bytes:n}=e;return new eS(t,r,i,n||eM(t,r,i.bytes))}if(null==e||!0!==e[eR])return null;{let{version:t,multihash:r,code:i}=e,n=(e=>{let t=v(e),[r,i]=es(t),[n,s]=es(t.subarray(i)),o=t.subarray(i+s);if(o.byteLength!==n)throw Error("Incorrect length");return new el(r,n,o,t)})(r);return eS.create(t,i,n)}}static create(e,t,r){if("number"!=typeof t)throw Error("String codecs are no longer supported");switch(e){case 0:if(t===eP)return new eS(e,t,r,r.bytes);throw Error(`Version 0 CID must use dag-pb (code: ${eP}) block encoding`);case 1:{let i=eM(e,t,r.bytes);return new eS(e,t,r,i)}default:throw Error("Invalid version")}}static createV0(e){return eS.create(0,eP,e)}static createV1(e,t){return eS.create(1,e,t)}static decode(e){let[t,r]=eS.decodeFirst(e);if(r.length)throw Error("Incorrect length");return t}static decodeFirst(e){let t=eS.inspectBytes(e),r=t.size-t.multihashSize,i=v(e.subarray(r,r+t.multihashSize));if(i.byteLength!==t.multihashSize)throw Error("Incorrect length");let n=i.subarray(t.multihashSize-t.digestSize),s=new el(t.multihashCode,t.digestSize,n,i);return[0===t.version?eS.createV0(s):eS.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,r=()=>{let[r,i]=es(e.subarray(t));return t+=i,r},i=r(),n=eP;if(18===i?(i=0,t=0):1===i&&(n=r()),0!==i&&1!==i)throw RangeError(`Invalid CID version ${i}`);let s=t,o=r(),a=r(),c=t+a;return{version:i,codec:n,multihashCode:o,digestSize:a,multihashSize:c-s,size:c}}static parse(e,t){let[r,i]=eC(e,t),n=eS.decode(i);return n._baseCache.set(r,e),n}}let eC=(e,t)=>{switch(e[0]){case"Q":{let r=t||V;return[V.prefix,r.decode(`${V.prefix}${e}`)]}case V.prefix:{let r=t||V;return[V.prefix,r.decode(e)]}case D.prefix:{let r=t||D;return[D.prefix,r.decode(e)]}default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}},eN=(e,t,r)=>{let{prefix:i}=r;if(i!==V.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let n=t.get(i);if(null!=n)return n;{let n=r.encode(e).slice(1);return t.set(i,n),n}},eO=(e,t,r)=>{let{prefix:i}=r,n=t.get(i);if(null!=n)return n;{let n=r.encode(e);return t.set(i,n),n}},eP=112,eT=18,eM=(e,t,r)=>{let i=ea(e),n=i+ea(t),s=new Uint8Array(n+r.byteLength);return eo(e,s,0),eo(t,s,i),s.set(r,n),s}
510,eR=Symbol.for("@ipld/js-cid/CID"),ek={writable:!1,configurable:!1,enumerable:!0},eD={writable:!1,enumerable:!1,configurable:!1},eL=(e,t)=>{if(e.test("0.0.0-dev"))console.warn(t);else throw Error(t)},eU=`CID.isCID(v) is deprecated and will be removed in the next major release. 511Following code pattern: 512 513if (CID.isCID(value)) { 514 doSomethingWithCID(value) 515} 516 517Is replaced with: 518 519const cid = CID.asCID(value) 520if (cid) { 521 // Make sure to use cid instead of value 522 doSomethingWithCID(cid) 523} 524`,eB={...i,...n,...s,...o,...a,...c,...l,...h,...u,...d};function ej(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}({...f,...p});let e$=ej("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),ez=ej("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{let t=y((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),eq={utf8:e$,"utf-8":e$,hex:eB.base16,latin1:ez,ascii:ez,binary:ez,...eB};function eH(e,t="utf8"){let r=eq[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?globalThis.Buffer.from(e,"utf8"):r.decoder.decode(`${r.prefix}${e}`)}function eF(e,t="utf8"){let r=eq[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}},58653:(e,t,r)=>{"use strict";r.d(t,{i:()=>n});var i=r(93965);let n={cacheExpiry:{portfolio:3e4,nativeBalance:3e4,ens:3e5,identity:3e5},isCacheExpired:(e,t)=>Date.now()-e>t,getActiveNetworkProps(){let e=n.getActiveNamespace(),t=n.getActiveCaipNetworkId(),r=t?t.split(":")[1]:void 0;return{namespace:e,caipNetworkId:t,chainId:r?isNaN(Number(r))?r:Number(r):void 0}},setWalletConnectDeepLink({name:e,href:t}){try{i.Ud.setItem(i.Ws.DEEPLINK_CHOICE,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{let e=i.Ud.getItem(i.Ws.DEEPLINK_CHOICE);if(e)return JSON.parse(e)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{i.Ud.removeItem(i.Ws.DEEPLINK_CHOICE)}catch{console.info("Unable to delete WalletConnect deep link")}},setActiveNamespace(e){try{i.Ud.setItem(i.Ws.ACTIVE_NAMESPACE,e)}catch{console.info("Unable to set active namespace")}},setActiveCaipNetworkId(e){try{i.Ud.setItem(i.Ws.ACTIVE_CAIP_NETWORK_ID,e),n.setActiveNamespace(e.split(":")[0])}catch{console.info("Unable to set active caip network id")}},getActiveCaipNetworkId(){try{return i.Ud.getItem(i.Ws.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to get active caip network id");return}},deleteActiveCaipNetworkId(){try{i.Ud.removeItem(i.Ws.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to delete active caip network id")}},deleteConnectedConnectorId(e){try{let t=(0,i.T8)(e);i.Ud.removeItem(t)}catch{console.info("Unable to delete connected connector id")}},setAppKitRecent(e){try{let t=n.getRecentWallets();t.find(t=>t.id===e.id)||(t.unshift(e),t.length>2&&t.pop(),i.Ud.setItem(i.Ws.RECENT_WALLETS,JSON.stringify(t)))}catch{console.info("Unable to set AppKit recent")}},getRecentWallets(){try{let e=i.Ud.getItem(i.Ws.RECENT_WALLETS);return e?JSON.parse(e):[]}catch{console.info("Unable to get AppKit recent")}return[]},setConnectedConnectorId(e,t){try{let r=(0,i.T8)(e);i.Ud.setItem(r,t)}catch{console.info("Unable to set Connected Connector Id")}},getActiveNamespace(){try{return i.Ud.getItem(i.Ws.ACTIVE_NAMESPACE)}catch{console.info("Unable to get active namespace")}},getConnectedConnectorId(e){if(e)try{let t=(0,i.T8)(e);return i.Ud.getItem(t)}catch(t){console.info("Unable to get connected connector id in namespace ",e)}},setConnectedSocialProvider(e){try{i.Ud.setItem(i.Ws.CONNECTED_SOCIAL,e)}catch{console.info("Unable to set connected social provider")}},getConnectedSocialProvider(){try{return i.Ud.getItem(i.Ws.CONNECTED_SOCIAL)}catch{console.info("Unable to get connected social provider")}},deleteConnectedSocialProvider(){try{i.Ud.removeItem(i.Ws.CONNECTED_SOCIAL)}catch{console.info("Unable to delete connected social provider")}},getConnectedSocialUsername(){try{return i.Ud.getItem(i.Ws.CONNECTED_SOCIAL_USERNAME)}catch{console.info("Unable to get connected social username")}},getStoredActiveCaipNetworkId(){let e=i.Ud.getItem(i.Ws.ACTIVE_CAIP_NETWORK_ID);return e?.split(":")?.[1]},setConnectionStatus(e){try{i.Ud.setItem(i.Ws.CONNECTION_STATUS,e)}catch{console.info("Unable to set connection status")}},getConnectionStatus(){try{return i.Ud.getItem(i.Ws.CONNECTION_STATUS)}catch{return}},getConnectedNamespaces(){try{let e=i.Ud.getItem(i.Ws.CONNECTED_NAMESPACES);if(!e?.length)return[];return e.split(",")}catch{return[]}},setConnectedNamespaces(e){try{let t=Array.from(new Set(e));i.Ud.setItem(i.Ws.CONNECTED_NAMESPACES,t.join(","))}catch{console.info("Unable to set namespaces in storage")}},addConnectedNamespace(e){try{let t=n.getConnectedNamespaces();t.includes(e)||(t.push(e),n.setConnectedNamespaces(t))}catch{console.info("Unable to add connected namespace")}},removeConnectedNamespace(e){try{let t=n.getConnectedNamespaces(),r=t.indexOf(e);r>-1&&(t.splice(r,1),n.setConnectedNamespaces(t))}catch{console.info("Unable to remove connected namespace")}},getTelegramSocialProvider(){try{return i.Ud.getItem(i.Ws.TELEGRAM_SOCIAL_PROVIDER)}catch{return console.info("Unable to get telegram social provider"),null}},setTelegramSocialProvider(e){try{i.Ud.setItem(i.Ws.TELEGRAM_SOCIAL_PROVIDER,e)}catch{console.info("Unable to set telegram social provider")}},removeTelegramSocialProvider(){try{i.Ud.removeItem(i.Ws.TELEGRAM_SOCIAL_PROVIDER)}catch{console.info("Unable to remove telegram social provider")}},getBalanceCache(){let e={};try{let t=i.Ud.getItem(i.Ws.PORTFOLIO_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get balance cache")}return e},removeAddressFromBalanceCache(e){try{let t=n.getBalanceCache();i.Ud.setItem(i.Ws.PORTFOLIO_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove address from balance cache",e)}},getBalanceCacheForCaipAddress(e){try{let t=n.getBalanceCache()[e];if(t&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.portfolio))return t.balance;n.removeAddressFromBalanceCache(e)}catch{console.info("Unable to get balance cache for address",e)}},updateBalanceCache(e){try{let t=n.getBalanceCache();t[e.caipAddress]=e,i.Ud.setItem(i.Ws.PORTFOLIO_CACHE,JSON.stringify(t))}catch{console.info("Unable to update balance cache",e)}},getNativeBalanceCache(){let e={};try{let t=i.Ud.getItem(i.Ws.NATIVE_BALANCE_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get balance cache")}return e},removeAddressFromNativeBalanceCache(e){try{let t=n.getBalanceCache();i.Ud.setItem(i.Ws.NATIVE_BALANCE_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove address from balance cache",e)}},getNativeBalanceCacheForCaipAddress(e){try{let t=n.getNativeBalanceCache()[e];if(t&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.nativeBalance))return t;console.info("Discarding cache for address",e),n.removeAddressFromBalanceCache(e)}catch{console.info("Unable to get balance cache for address",e)}},updateNativeBalanceCache(e){try{let t=n.getNativeBalanceCache();t[e.caipAddress]=e,i.Ud.setItem(i.Ws.NATIVE_BALANCE_CACHE,JSON.stringify(t))}catch{console.info("Unable to update balance cache",e)}},getEnsCache(){let e={};try{let t=i.Ud.getItem(i.Ws.ENS_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get ens name cache")}return e}
524,getEnsFromCacheForAddress(e){try{let t=n.getEnsCache()[e];if(t&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.ens))return t.ens;n.removeEnsFromCache(e)}catch{console.info("Unable to get ens name from cache",e)}},updateEnsCache(e){try{let t=n.getEnsCache();t[e.address]=e,i.Ud.setItem(i.Ws.ENS_CACHE,JSON.stringify(t))}catch{console.info("Unable to update ens name cache",e)}},removeEnsFromCache(e){try{let t=n.getEnsCache();i.Ud.setItem(i.Ws.ENS_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove ens name from cache",e)}},getIdentityCache(){let e={};try{let t=i.Ud.getItem(i.Ws.IDENTITY_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get identity cache")}return e},getIdentityFromCacheForAddress(e){try{let t=n.getIdentityCache()[e];if(t&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.identity))return t.identity;n.removeIdentityFromCache(e)}catch{console.info("Unable to get identity from cache",e)}},updateIdentityCache(e){try{let t=n.getIdentityCache();t[e.address]={identity:e.identity,timestamp:e.timestamp},i.Ud.setItem(i.Ws.IDENTITY_CACHE,JSON.stringify(t))}catch{console.info("Unable to update identity cache",e)}},removeIdentityFromCache(e){try{let t=n.getIdentityCache();i.Ud.setItem(i.Ws.IDENTITY_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove identity from cache",e)}},clearAddressCache(){try{i.Ud.removeItem(i.Ws.PORTFOLIO_CACHE),i.Ud.removeItem(i.Ws.NATIVE_BALANCE_CACHE),i.Ud.removeItem(i.Ws.ENS_CACHE),i.Ud.removeItem(i.Ws.IDENTITY_CACHE)}catch{console.info("Unable to clear address cache")}}}},60036:(e,t,r)=>{"use strict";r.d(t,{Vw:()=>d,Fc:()=>l,Id:()=>u,O8:()=>o,qv:()=>c,po:()=>p,Ow:()=>a,ZJ:()=>h,DH:()=>s,ld:()=>f});let i="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;var n=r(81480);function s(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function o(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function a(e,t){return e<<32-t|e>>>t}let c=68===new Uint8Array(new Uint32Array([0x11223344]).buffer)[0];function l(e){for(let r=0;r<e.length;r++){var t;e[r]=(t=e[r])<<24&0xff000000|t<<8&0xff0000|t>>>8&65280|t>>>24&255}}function h(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(e)),(0,n.DO)(e),e}function u(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];(0,n.DO)(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){let n=e[t];r.set(n,i),i+=n.length}return r}class d{clone(){return this._cloneInto()}}function f(e){let t=t=>e().update(h(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function p(e=32){if(i&&"function"==typeof i.getRandomValues)return i.getRandomValues(new Uint8Array(e));if(i&&"function"==typeof i.randomBytes)return i.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}},60316:(e,t,r)=>{"use strict";var i;i=r(16611),r(38530),r(93136),r(53475),r(9956),r(26721),r(11816),r(47413),r(92475),r(36202),r(67626),r(47467),r(81055),r(82544),r(83247),r(53985),r(93524),r(99229),r(49327),r(28397),r(81530),r(4707),r(44020),r(89643),r(89955),r(9748),r(42307),r(53832),r(23511),r(68851),r(87796),r(2497),r(19276),r(30120),r(93142),e.exports=i},60480:(e,t,r)=>{"use strict";r.d(t,{H:()=>i});class i{}},62546:e=>{function t(e){if(!e||e<1)throw Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}t.prototype.set=function(e,t,r,i){let n=e*this.size+t;this.data[n]=r,i&&(this.reservedBit[n]=!0)},t.prototype.get=function(e,t){return this.data[e*this.size+t]},t.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r},t.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},e.exports=t},64663:(e,t,r)=>{"use strict";function i(){return(null===r.g||void 0===r.g?void 0:r.g.crypto)||(null===r.g||void 0===r.g?void 0:r.g.msCrypto)||{}}function n(){let e=i();return e.subtle||e.webkitSubtle}
524Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowserCryptoAvailable=t.getSubtleCrypto=t.getBrowerCrypto=void 0,t.getBrowerCrypto=i,t.getSubtleCrypto=n,t.isBrowserCryptoAvailable=function(){return!!i()&&!!n()}},64874:(e,t,r)=>{"use strict";var i=r(20920),n=r(3285);function s(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=s,s.prototype.update=function(e,t){if(e=i.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},s.prototype.digest=function(e){return this.update(this._pad()),n(null===this.pending),this._digest(e)},s.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,i=Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(e<<=3,"big"===this.endian){for(var s=8;s<this.padLength;s++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=e>>>24&255,i[n++]=e>>>16&255,i[n++]=e>>>8&255,i[n++]=255&e}else for(s=8,i[n++]=255&e,i[n++]=e>>>8&255,i[n++]=e>>>16&255,i[n++]=e>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0;s<this.padLength;s++)i[n++]=0;return i}},65374:(e,t,r)=>{"use strict";r.d(t,{P:()=>c});var i=r(70524),n=r(98866),s=r(12319);let o=Object.freeze({message:"",variant:"success",svg:void 0,open:!1,autoClose:!0}),a=(0,i.BX)({...o}),c={state:a,subscribeKey:(e,t)=>(0,n.u$)(a,e,t),showLoading(e,t={}){this._showMessage({message:e,variant:"loading",...t})},showSuccess(e){this._showMessage({message:e,variant:"success"})},showSvg(e,t){this._showMessage({message:e,svg:t})},showError(e){let t=s.w.parseError(e);this._showMessage({message:t,variant:"error"})},hide(){a.message=o.message,a.variant=o.variant,a.svg=o.svg,a.open=o.open,a.autoClose=o.autoClose},_showMessage({message:e,svg:t,variant:r="success",autoClose:i=o.autoClose}){a.open?(a.open=!1,setTimeout(()=>{a.message=e,a.variant=r,a.svg=t,a.open=!0,a.autoClose=i},150)):(a.message=e,a.variant=r,a.svg=t,a.open=!0,a.autoClose=i)}}},65727:(e,t,r)=>{"use strict";let i=r(88759);e.exports=s;let n=function(){function e(e){return void 0!==e&&e}try{if("undefined"!=typeof globalThis)return globalThis;return Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{};function s(e){var t,r;(e=e||{}).browser=e.browser||{};let i=e.browser.transmit;if(i&&"function"!=typeof i.send)throw Error("pino: transmit option must have a send function");let h=e.browser.write||n;e.browser.write&&(e.browser.asObject=!0);let u=e.serializers||{},g=(t=e.browser.serialize,Array.isArray(t)?t.filter(function(e){return"!stdSerializers.err"!==e}):!0===t&&Object.keys(u)),m=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(m=!1),"function"==typeof h&&(h.error=h.fatal=h.warn=h.info=h.debug=h.trace=h),!1===e.enabled&&(e.level="silent");let y=e.level||"info",b=Object.create(h);b.log||(b.log=d),Object.defineProperty(b,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(b,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,o(w,b,"error","log"),o(w,b,"fatal","error"),o(w,b,"warn","error"),o(w,b,"info","log"),o(w,b,"debug","log"),o(w,b,"trace","log")}});let w={transmit:i,serialize:g,asObject:e.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:"function"==typeof(r=e).timestamp?r.timestamp:!1===r.timestamp?f:p};return b.levels=s.levels,b.level=y,b.setMaxListeners=b.getMaxListeners=b.emit=b.addListener=b.on=b.prependListener=b.once=b.prepe
524ndOnceListener=b.removeListener=b.removeAllListeners=b.listeners=b.listenerCount=b.eventNames=b.write=b.flush=d,b.serializers=u,b._serialize=g,b._stdErrSerialize=m,b.child=function(t,r){if(!t)throw Error("missing bindings for child Pino");r=r||{},g&&t.serializers&&(r.serializers=t.serializers);let n=r.serializers;if(g&&n){var s=Object.assign({},u,n),o=!0===e.browser.serialize?Object.keys(s):g;delete t.serializers,a([t],o,s,this._stdErrSerialize)}function h(e){this._childLevel=(0|e._childLevel)+1,this.error=c(e,t,"error"),this.fatal=c(e,t,"fatal"),this.warn=c(e,t,"warn"),this.info=c(e,t,"info"),this.debug=c(e,t,"debug"),this.trace=c(e,t,"trace"),s&&(this.serializers=s,this._serialize=o),i&&(this._logEvent=l([].concat(e._logEvent.bindings,t)))}return h.prototype=this,new h(this)},i&&(b._logEvent=l()),b}function o(e,t,r,o){let c=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?d:c[r]?c[r]:n[r]||n[o]||d,function(e,t,r){if(e.transmit||t[r]!==d){var o;t[r]=(o=t[r],function(){let c=e.timestamp(),h=Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===n?n:this;for(var d=0;d<h.length;d++)h[d]=arguments[d];if(e.serialize&&!e.asObject&&a(h,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?o.call(u,function(e,t,r,n){e._serialize&&a(r,e._serialize,e.serializers,e._stdErrSerialize);let o=r.slice(),c=o[0],l={};n&&(l.time=n),l.level=s.levels.values[t];let h=(0|e._childLevel)+1;if(h<1&&(h=1),null!==c&&"object"==typeof c){for(;h--&&"object"==typeof o[0];)Object.assign(l,o.shift());c=o.length?i(o.shift(),o):void 0}else"string"==typeof c&&(c=i(o.shift(),o));return void 0!==c&&(l.msg=c),l}(this,r,h,c)):o.apply(u,h),e.transmit){let i=e.transmit.level||t.level,n=s.levels.values[i],o=s.levels.values[r];if(o<n)return;!function(e,t,r){let i=t.send,n=t.ts,s=t.methodLevel,o=t.methodValue,c=t.val,h=e._logEvent.bindings;a(r,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=n,e._logEvent.messages=r.filter(function(e){return -1===h.indexOf(e)}),e._logEvent.level.label=s,e._logEvent.level.value=o,i(s,e._logEvent,c),e._logEvent=l(h)}(this,{ts:c,methodLevel:r,methodValue:o,transmitLevel:i,transmitValue:s.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},h)}})}}(e,t,r)}function a(e,t,r,i){for(let n in e)if(i&&e[n]instanceof Error)e[n]=s.stdSerializers.err(e[n]);else if("object"==typeof e[n]&&!Array.isArray(e[n]))for(let i in e[n])t&&t.indexOf(i)>-1&&i in r&&(e[n][i]=r[i](e[n][i]))}function c(e,t,r){return function(){let i=Array(1+arguments.length);i[0]=t;for(var n=1;n<i.length;n++)i[n]=arguments[n-1];return e[r].apply(this,i)}}function l(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function h(){return{}}function u(e){return e}function d(){}function f(){return!1}function p(){return Date.now()}s.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},s.stdSerializers={mapHttpRequest:h,mapHttpResponse:h,wrapRequestSerializer:u,wrapResponseSerializer:u,wrapErrorSerializer:u,req:h,res:h,err:function(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)void 0===t[r]&&(t[r]=e[r]);return t}},s.stdTimeFunctions=Object.assign({},{nullTime:f,epochTime:p,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}})},65927:(e,t,r)=>{"use strict";let i=r(32774).v4;e.exports=function(e,t,r,n){if("string"!=typeof e)throw TypeError(e+" must be a string");let s="number"==typeof(n=n||{}).version?n.version:2;if(1!==s&&2!==s)throw TypeError(s+" must be 1 or 2");let o={method:e};if(2===s&&(o.jsonrpc="2.0"),t){if("object"!=typeof t&&!Array.isArray(t))throw TypeError(t+" must be an object, array or omitted");o.params=t}return void 0===r?o.id=("function"==typeof n.generator?n.generator:function(){return i()})(o,n):2===s&&null===r?n.notificationIdNull&&(o.id=null):o.id=r,o}},66254:(e,t,r)=>{"use strict";r.d(t,{a:()=>m});var i=r(70524),n=r(98866),s=r(67934),o=r(52617),a=r(67695);let c={handleSolanaDeeplinkRedirect(e){if(a.W.state.activeChain===s.o.CHAIN.SOLANA){let t=window.location.href,r=encodeURIComponent(t);if("Phantom"===e&&!("phantom"in window)){let e=t.startsWith("https")?"https":"http",i=t.split("/")[2],n=encodeURIComponent(`${e}://${i}`);window.location.href=`https://phantom.app/ul/browse/${r}?ref=${n}`}"Coinbase Wallet"!==e||"coinbaseSolana"in window||(window.location.href=`https://go.cb-w.com/dapp?cb_url=${r}`)}}};var l=r(58653),h=r(72880),u=r(55480),d=r(67869),f=r(45069);let p={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0},g=(0,i.BX)({allConnectors:[],connectors:[],activeConnector:void 0,filterByNamespace:void 0,activeConnectorIds:{...p}}),m={state:g,subscribe:e=>(0,i.B1)(g,()=>{e(g)}),subscribeKey:(e,t)=>
524(0,n.u$)(g,e,t),initialize(e){e.forEach(e=>{let t=l.i.getConnectedConnectorId(e);t&&this.setConnectorId(t,e)})},setActiveConnector(e){e&&(g.activeConnector=(0,i.KR)(e))},setConnectors(e){e.filter(e=>!g.allConnectors.some(t=>t.id===e.id&&this.getConnectorName(t.name)===this.getConnectorName(e.name)&&t.chain===e.chain)).forEach(e=>{"MULTI_CHAIN"!==e.type&&g.allConnectors.push((0,i.KR)(e))}),g.connectors=this.mergeMultiChainConnectors(g.allConnectors)},removeAdapter(e){g.allConnectors=g.allConnectors.filter(t=>t.chain!==e),g.connectors=this.mergeMultiChainConnectors(g.allConnectors)},mergeMultiChainConnectors(e){let t=this.generateConnectorMapByName(e),r=[];return t.forEach(e=>{let t=e[0],i=t?.id===s.o.CONNECTOR_ID.AUTH;e.length>1&&t?r.push({name:t.name,imageUrl:t.imageUrl,imageId:t.imageId,connectors:[...e],type:i?"AUTH":"MULTI_CHAIN",chain:"eip155",id:t?.id||""}):t&&r.push(t)}),r},generateConnectorMapByName(e){let t=new Map;return e.forEach(e=>{let{name:r}=e,i=this.getConnectorName(r);if(!i)return;let n=t.get(i)||[];n.find(t=>t.chain===e.chain)||n.push(e),t.set(i,n)}),t},getConnectorName:e=>e&&({"Trust Wallet":"Trust"})[e]||e,getUniqueConnectorsByName(e){let t=[];return e.forEach(e=>{t.find(t=>t.chain===e.chain)||t.push(e)}),t},addConnector(e){if(e.id===s.o.CONNECTOR_ID.AUTH){let t=(0,i.P9)(u.H.state),r=f.W.getSnapshot().themeMode,n=f.W.getSnapshot().themeVariables;e?.provider?.syncDappData?.({metadata:t.metadata,sdkVersion:t.sdkVersion,projectId:t.projectId,sdkType:t.sdkType}),e?.provider?.syncTheme({themeMode:r,themeVariables:n,w3mThemeVariables:(0,o.o)(n,r)}),this.setConnectors([e])}else this.setConnectors([e])},getAuthConnector(e){let t=e||a.W.state.activeChain,r=g.connectors.find(e=>e.id===s.o.CONNECTOR_ID.AUTH);if(r)return r?.connectors?.length?r.connectors.find(e=>e.chain===t):r},getAnnouncedConnectorRdns:()=>g.connectors.filter(e=>"ANNOUNCED"===e.type).map(e=>e.info?.rdns),getConnectorById:e=>g.allConnectors.find(t=>t.id===e),getConnector:(e,t)=>g.allConnectors.filter(e=>e.chain===a.W.state.activeChain).find(r=>r.explorerId===e||r.info?.rdns===t),syncIfAuthConnector(e){if("ID_AUTH"!==e.id)return;let t=(0,i.P9)(u.H.state),r=f.W.getSnapshot().themeMode,n=f.W.getSnapshot().themeVariables;e?.provider?.syncDappData?.({metadata:t.metadata,sdkVersion:t.sdkVersion,sdkType:t.sdkType,projectId:t.projectId}),e.provider.syncTheme({themeMode:r,themeVariables:n,w3mThemeVariables:(0,o.o)(n,r)})},getConnectorsByNamespace(e){let t=g.allConnectors.filter(t=>t.chain===e);return this.mergeMultiChainConnectors(t)},selectWalletConnector(e){let t=m.getConnector(e.id,e.rdns);a.W.state.activeChain===s.o.CHAIN.SOLANA&&c.handleSolanaDeeplinkRedirect(t?.name||e.name||""),t?d.I.push("ConnectingExternal",{connector:t}):d.I.push("ConnectingWalletConnect",{wallet:e})},getConnectors(e){return e?this.getConnectorsByNamespace(e):this.mergeMultiChainConnectors(g.allConnectors)},setFilterByNamespace(e){g.filterByNamespace=e,g.connectors=this.getConnectors(e),h.N.setFilterByNamespace(e)},setConnectorId(e,t){e&&(g.activeConnectorIds={...g.activeConnectorIds,[t]:e},l.i.setConnectedConnectorId(t,e))},removeConnectorId(e){g.activeConnectorIds={...g.activeConnectorIds,[e]:void 0},l.i.deleteConnectedConnectorId(e)},getConnectorId(e){if(e)return g.activeConnectorIds[e]},isConnected:e=>e?!!g.activeConnectorIds[e]:Object.values(g.activeConnectorIds).some(e=>!!e),resetConnectorIds(){g.activeConnectorIds={...p}}}},66725:(e,t,r)=>{var i;function n(e){this.rand=e}if(e.exports=function(e){return i||(i=new n(null)),i.generate(e)},e.exports.Rand=n,n.prototype.generate=function(e){return this._rand(e)},n.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r<t.length;r++)t[r]=this.rand.getByte();return t},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?n.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"==typeof window&&(n.prototype._rand=function(){throw Error("Not implemented yet")});else try{var s=r(73776);if("function"!=typeof s.randomBytes)throw Error("Not supported");n.prototype._rand=function(e){return s.randomBytes(e)}}catch(e){}},67243:(e,t,r)=>{"use strict";r.d(t,{U:()=>g}),r(33124);var i=r(67934),n=r(73537),s=r(58051),o=r(67695),a=r(88097),c=r(66254),l=r(70417),h=r(81701),u=r(55480),d=r(67869),f=r(65374),p=r(12319);let g={getSIWX:()=>u.H.state.siwx,async initializeIfEnabled(){let e=u.H.state.siwx,t=o.W.getActiveCaipAddress();if(!(e&&t))return;let[r,i,n]=t.split(":");if(o.W.checkIfSupportedNetwork(r))try{if((await e.getSessions(`${r}:${i}`,n)).length)return;await h.W.open({view:"SIWXSignMessage"})}catch(e){console.error("SIWXUtil:initializeIfEnabled",e),l.E.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:this.getSIWXEventProperties()}),await a.x._getClient()?.disconnect().catch(console.error),d.I.reset("Connect"),f.P.showError("A problem occurred while trying initialize authentication")}},async requestSignMessage(){let e=u.H.state.siwx,t=p.w.getPlainAddress(o.W.getActiveCaipAddress()),r
524=o.W.getActiveCaipNetwork(),n=a.x._getClient();if(!e)throw Error("SIWX is not enabled");if(!t)throw Error("No ActiveCaipAddress found");if(!r)throw Error("No ActiveCaipNetwork or client found");if(!n)throw Error("No ConnectionController client found");try{let s=await e.createMessage({chainId:r.caipNetworkId,accountAddress:t}),o=s.toString();c.a.getConnectorId(r.chainNamespace)===i.o.CONNECTOR_ID.AUTH&&d.I.pushTransactionStack({view:null,goBack:!1,replace:!0});let a=await n.signMessage(o);await e.addSession({data:s,message:o,signature:a}),h.W.close(),l.E.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:this.getSIWXEventProperties()})}catch(t){let e=this.getSIWXEventProperties();h.W.state.open&&"ApproveTransaction"!==d.I.state.view||await h.W.open({view:"SIWXSignMessage"}),e.isSmartAccount?f.P.showError("This application might not support Smart Accounts"):f.P.showError("Signature declined"),l.E.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:e}),console.error("SWIXUtil:requestSignMessage",t)}},async cancelSignMessage(){try{let e=this.getSIWX();e?.getRequired?.()?await a.x.disconnect():h.W.close(),d.I.reset("Connect"),l.E.sendEvent({event:"CLICK_CANCEL_SIWX",type:"track",properties:this.getSIWXEventProperties()})}catch(e){console.error("SIWXUtil:cancelSignMessage",e)}},async getSessions(){let e=u.H.state.siwx,t=p.w.getPlainAddress(o.W.getActiveCaipAddress()),r=o.W.getActiveCaipNetwork();return e&&t&&r?e.getSessions(r.caipNetworkId,t):[]},async isSIWXCloseDisabled(){let e=this.getSIWX();if(e){let t="ApproveTransaction"===d.I.state.view,r="SIWXSignMessage"===d.I.state.view;
524if(t||r)return e.getRequired?.()&&0===(await this.getSessions()).length}return!1},async universalProviderAuthenticate({universalProvider:e,chains:t,methods:r}){let i=g.getSIWX(),n=new Set(t.map(e=>e.split(":")[0]));if(!i||1!==n.size||!n.has("eip155"))return!1;let a=await i.createMessage({chainId:o.W.getActiveCaipNetwork()?.caipNetworkId||"",accountAddress:""}),c=await e.authenticate({nonce:a.nonce,domain:a.domain,uri:a.uri,exp:a.expirationTime,iat:a.issuedAt,nbf:a.notBefore,requestId:a.requestId,version:a.version,resources:a.resources,statement:a.statement,chainId:a.chainId,methods:r,chains:[a.chainId,...t.filter(e=>e!==a.chainId)]});if(f.P.showLoading("Authenticating...",{autoClose:!1}),s.U.setConnectedWalletInfo({...c.session.peer.metadata,name:c.session.peer.metadata.name,icon:c.session.peer.metadata.icons?.[0],type:"WALLET_CONNECT"},Array.from(n)[0]),c?.auths?.length){let t=c.auths.map(t=>{let r=e.client.formatAuthMessage({request:t.p,iss:t.p.iss});return{data:{...t.p,accountAddress:t.p.iss.split(":").slice(-1).join(""),chainId:t.p.iss.split(":").slice(2,4).join(":"),uri:t.p.aud,version:t.p.version||a.version,expirationTime:t.p.exp,issuedAt:t.p.iat,notBefore:t.p.nbf},message:r,signature:t.s.s,cacao:t}});try{await i.setSessions(t),l.E.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:g.getSIWXEventProperties()})}catch(t){throw console.error("SIWX:universalProviderAuth - failed to set sessions",t),l.E.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:g.getSIWXEventProperties()}),await e.disconnect().catch(console.error),t}finally{f.P.hide()}}return!0},getSIWXEventProperties:()=>({network:o.W.state.activeCaipNetwork?.caipNetworkId||"",isSmartAccount:s.U.state.preferredAccountType===n.Vl.ACCOUNT_TYPES.SMART_ACCOUNT}),async clearSessions(){let e=this.getSIWX();e&&await e.setSessions([])}}},67626:(e,t,r)=>{"use strict";e.exports=function(e){return!function(){var t=e.lib.Hasher,r=e.x64,i=r.Word,n=r.WordArray,s=e.algo;function o(){return i.create.apply(i,arguments)}for(var a=[o(0x428a2f98,0xd728ae22),o(0x71374491,0x23ef65cd),o(0xb5c0fbcf,0xec4d3b2f),o(0xe9b5dba5,0x8189dbbc),o(0x3956c25b,0xf348b538),o(0x59f111f1,0xb605d019),o(0x923f82a4,0xaf194f9b),o(0xab1c5ed5,0xda6d8118),o(0xd807aa98,0xa3030242),o(0x12835b01,0x45706fbe),o(0x243185be,0x4ee4b28c),o(0x550c7dc3,0xd5ffb4e2),o(0x72be5d74,0xf27b896f),o(0x80deb1fe,0x3b1696b1),o(0x9bdc06a7,0x25c71235),o(0xc19bf174,0xcf692694),o(0xe49b69c1,0x9ef14ad2),o(0xefbe4786,0x384f25e3),o(0xfc19dc6,0x8b8cd5b5),o(0x240ca1cc,0x77ac9c65),o(0x2de92c6f,0x592b0275),o(0x4a7484aa,0x6ea6e483),o(0x5cb0a9dc,0xbd41fbd4),o(0x76f988da,0x831153b5),o(0x983e5152,0xee66dfab),o(0xa831c66d,0x2db43210),o(0xb00327c8,0x98fb213f),o(0xbf597fc7,0xbeef0ee4),o(0xc6e00bf3,0x3da88fc2),o(0xd5a79147,0x930aa725),o(0x6ca6351,0xe003826f),o(0x14292967,0xa0e6e70),o(0x27b70a85,0x46d22ffc),o(0x2e1b2138,0x5c26c926),o(0x4d2c6dfc,0x5ac42aed),o(0x53380d13,0x9d95b3df),o(0x650a7354,0x8baf63de),o(0x766a0abb,0x3c77b2a8),o(0x81c2c92e,0x47edaee6),o(0x92722c85,0x1482353b),o(0xa2bfe8a1,0x4cf10364),o(0xa81a664b,0xbc423001),o(0xc24b8b70,0xd0f89791),o(0xc76c51a3,0x654be30),o(0xd192e819,0xd6ef5218),o(0xd6990624,0x5565a910),o(0xf40e3585,0x5771202a),o(0x106aa070,0x32bbd1b8),o(0x19a4c116,0xb8d2d0c8),o(0x1e376c08,0x5141ab53),o(0x2748774c,0xdf8eeb99),o(0x34b0bcb5,0xe19b48a8),o(0x391c0cb3,0xc5c95a63),o(0x4ed8aa4a,0xe3418acb),o(0x5b9cca4f,0x7763e373),o(0x682e6ff3,0xd6b2b8a3),o(0x748f82ee,0x5defb2fc),o(0x78a5636f,0x43172f60),o(0x84c87814,0xa1f0ab72),o(0x8cc70208,0x1a6439ec),o(0x90befffa,0x23631e28),o(0xa4506ceb,0xde82bde9),o(0xbef9a3f7,0xb2c67915),o(0xc67178f2,0xe372532b),o(0xca273ece,0xea26619c),o(0xd186b8c7,0x21c0c207),o(0xeada7dd6,0xcde0eb1e),o(0xf57d4f7f,0xee6ed178),o(0x6f067aa,0x72176fba),o(0xa637dc5,0xa2c898a6),o(0x113f9804,0xbef90dae),o(0x1b710b35,0x131c471b),o(0x28db77f5,0x23047d84),o(0x32caab7b,0x40c72493),o(0x3c9ebe0a,0x15c9bebc),o(0x431d67c4,0x9c100d4c),o(0x4cc5d4be,0xcb3e42b6),o(0x597f299c,0xfc657e2a),o(0x5fcb6fab,0x3ad6faec),o(0x6c44198c,0x4a475817)],c=[],l=0;l<80;l++)c[l]=o();var h=s.SHA512=t.extend({_doReset:function(){this._hash=new n.init([new i.init(0x6a09e66
5247,0xf3bcc908),new i.init(0xbb67ae85,0x84caa73b),new i.init(0x3c6ef372,0xfe94f82b),new i.init(0xa54ff53a,0x5f1d36f1),new i.init(0x510e527f,0xade682d1),new i.init(0x9b05688c,0x2b3e6c1f),new i.init(0x1f83d9ab,0xfb41bd6b),new i.init(0x5be0cd19,0x137e2179)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],l=r[4],h=r[5],u=r[6],d=r[7],f=i.high,p=i.low,g=n.high,m=n.low,y=s.high,b=s.low,w=o.high,v=o.low,x=l.high,E=l.low,_=h.high,I=h.low,A=u.high,S=u.low,C=d.high,N=d.low,O=f,P=p,T=g,M=m,R=y,k=b,D=w,L=v,U=x,B=E,j=_,$=I,z=A,q=S,H=C,F=N,W=0;W<80;W++){var V,K,G=c[W];if(W<16)K=G.high=0|e[t+2*W],V=G.low=0|e[t+2*W+1];else{var Y=c[W-15],J=Y.high,X=Y.low,Q=(J>>>1|X<<31)^(J>>>8|X<<24)^J>>>7,Z=(X>>>1|J<<31)^(X>>>8|J<<24)^(X>>>7|J<<25),ee=c[W-2],et=ee.high,er=ee.low,ei=(et>>>19|er<<13)^(et<<3|er>>>29)^et>>>6,en=(er>>>19|et<<13)^(er<<3|et>>>29)^(er>>>6|et<<26),es=c[W-7],eo=es.high,ea=es.low,ec=c[W-16],el=ec.high,eh=ec.low;K=Q+eo+ +((V=Z+ea)>>>0<Z>>>0),V+=en,K=K+ei+ +(V>>>0<en>>>0),V+=eh,G.high=K=K+el+ +(V>>>0<eh>>>0),G.low=V}var eu=U&j^~U&z,ed=B&$^~B&q,ef=O&T^O&R^T&R,ep=P&M^P&k^M&k,eg=(O>>>28|P<<4)^(O<<30|P>>>2)^(O<<25|P>>>7),em=(P>>>28|O<<4)^(P<<30|O>>>2)^(P<<25|O>>>7),ey=(U>>>14|B<<18)^(U>>>18|B<<14)^(U<<23|B>>>9),eb=(B>>>14|U<<18)^(B>>>18|U<<14)^(B<<23|U>>>9),ew=a[W],ev=ew.high,ex=ew.low,eE=F+eb,e_=H+ey+ +(eE>>>0<F>>>0),eE=eE+ed,e_=e_+eu+ +(eE>>>0<ed>>>0),eE=eE+ex,e_=e_+ev+ +(eE>>>0<ex>>>0),eE=eE+V,e_=e_+K+ +(eE>>>0<V>>>0),eI=em+ep,eA=eg+ef+ +(eI>>>0<em>>>0);H=z,F=q,z=j,q=$,j=U,$=B,U=D+e_+ +((B=L+eE|0)>>>0<L>>>0)|0,D=R,L=k,R=T,k=M,T=O,M=P,O=e_+eA+ +((P=eE+eI|0)>>>0<eE>>>0)|0}p=i.low=p+P,i.high=f+O+ +(p>>>0<P>>>0),m=n.low=m+M,n.high=g+T+ +(m>>>0<M>>>0),b=s.low=b+k,s.high=y+R+ +(b>>>0<k>>>0),v=o.low=v+L,o.high=w+D+ +(v>>>0<L>>>0),E=l.low=E+B,l.high=x+U+ +(E>>>0<B>>>0),I=h.low=I+$,h.high=_+j+ +(I>>>0<$>>>0),S=u.low=S+q,u.high=A+z+ +(S>>>0<q>>>0),N=d.low=N+F,d.high=C+H+ +(N>>>0<F>>>0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[(i+128>>>10<<5)+30]=Math.floor(r/0x100000000),t[(i+128>>>10<<5)+31]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(h),e.HmacSHA512=t._createHmacHelper(h)}(),e.SHA512}(r(16611),r(38530))},67695:(e,t,r)=>{"use strict";r.d(t,{W:()=>W});var i=r(70524),n=r(98866),s=r(76190),o=r(67934),a=r(66254);function c(e,t){return a.a.getConnectorId(e)===t}var l=r(28977),h=r(12319),u=r(58653),d=r(58051),f=r(88097),p=r(70417),g=r(81701),m=r(55480),y=r(6578),b=r(67869),w="[big.js] ",v=w+"Invalid ",x=v+"decimal places",E=v+"rounding mode",_=w+"Division by zero",I={},A=void 0,S=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function C(e,t,r,i){var n=e.c;if(r===A&&(r=e.constructor.RM),0!==r&&1!==r&&2!==r&&3!==r)throw Error(E);if(t<1)i=3===r&&(i||!!n[0])||0===t&&(1===r&&n[0]>=5||2===r&&(n[0]>5||5===n[0]&&(i||n[1]!==A))),n.length=1,i?(e.e=e.e-t+1,n[0]=1):n[0]=e.e=0;else if(t<n.length){if(i=1===r&&n[t]>=5||2===r&&(n[t]>5||5===n[t]&&(i||n[t+1]!==A||1&n[t-1]))||3===r&&(i||!!n[0]),n.length=t,i){for(;++n[--t]>9;)if(n[t]=0,0===t){++e.e,n.unshift(1);break}}for(t=n.length;!n[--t];)n.pop()}return e}function N(e,t,r){var i=e.e,n=e.c.join(""),s=n.length;if(t)n=n.charAt(0)+(s>1?"."+n.slice(1):"")+(i<0?"e":"e+")+i;else if(i<0){for(;++i;)n="0"+n;n="0."+n}else if(i>0)if(++i>s)for(i-=s;i--;)n+="0";else i<s&&(n=n.slice(0,i)+"."+n.slice(i));else s>1&&(n=n.charAt(0)+"."+n.slice(1));return e.s<0&&r?"-"+n:n}I.abs=function(){var e=new this.constructor(this);return e.s=1,e},I.cmp=function(e){var t,r=this.c,i=(e=new this.constructor(e)).c,n=this.s,s=e.s,o=this.e,a=e.e;if(!r[0]||!i[0])return r[0]?n:i[0]?-s:0;if(n!=s)return n;if(t=n<0,o!=a)return o>a^t?1:-1;for(n=-1,s=(o=r.length)<(a=i.length)?o:a;++n<s;)if(r[n]!=i[n])return r[n]>i[n]^t?1:-1;return o==a?0:o>a^t?1:-1},I.div=function(e){var t=this.constructor,r=this.c,i=(e=new t(e)).c,n=this.s==e.s?1:-1,s=t.DP;if(s!==~~s||s<0||s>1e6)throw Error(x);if(!i[0])throw Error(_);if(!r[0])return e.s=n,e.c=[e.e=0],e;var o,a,c,l,h,u=i.slice(),d=o=i.length,f=r.length,p=r.slice(0,o),g=p.length,m=e,y=m.c=[],b=0,w=s+(m.e=this.e-e.e)+1;for(m.s=n,n=w<0?0:w,u.unshift(0);g++<o;)p.push(0);do{for(c=0;c<10;c++){if(o!=(g=p.length))l=o>g?1:-1;else for(h=-1,l=0;++h<o;
524)if(i[h]!=p[h]){l=i[h]>p[h]?1:-1;break}if(l<0){for(a=g==o?i:u;g;){if(p[--g]<a[g]){for(h=g;h&&!p[--h];)p[h]=9;--p[h],p[g]+=10}p[g]-=a[g]}for(;!p[0];)p.shift()}else break}y[b++]=l?c:++c,p[0]&&l?p[g]=r[d]||0:p=[r[d]]}while((d++<f||p[0]!==A)&&n--);return!y[0]&&1!=b&&(y.shift(),m.e--,w--),b>w&&C(m,w,t.RM,p[0]!==A),m},I.eq=function(e){return 0===this.cmp(e)},I.gt=function(e){return this.cmp(e)>0},I.gte=function(e){return this.cmp(e)>-1},I.lt=function(e){return 0>this.cmp(e)},I.lte=function(e){return 1>this.cmp(e)},I.minus=I.sub=function(e){var t,r,i,n,s=this.constructor,o=this.s,a=(e=new s(e)).s;if(o!=a)return e.s=-a,this.plus(e);var c=this.c.slice(),l=this.e,h=e.c,u=e.e;if(!c[0]||!h[0])return h[0]?e.s=-a:c[0]?e=new s(this):e.s=1,e;if(o=l-u){for((n=o<0)?(o=-o,i=c):(u=l,i=h),i.reverse(),a=o;a--;)i.push(0);i.reverse()}else for(r=((n=c.length<h.length)?c:h).length,o=a=0;a<r;a++)if(c[a]!=h[a]){n=c[a]<h[a];break}if(n&&(i=c,c=h,h=i,e.s=-e.s),(a=(r=h.length)-(t=c.length))>0)for(;a--;)c[t++]=0;for(a=t;r>o;){if(c[--r]<h[r]){for(t=r;t&&!c[--t];)c[t]=9;--c[t],c[r]+=10}c[r]-=h[r]}for(;0===c[--a];)c.pop();for(;0===c[0];)c.shift(),--u;return c[0]||(e.s=1,c=[u=0]),e.c=c,e.e=u,e},I.mod=function(e){var t,r=this,i=r.constructor,n=r.s,s=(e=new i(e)).s;if(!e.c[0])throw Error(_);return(r.s=e.s=1,t=1==e.cmp(r),r.s=n,e.s=s,t)?new i(r):(n=i.DP,s=i.RM,i.DP=i.RM=0,r=r.div(e),i.DP=n,i.RM=s,this.minus(r.times(e)))},I.neg=function(){var e=new this.constructor(this);return e.s=-e.s,e},I.plus=I.add=function(e){var t,r,i,n=this.constructor;if(e=new n(e),this.s!=e.s)return e.s=-e.s,this.minus(e);var s=this.e,o=this.c,a=e.e,c=e.c;if(!o[0]||!c[0])return c[0]||(o[0]?e=new n(this):e.s=this.s),e;if(o=o.slice(),t=s-a){for(t>0?(a=s,i=c):(t=-t,i=o),i.reverse();t--;)i.push(0);i.reverse()}for(o.length-c.length<0&&(i=c,c=o,o=i),t=c.length,r=0;t;o[t]%=10)r=(o[--t]=o[t]+c[t]+r)/10|0;for(r&&(o.unshift(r),++a),t=o.length;0===o[--t];)o.pop();return e.c=o,e.e=a,e},I.pow=function(e){var t=this,r=new t.constructor("1"),i=r,n=e<0;if(e!==~~e||e<-1e6||e>1e6)throw Error(v+"exponent");for(n&&(e=-e);1&e&&(i=i.times(t)),e>>=1;)t=t.times(t);return n?r.div(i):i},I.prec=function(e,t){if(e!==~~e||e<1||e>1e6)throw Error(v+"precision");return C(new this.constructor(this),e,t)},I.round=function(e,t){if(e===A)e=0;else if(e!==~~e||e<-1e6||e>1e6)throw Error(x);return C(new this.constructor(this),e+this.e+1,t)},I.sqrt=function(){var e,t,r,i=this.constructor,n=this.s,s=this.e,o=new i("0.5");if(!this.c[0])return new i(this);if(n<0)throw Error(w+"No square root");0===(n=Math.sqrt(+N(this,!0,!0)))||n===1/0?((t=this.c.join("")).length+s&1||(t+="0"),s=((s+1)/2|0)-(s<0||1&s),e=new i(((n=Math.sqrt(t))==1/0?"5e":(n=n.toExponential()).slice(0,n.indexOf("e")+1))+s)):e=new i(n+""),s=e.e+(i.DP+=4);do r=e,e=o.times(r.plus(this.div(r)));while(r.c.slice(0,s).join("")!==e.c.slice(0,s).join(""));return C(e,(i.DP-=4)+e.e+1,i.RM)},I.times=I.mul=function(e){var t,r=this.constructor,i=this.c,n=(e=new r(e)).c,s=i.length,o=n.length,a=this.e,c=e.e;if(e.s=this.s==e.s?1:-1,!i[0]||!n[0])return e.c=[e.e=0],e;for(e.e=a+c,s<o&&(t=i,i=n,n=t,c=s,s=o,o=c),t=Array(c=s+o);c--;)t[c]=0;for(a=o;a--;){for(o=0,c=s+a;c>a;)o=t[c]+n[a]*i[c-a-1]+o,t[c--]=o%10,o=o/10|0;t[c]=o}for(o?++e.e:t.shift(),a=t.length;!t[--a];)t.pop();return e.c=t,e},I.toExponential=function(e,t){var r=this,i=r.c[0];if(e!==A){if(e!==~~e||e<0||e>1e6)throw Error(x);for(r=C(new r.constructor(r),++e,t);r.c.length<e;)r.c.push(0)}return N(r,!0,!!i)},I.toFixed=function(e,t){var r=this,i=r.c[0];if(e!==A){if(e!==~~e||e<0||e>1e6)throw Error(x);for(r=C(new r.constructor(r),e+r.e+1,t),e=e+r.e+1;r.c.length<e;)r.c.push(0)}return N(r,!1,!!i)},I[Symbol.for("nodejs.util.inspect.custom")]=I.toJSON=I.toString=function(){var e=this.constructor;return N(this,this.e<=e.NE||this.e>=e.PE,!!this.c[0])},I.toNumber=function(){var e=+N(this,!0,!0);if(!0===this.constructor.strict&&!this.eq(e.toString()))throw Error(w+"Imprecise conversion");return e},I.toPrecision=function(e,t){var r=this,i=r.constructor,n=r.c[0];if(e!==A){if(e!==~~e||e<1||e>1e6)throw Error(v+"precision");for(r=C(new i(r),e,t);r.c.length<e;)r.c.push(0)}return N(r,e<=r.e||r.e<=i.NE||r.e>=i.PE,!!n)},I.valueOf=function(){var e=this.constructor;if(!0===e.strict)throw Error(w+"valueOf disallowed");return N(this,this.e<=e.NE||this.e>=e.PE,!0)};var O=function e(){function t(r){if(!(this instanceof t))return r===A?e():new t(r);if(r instanceof t)this.s=r.s,this.e=r.e,this.c=r.c.slice();else{if("string"!=typeof r){if(!0===t.strict&&"bigint"!=typeof r)throw TypeError(v+"value");r=0===r&&1/r<0?"-0":String(r)}!function(e,t){var r,i,n;if(!S.test(t))throw Error(v+"number");for(e.s="-"==t.charAt(0)?(t=t.slice(1),-1):1,(r=t.indexOf("."))>-1&&(t=t.replace(".","")),(i=t.search(/e/i))>0?(r<0&&(r=i),r+=+t.slice(i+1),t=t.substring(0,i)):r<0&&(r=t.length),n=t.length,i=0;i<n&&"0"==t.charAt(i);)++i;if(i==n)e.c=[e.e=0];else{for(;n>0&&"0"==t.charAt(--n););for(e.e=r-i-1,e.c=[],r=0;i<=n;)e.c[r++]=+t.charAt(i++)}}(this,r)}this.constructor=t}return t.prototype=I,t.DP=20,t.RM=1,t.NE=-7,t.PE=21,t.strict=!1,t.roundDown=0,t.roundHalfUp=1,t.roundHalfEven=2,t.roundUp=3,t}();let P={bigNumber:e=>new O(e?e:0),multiply(e,t){if(void 0===e||void 0===t)return new O(0);let r=new O(e),i=new O(t);return r.times(i)},formatNumberToLocalString:(e,t=2)=>
524void 0===e?"0.00":"number"==typeof e?e.toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t}):parseFloat(e).toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t}),parseLocalStringToNumber:e=>void 0===e?0:parseFloat(e.replace(/,/gu,""))},T=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],M=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],R={getERC20Abi:e=>o.o.USDT_CONTRACT_ADDRESSES.includes(e)?M:T};var k=r(73537),D=r(44826),L=r(30598);let U={createBalance(e,t){let r={name:e.metadata.name||"",symbol:e.metadata.symbol||"",decimals:e.metadata.decimals||0,value:e.metadata.value||0,price:e.metadata.price||0,iconUrl:e.metadata.iconUrl||""};return{name:r.name,symbol:r.symbol,chainId:t,address:"native"===e.address?void 0:this.convertAddressToCAIP10Address(e.address,t),value:r.value,price:r.price,quantity:{decimals:r.decimals.toString(),numeric:this.convertHexToBalance({hex:e.balance,decimals:r.decimals})},iconUrl:r.iconUrl}},convertHexToBalance:({hex:e,decimals:t})=>(0,L.J)(BigInt(e),t),convertAddressToCAIP10Address:(e,t)=>`${t}:${e}`,createCAIP2ChainId:(e,t)=>`${t}:${parseInt(e,16)}`,getChainIdHexFromCAIP2ChainId(e){let t=e.split(":");if(t.length<2||!t[1])return"0x0";let r=parseInt(t[1],10);return isNaN(r)?"0x0":`0x${r.toString(16)}`},isWalletGetAssetsResponse(e){return"object"==typeof e&&null!==e&&Object.values(e).every(e=>Array.isArray(e)&&e.every(e=>this.isValidAsset(e)))},isValidAsset:e=>"object"==typeof e&&null!==e&&"string"==typeof e.address&&"string"==typeof e.balance&&("ERC20"===e.type||"NATIVE"===e.type)&&"object"==typeof e.metadata&&null!==e.metadata&&"string"==typeof e.metadata.name&&"string"==typeof e.metadata.symbol&&"number"==typeof e.metadata.decimals&&"number"==typeof e.metadata.price&&"string"==typeof e.metadata.iconUrl},B={async getMyTokensWithBalance(e){let t=d.U.state.address,r=W.state.activeCaipNetwork;if(!t||!r)return[];if("eip155"===r.chainNamespace){let e=await this.getEIP155Balances(t,r);if(e)return this.filterLowQualityTokens(e)}let i=await D.T.getBalance(t,r.caipNetworkId,e);return this.filterLowQualityTokens(i.balances)},async getEIP155Balances(e,t){try{let r=U.getChainIdHexFromCAIP2ChainId(t.caipNetworkId),i=await f.x.getCapabilities(e);if(!i?.[r]?.assetDiscovery?.supported)return null;let n=await f.x.walletGetAssets({account:e,chainFilter:[r]});if(!U.isWalletGetAssetsResponse(n))return null;return(n[r]||[]).map(e=>U.createBalance(e,t.caipNetworkId))}catch(e){return null}},filterLowQualityTokens:e=>e.filter(e=>"0"!==e.quantity.decimals),mapBalancesToSwapTokens:e=>e?.map(e=>({...e,address:e?.address?e.address:W.getActiveNetworkTokenAddress(),decimals:parseInt(e.quantity.decimals,10),logoUri:e.iconUrl,eip2612:!1}))||[]};var j=r(65374);let $=(0,i.BX)({tokenBalances:[],loading:!1}),z={state:$,subscribe:e=>(0,i.B1)($,()=>e($)),subscribeKey:(e,t)=>(0,n.u$)($,e,t),setToken(e){e&&($.token=(0,i.KR)(e))},setTokenAmount(e){$.sendTokenAmount=e},setReceiverAddress(e){$.receiverAddress=e},setReceiverProfileImageUrl(e){$.receiverProfileImageUrl=e},setReceiverProfileName(e){$.receiverProfileName=e},setGasPrice(e){$.gasPrice=e},setGasPriceInUsd(e){$.gasPriceInUSD=e},setNetworkBalanceInUsd(e){$.networkBalanceInUSD=e},setLoading(e){$.loading=e},sendToken(){switch(W.state.activeCaipNetwork?.chainNamespace){case"eip155":this.sendEvmToken();return;case"solana":this.sendSolanaToken();return;default:throw Error("Unsupported chain")}},sendEvmToken(){this.state.token?.address&&this.state.sendTokenAmount&&this.state.receiverAddress?(p.E.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:d.U.state.preferredAccountType===k.Vl.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token.address,amount:this.state.sendTokenAmount,network:W.state.activeCaipNetwork?.caipNetworkId||""}}),this.sendERC20Token({receiverAddress:this.state.receiverAddress,tokenAddress:this.state.token.address,sendTokenAmount:this.state.sendTokenAmount,decimals:this.state.token.quantity.decimals})):this.state.receiverAddress&&this.state.sendTokenAmount&&this.state.gasPrice&&this.state.token?.quantity.decimals&&(p.E.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:d.U.state.preferredAccountType===k.Vl.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token?.symbol,amount:this.state.sendTokenAmount,network:W.state.activeCaipNetwork?.caipNetworkId||""}}),this.sendNativeToken({receiverAddress:this.state.receiverAddress,sendTokenAmount:this.state.sendTokenAmount,gasPrice:this.state.gasPrice,decimals:this.state.token.quantity.decimals}))},async fetchTokenBalance(e){$.loading=!0;let t=W.state.activeCaipNetwork?.caipNetworkId,r=W.state.activeCaipNetwork?.chainNamespace,i=W.state.activeCaipAddress,n=i?h.w.getPlainAddress(i):void 0;if($.lastRetry&&!h.w.isAllowedRetry($.lastRetry,30*l.oU.ONE_SEC_MS))return $.loading=!1,[];try{if(n&&t&&r){let e=await B.getMyTokensWithBalance();return $.tokenBalances=e,$.lastRetry=void 0,e}}catch(t){$.lastRetry=Date.now(),e?.(t),j.P.showError("Token Balance Unavailable")}finally{$.loading=!1}return[]},fetchNetworkBalance(){if(0===$.tokenBalances.length)return;let e=B.mapBalancesToSwapTokens($.tokenBalances);if(!e)return;let t=e.find(e=>e.address===W.getActiveNetworkTokenAddress());t&&($.networkBalanceInUSD=t?P.multiply(t.quantity.numeric,t.price).toString():"0")},isInsufficientNetworkTokenForGas:(e,t)=>!!P.bigNumber(e).eq(0)||P.bigNumber(P.bigNumber(t||"0")).gt(e),hasInsufficientGasFunds(){let e=!0;return d.U.state.preferredAccountType===k.Vl.ACCOUNT_TYPES.SMART_ACCOUNT?e=!1:$.networkBalanceInUSD&&(e=this.isInsufficientNetworkTokenForGas($.networkBalanceInUSD,$.gasPriceInUSD)),e},async sendNativeToken(e){b.I.pushTransactionStack({view:"Account",goBack:!1});let t=e.receiverAddress,r=d.U.state.address,i=f.x.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals));try{await f.x.sendTransaction({chainNamespace:"eip155",to:t,address:r,data:"0x",value:i??BigInt(0),gasPrice:e.gasPrice}),j.P.showSuccess("Transaction started"),p.E.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:d.U.state.preferredAccountType===k.Vl.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token?.symbol||"",amount:e.sendTokenAmount,network:W.state.activeCaipNetwork?.caipNetworkId||""}}),this.resetSend()}catch(r){console.error("SendController:sendERC20Token - failed to send native token",r);let t=r instanceof Error?r.message:"Unknown error";p.E.sendEvent({type:"track",event:"SEND_ERROR",properties:{message:t,isSmartAccount:d.U.state.preferredAccountType===k.Vl.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token?.symbol||"",amount:e.sendTokenAmount,network:W.state.activeCaipNetwork?.caipNetworkId||""}}),j.P.showError("Something went wrong")}},async sendERC20Token(e){b.I.pushTransactionStack({view:"Account",goBack:!1});let t=f.x.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals));try{if(d.U.state.address&&e.sendTokenAmount&&e.receiverAddress&&e.tokenAddress){let r=h.w.getPlainAddress(e.tokenAddress);await f.x.writeContract({fromAddress:d.U.state.address,tokenAddress:r,args:[e.receiverAddress,t??BigInt(0)],method:"transfer",abi:R.getERC20Abi(r),chainNamespace:"eip155"}),j.P.showSuccess("Transaction started"),this.resetSend()}}catch(r){console.error("SendController:sendERC20Token - failed to send erc20 token",r);let t=r instanceof Error?r.message:"Unknown error";p.E.sendEvent({type:"track",event:"SEND_ERROR",properties:{message:t,isSmartAccount:d.U.state.preferredAccountType===k.Vl.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token?.symbol||"",amount:e.sendTokenAmount,network:W.state.activeCaipNetwork?.caipNetworkId||""}}),j.P.showError("Something went wrong")}},sendSolanaToken(){if(!this.state.sendTokenAmount||!this.state.receiverAddress)return void j.P.showError("Please enter a valid amount and receiver address");b.I.pushTransactionStack({view:"Account",goBack:!1}),f.x.sendTransaction({chainNamespace:"solana",to:this.state.receiverAddress,value:this.state.sendTokenAmount}).then(()=>{this.resetSend(),d.U.fetchTokenBalance()}).catch(e=>{j.P.showError("Failed to send transaction. Please try again."),console.error("SendController:sendToken - failed to send solana transaction",e)})},resetSend(){$.token=void 0,$.sendTokenAmount=void 0,$.receiverAddress=void 0,$.receiverProfileImageUrl=void 0,$.receiverProfileName=void 0,$.loading=!1,$.tokenBalances=[]}},q={currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[],user:void 0},H={caipNetwork:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]},F=(0,i.BX)({chains:(0,n.zC)(),activeCaipAddress:void 0,activeChain:void 0,activeCaipNetwork:void 0,noAdapters:!1,universalAdapter
524:{networkControllerClient:void 0,connectionControllerClient:void 0},isSwitchingNamespace:!1}),W={state:F,subscribe:e=>(0,i.B1)(F,()=>{e(F)}),subscribeKey:(e,t)=>(0,n.u$)(F,e,t),subscribeChainProp(e,t,r){let n;return(0,i.B1)(F.chains,()=>{let i=r||F.activeChain;if(i){let r=F.chains.get(i)?.[e];n!==r&&(n=r,t(r))}})},initialize(e,t,r){let{chainId:n,namespace:s}=u.i.getActiveNetworkProps(),o=t?.find(e=>e.id.toString()===n?.toString()),a=e.find(e=>e?.namespace===s)||e?.[0],c=new Set([...t?.map(e=>e.chainNamespace)??[]]);e?.length!==0&&a||(F.noAdapters=!0),!F.noAdapters&&(F.activeChain=a?.namespace,F.activeCaipNetwork=o,this.setChainNetworkData(a?.namespace,{caipNetwork:o}),F.activeChain&&y.z.set({activeChain:a?.namespace})),c.forEach(e=>{let n=t?.filter(t=>t.chainNamespace===e);W.state.chains.set(e,{namespace:e,networkState:(0,i.BX)({...H,caipNetwork:n?.[0]}),accountState:(0,i.BX)(q),caipNetworks:n??[],...r}),this.setRequestedCaipNetworks(n??[],e)})},removeAdapter(e){if(F.activeChain===e){let t=Array.from(F.chains.entries()).find(([t])=>t!==e);if(t){let e=t[1]?.caipNetworks?.[0];e&&this.setActiveCaipNetwork(e)}}F.chains.delete(e)},addAdapter(e,{networkControllerClient:t,connectionControllerClient:r},i){F.chains.set(e.namespace,{namespace:e.namespace,networkState:{...H,caipNetwork:i[0]},accountState:q,caipNetworks:i,connectionControllerClient:r,networkControllerClient:t}),this.setRequestedCaipNetworks(i?.filter(t=>t.chainNamespace===e.namespace)??[],e.namespace)},addNetwork(e){let t=F.chains.get(e.chainNamespace);if(t){let r=[...t.caipNetworks||[]];t.caipNetworks?.find(t=>t.id===e.id)||r.push(e),F.chains.set(e.chainNamespace,{...t,caipNetworks:r}),this.setRequestedCaipNetworks(r,e.chainNamespace)}},removeNetwork(e,t){let r=F.chains.get(e);if(r){let i=F.activeCaipNetwork?.id===t,n=[...r.caipNetworks?.filter(e=>e.id!==t)||[]];i&&r?.caipNetworks?.[0]&&this.setActiveCaipNetwork(r.caipNetworks[0]),F.chains.set(e,{...r,caipNetworks:n}),this.setRequestedCaipNetworks(n||[],e)}},setAdapterNetworkState(e,t){let r=F.chains.get(e);r&&(r.networkState={...r.networkState||H,...t},F.chains.set(e,r))},setChainAccountData(e,t,r=!0){if(!e)throw Error("Chain is required to update chain account data");let i=F.chains.get(e);if(i){let r={...i.accountState||q,...t};F.chains.set(e,{...i,accountState:r}),(1===F.chains.size||F.activeChain===e)&&(t.caipAddress&&(F.activeCaipAddress=t.caipAddress),d.U.replaceState(r))}},setChainNetworkData(e,t){if(!e)return;let r=F.chains.get(e);if(r){let i={...r.networkState||H,...t};F.chains.set(e,{...r,networkState:i})}},setAccountProp(e,t,r,i=!0){this.setChainAccountData(r,{[e]:t},i),"status"===e&&"disconnected"===t&&r&&a.a.removeConnectorId(r)},setActiveNamespace(e){F.activeChain=e;let t=e?F.chains.get(e):void 0,r=t?.networkState?.caipNetwork;r?.id&&e&&(F.activeCaipAddress=t?.accountState?.caipAddress,F.activeCaipNetwork=r,this.setChainNetworkData(e,{caipNetwork:r}),u.i.setActiveCaipNetworkId(r?.caipNetworkId),y.z.set({activeChain:e,selectedNetworkId:r?.caipNetworkId}))},setActiveCaipNetwork(e){if(!e)return;F.activeChain!==e.chainNamespace&&this.setIsSwitchingNamespace(!0);let t=F.chains.get(e.chainNamespace);F.activeChain=e.chainNamespace,F.activeCaipNetwork=e,this.setChainNetworkData(e.chainNamespace,{caipNetwork:e}),t?.accountState?.address?F.activeCaipAddress=`${e.chainNamespace}:${e.id}:${t?.accountState?.address}`:F.activeCaipAddress=void 0,this.setAccountProp("caipAddress",F.activeCaipAddress,e.chainNamespace),t&&d.U.replaceState(t.accountState),z.resetSend(),y.z.set({activeChain:F.activeChain,selectedNetworkId:F.activeCaipNetwork?.caipNetworkId}),u.i.setActiveCaipNetworkId(e.caipNetworkId),this.checkIfSupportedNetwork(e.chainNamespace)||!m.H.state.enableNetworkSwitch||m.H.state.allowUnsupportedChain||f.x.state.wcBasic||this.showUnsupportedChainUI()},addCaipNetwork(e){if(!e)return;let t=F.chains.get(e.chainNamespace);t&&t?.caipNetworks?.push(e)},async switchActiveNamespace(e){if(!e)return;let t=e!==W.state.activeChain,r=W.getNetworkData(e)?.caipNetwork,i=W.getCaipNetworkByNamespace(e,r?.id);t&&i&&await W.switchActiveNetwork(i)},async switchActiveNetwork(e){let t=W.state.chains.get(W.state.activeChain);t?.caipNetworks?.some(e=>e.id===F.activeCaipNetwork?.id)||b.I.goBack();let r=this.getNetworkControllerClient(e.chainNamespace);r&&(await r.switchCaipNetwork(e),p.E.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:e.caipNetworkId}}))},getNetworkControllerClient(e){let t=e||F.activeChain,r=F.chains.get(t);if(!r)throw Error("Chain adapter not found");if(!r.networkControllerClient)throw Error("NetworkController client not set");return r.networkControllerClient},getConnectionControllerClient(e){let t=e||F.activeChain;if(!t)throw Error("Chain is required to get connection controller client");let r=F.chains.get(t);if(!r?.connectionControllerClient)throw Error("ConnectionController client not set");return r.connectionControllerClient},getAccountProp(e,t){let r=F.activeChain;if(t&&(r=t),!r)return;let i=F.chains.get(r)?.accountState;if(i)return i[e]},getNetworkProp(e,t){let r=F.chains.get(t)?.networkState;if(r)return r[e]},getRequestedCaipNetworks(e){let t=F.chains.get(e),{approvedCaipNetworkIds:r=[],requestedCaipNetworks:i=[]}=t?.networkState||{};return h.w.sortRequestedNetworks(r,i)},getAllRequestedCaipNetworks(){let e=[];return F.chains.forEach(t=>{let r=this.getRequestedCaipNetworks(t.namespace);e.push(...r)}),e},setRequestedCaipNetworks(e,t){this.setAdapterNetworkState(t,{requestedCaipNetworks:e})},getAllApprovedCaipNetworkIds(){let e=[];return F.chains.forEach(t=>{let r=this.getApprovedCaipNetworkIds(t.namespace);e.push(...r)}),e},getActiveCaipNetwork:()=>F.activeCaipNetwork,getActiveCaipAddress:()=>F.activeCaipAddress,getApprovedCaipNetworkIds(e){let t=F.chains.get(e);return t?.networkState?.approvedCaipNetworkIds||[]},async setApprovedCaipNetworksData(e){let t=this.getNetworkControllerClient(),r=await t?.getApprovedCaipNetworksData();this.setAdapterNetworkState(e,{approvedCaipNetworkIds:r?.approvedCaipNetworkIds,supportsAllNetworks:r?.supportsAllNetworks})},checkIfSupportedNetwork(e,t){let r=t||F.activeCaipNetwork,i=this.getRequestedCaipNetworks(e);return!i.length||i?.some(e=>e.id===r?.id)},checkIfSupportedChainId(e){if(!F.activeChain)return!0;let t=this.getRequestedCaipNetworks(F.activeChain);return t?.some(t=>t.id===e)},setSmartAccountEnabledNetworks(e,t){this.setAdapterNetworkState(t,{smartAccountEnabledNetworks:e})},checkIfSmartAccountEnabled(){let e=s.L.caipNetworkIdToNumber(F.activeCaipNetwork?.caipNetworkId),t=F.activeChain;if(!t||!e)return!1;let r=this.getNetworkProp("smartAccountEnabledNetworks",t);return!!r?.includes(Number(e))},getActiveNetworkTokenAddress(){let e=F.activeCaipNetwork?.chainNamespace||"eip155",t=F.activeCaipNetwork?.id||1,r=l.oU.NATIVE_TOKEN_ADDRESS[e];return`${e}:${t}:${r}`},showUnsupportedChainUI(){g.W.open({view:"UnsupportedChain"})},checkIfNamesSupported(){let e=F.activeCaipNetwork;return!!(e?.chainNamespace&&l.oU.NAMES_SUPPORTED_CHAIN_NAMESPACES.includes(e.chainNamespace))},resetNetwork(e){this.setAdapterNetworkState(e,{approvedCaipNetworkIds:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]})},resetAccount(e){if(!e)throw Error("Chain is required to set account prop");F.activeCaipAddress=void 0,this.setChainAccountData(e,{smartAccountDeployed:!1,currentTab:0,caipAddress:void 0,address:void 0,balance:void 0,balanceSymbol
524:void 0,profileName:void 0,profileImage:void 0,addressExplorerUrl:void 0,tokenBalance:[],connectedWalletInfo:void 0,preferredAccountType:void 0,socialProvider:void 0,socialWindow:void 0,farcasterUrl:void 0,allAccounts:[],user:void 0,status:"disconnected"}),a.a.removeConnectorId(e)},async disconnect(e){let t=function(e){let t=Array.from(W.state.chains.keys()),r=[];return e?(r.push([e,W.state.chains.get(e)]),c(e,o.o.CONNECTOR_ID.WALLET_CONNECT)?t.forEach(t=>{t!==e&&c(t,o.o.CONNECTOR_ID.WALLET_CONNECT)&&r.push([t,W.state.chains.get(t)])}):c(e,o.o.CONNECTOR_ID.AUTH)&&t.forEach(t=>{t!==e&&c(t,o.o.CONNECTOR_ID.AUTH)&&r.push([t,W.state.chains.get(t)])})):r=Array.from(W.state.chains.entries()),r}(e);try{z.resetSend();let r=await Promise.allSettled(t.map(async([e,t])=>{try{let{caipAddress:r}=this.getAccountData(e)||{};r&&t.connectionControllerClient?.disconnect&&await t.connectionControllerClient.disconnect(e),this.resetAccount(e),this.resetNetwork(e)}catch(t){throw Error(`Failed to disconnect chain ${e}: ${t.message}`)}}));f.x.resetWcConnection();let i=r.filter(e=>"rejected"===e.status);if(i.length>0)throw Error(i.map(e=>e.reason.message).join(", "));u.i.deleteConnectedSocialProvider(),e?a.a.removeConnectorId(e):a.a.resetConnectorIds(),p.E.sendEvent({type:"track",event:"DISCONNECT_SUCCESS",properties:{namespace:e||"all"}})}catch(e){console.error(e.message||"Failed to disconnect chains"),p.E.sendEvent({type:"track",event:"DISCONNECT_ERROR",properties:{message:e.message||"Failed to disconnect chains"}})}},setIsSwitchingNamespace(e){F.isSwitchingNamespace=e},getFirstCaipNetworkSupportsAuthConnector(){let e=[];
524if(F.chains.forEach(t=>{o.o.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(e=>e===t.namespace)&&t.namespace&&e.push(t.namespace)}),e.length>0){let t=e[0];return t?F.chains.get(t)?.caipNetworks?.[0]:void 0}},getAccountData:e=>e?W.state.chains.get(e)?.accountState:d.U.state,getNetworkData(e){let t=e||F.activeChain;if(t)return W.state.chains.get(t)?.networkState},getCaipNetworkByNamespace(e,t){if(!e)return;let r=W.state.chains.get(e),i=r?.caipNetworks?.find(e=>e.id===t);return i||r?.networkState?.caipNetwork||r?.caipNetworks?.[0]},getRequestedCaipNetworkIds(){let e=a.a.state.filterByNamespace;return(e?[F.chains.get(e)]:Array.from(F.chains.values())).flatMap(e=>e?.caipNetworks||[]).map(e=>e.caipNetworkId)}}},67869:(e,t,r)=>{"use strict";r.d(t,{I:()=>u});var i=r(70524),n=r(98866),s=r(58051),o=r(67695),a=r(66254),c=r(81701),l=r(55480);let h=(0,i.BX)({view:"Connect",history:["Connect"],transactionStack:[]}),u={state:h,subscribeKey:(e,t)=>(0,n.u$)(h,e,t),pushTransactionStack(e){h.transactionStack.push(e)},popTransactionStack(e){let t=h.transactionStack.pop();if(t)if(e)this.goBack(),t?.onCancel?.();else{if(t.goBack)this.goBack();else if(t.replace){let e=h.history.indexOf("ConnectingSiwe");e>0?this.goBackToIndex(e-1):(c.W.close(),h.history=[])}else t.view&&this.reset(t.view);t?.onSuccess?.()}},push(e,t){e!==h.view&&(h.view=e,h.history.push(e),h.data=t)},reset(e,t){h.view=e,h.history=[e],h.data=t},replace(e,t){h.history.at(-1)!==e&&(h.view=e,h.history[h.history.length-1]=e,h.data=t)},goBack(){let e=!o.W.state.activeCaipAddress&&"ConnectingFarcaster"===this.state.view;if(h.history.length>1&&!h.history.includes("UnsupportedChain")){h.history.pop();let[e]=h.history.slice(-1);e&&(h.view=e)}else c.W.close();h.data?.wallet&&(h.data.wallet=void 0),setTimeout(()=>{if(e){s.U.setFarcasterUrl(void 0,o.W.state.activeChain);let e=a.a.getAuthConnector();e?.provider?.reload();let t=(0,i.P9)(l.H.state);e?.provider?.syncDappData?.({metadata:t.metadata,sdkVersion:t.sdkVersion,projectId:t.projectId,sdkType:t.sdkType})}},100)},goBackToIndex(e){if(h.history.length>1){h.history=h.history.slice(0,e+1);let[t]=h.history.slice(-1);t&&(h.view=t)}}}},67878:(e,t,r)=>{"use strict";r.d(t,{VH:()=>l,li:()=>c});var i=r(16459),n=r(5566),s=r(60480);class o extends s.H{constructor(e){super()}}let a=n.FIVE_SECONDS,c={pulse:"heartbeat_pulse"};class l extends o{constructor(e){super(e),this.events=new i.EventEmitter,this.interval=a,this.interval=e?.interval||a}static async init(e){let t=new l(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),(0,n.toMiliseconds)(this.interval))}pulse(){this.events.emit(c.pulse)}}},67934:(e,t,r)=>{"use strict";r.d(t,{o:()=>i});let i={WC_NAME_SUFFIX:".reown.id",WC_NAME_SUFFIX_LEGACY:".wcn.id",BLOCKCHAIN_API_RPC_URL:"https://rpc.walletconnect.org",PULSE_API_URL:"https://pulse.walletconnect.org",W3M_API_URL:"https://api.web3modal.org",CONNECTOR_ID:{WALLET_CONNECT:"walletConnect",INJECTED:"injected",WALLET_STANDARD:"announced",COINBASE:"coinbaseWallet",COINBASE_SDK:"coinbaseWalletSDK",SAFE:"safe",LEDGER:"ledger",OKX:"okx",EIP6963:"eip6963",AUTH:"ID_AUTH"},CONNECTOR_NAMES:{AUTH:"Auth"},AUTH_CONNECTOR_SUPPORTED_CHAINS:["eip155","solana"],LIMITS:{PENDING_TRANSACTIONS:99},CHAIN:{EVM:"eip155",SOLANA:"solana",POLKADOT:"polkadot",BITCOIN:"bip122"}
524,CHAIN_NAME_MAP:{eip155:"EVM Networks",solana:"Solana",polkadot:"Polkadot",bip122:"Bitcoin"},ADAPTER_TYPES:{BITCOIN:"bitcoin",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5"},USDT_CONTRACT_ADDRESSES:["0xdac17f958d2ee523a2206206994597c13d831ec7","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7","0x919C1c267BC06a7039e03fcc2eF738525769109c","0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e","0x55d398326f99059fF775485246999027B3197955","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"],HTTP_STATUS_CODES:{SERVICE_UNAVAILABLE:503,FORBIDDEN:403},UNSUPPORTED_NETWORK_NAME:"Unknown Network"}},68463:(e,t,r)=>{"use strict";r.d(t,{A:()=>n,b:()=>i});var i=r(94820);let n=i},68528:(e,t,r)=>{"use strict";function i([e,t]){return`${e}=${function e(t){return Array.isArray(t)?"%5B"+t.map(e).join("%2C%20")+"%5D":"bigint"==typeof t?`${t}n`:encodeURIComponent(String(null!=t&&null===Object.getPrototypeOf(t)?{...t}:t))}(t)}`}r.d(t,{g2:()=>l,eC:()=>c});var n=class extends Error{cause=this.cause;context;constructor(...[e,t]){let r,n;if(t){let{cause:e,...i}=t;e&&(n={cause:e}),Object.keys(i).length>0&&(r=i)}super(function(e,t={}){{let r=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(r+=` '${btoa(Object.entries(t).map(i).join("&"))}'`),`${r}\``}}(e,r),n),this.context={__code:e,...r},this.name="SolanaError"}};function s(e){return"fixedSize"in e&&"number"==typeof e.fixedSize}var o=(e=>(e[e.Little=0]="Little",e[e.Big=1]="Big",e))(o||{});function a(e){return e?.endian!==1}var c=(e={})=>(function(e){var t;return Object.freeze({...t={fixedSize:e.size,write(t,r,i){e.range&&function(e,t,r,i){if(i<t||i>r)throw new n(8078011,{codecDescription:e,max:r,min:t,value:i})}(e.name,e.range[0],e.range[1],t);let s=new ArrayBuffer(e.size);return e.set(new DataView(s),t,a(e.config)),r.set(new Uint8Array(s),i),i+e.size}},encode:e=>{let r=new Uint8Array("fixedSize"in t?t.fixedSize:t.getSizeFromValue(e));return t.write(e,r,0),r}})})({config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,t,r)=>e.setBigUint64(0,BigInt(t),r),size:8}),l=(e={})=>(function(e,t){if(s(e)!==s(t))throw new n(8078004);if(s(e)&&s(t)&&e.fixedSize!==t.fixedSize)throw new n(8078005,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!s(e)&&!s(t)&&e.maxSize!==t.maxSize)throw new n(8078006,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return{...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}})(c(e),((e={})=>(function(e){var t;return Object.freeze({...t={fixedSize:e.size,read(t,r=0){!function(e,t,r=0){if(t.length-r<=0)throw new n(8078e3,{codecDescription:e})}(e.name,t,r),function(e,t,r,i=0){let s=r.length-i;if(s<t)throw new n(8078001,{bytesLength:s,codecDescription:e,expected:t})}(e.name,e.size,t,r);let i=new DataView(function(e,t,r){let i=e.byteOffset+(t??0),n=r??e.byteLength;return e.buffer.slice(i,i+n)}(t,r,e.size));return[e.get(i,a(e.config)),r+e.size]}},decode:(e,r=0)=>t.read(e,r)[0]})})({config:e,get:(e,t)=>e.getBigUint64(0,t),name:"u64",size:8}))(e))},68851:(e,t,r)=>{"use strict";e.exports=function(e){var t,r,i,n,s,o,a,c,l,h,u,d,f,p;return t=e.lib.BlockCipher,r=e.algo,i=[],n=[],s=[],o=[],a=[],c=[],l=[],h=[],u=[],d=[],function(){for(var e=[],t=0;t<256;t++)t<128?e[t]=t<<1:e[t]=t<<1^283;for(var r=0,f=0,t=0;t<256;t++){var p=f^f<<1^f<<2^f<<3^f<<4;p=p>>>8^255&p^99,i[r]=p,n[p]=r;var g=e[r],m=e[g],y=e[m],b=257*e[p]^0x1010100*p;s[r]=b<<24|b>>>8,o[r]=b<<16|b>>>16,a[r]=b<<8|b>>>24,c[r]=b;var b=0x1010101*y^65537*m^257*g^0x1010100*r;l[p]=b<<24|b>>>8,h[p]=b<<16|b>>>16,u[p]=b<<8|b>>>24,d[p]=b,r?(r=g^e[e[e[y^g]]],f^=e[e[f]]):r=f=1}}(),f=[0,1,2,4,8,16,32,64,128,27,54],p=r.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e,t=this._keyPriorReset=this._key,r=t.words,n=t.sigBytes/4,s=((this._nRounds=n+6)+1)*4,o=this._keySchedule=[],a=0;a<s;a++)a<n?o[a]=r[a]:(e=o[a-1],a%n?n>6&&a%n==4&&(e=i[e>>>24]<<24|i[e>>>16&255]<<16|i[e>>>8&255]<<8|i[255&e]):e=(i[(e=e<<8|e>>>24)>>>24]<<24|i[e>>>16&255]<<16|i[e>>>8&255]<<8|i[255&e])^f[a/n|0]<<24,o[a]=o[a-n]^e);for(var c=this._invKeySchedule=[],p=0;p<s;p++){var a=s-p;if(p%4)var e=o[a];else var e=o[a-4];p<4||a<=4?c[p]=e:c[p]=l[i[e>>>24]]^h[i[e>>>16&255]]^u[i[e>>>8&255]]^d[i[255&e]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,o,a,c,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,h,u,d,n);var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,o,a){for(var c=this._nRounds,l=e[t]^r[0],h=e[t+1]^r[1],u=e[t+2]^r[2],d=e[t+3]^r[3],f=4,p=1;p<c;p++){var g=i[l>>>24]^n[h>>>16&255]^s[u>>>8&255]^o[255&d]^r[f++],m=i[h>>>24]^n[u>>>16&255]^s[d>>>8&255]^o[255&l]^r[f++],y=i[u>>>24]^n[d>>>16&255]^s[l>>>8&255]^o[255&h]^r[f++],b=i[d>>>24]^n[l>>>16&255]^s[h>>>8&255]^o[255&u]^r[f++];l=g,h=m,u=y,d=b}var g=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[u>>>8&255]<<8|a[255&d])^r[f++],m=(a[h>>>24]<<24|a[u>>>16&255]<<16|a[d>>>8&255]<<8|a[255&l])^r[f++],y=(a[u>>>24]<<24|a[d>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^r[f++],b=(a[d>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&u])^r[f++];e[t]=g,e[t+1]=m,e[t+2]=y,e[t+3]=b},keySize:8}),e.AES=t._createHelper(p),e.AES}(r(16611),r(9956),r(11816),r(93524),r(99229))},69435:(e,t,r)=>{let i=r(46342),n=r(81010),s=r(24967),o=r(89158),a=r(29762),c=i.getBCHDigit
524(7973);function l(e,t){return o.getCharCountIndicator(e,t)+4}t.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},t.getCapacity=function(e,t,r){if(!a.isValid(e))throw Error("Invalid QR Code version");void 0===r&&(r=o.BYTE);let s=(i.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,t))*8;if(r===o.MIXED)return s;let c=s-l(r,e);switch(r){case o.NUMERIC:return Math.floor(c/10*3);case o.ALPHANUMERIC:return Math.floor(c/11*2);case o.KANJI:return Math.floor(c/13);case o.BYTE:default:return Math.floor(c/8)}},t.getBestVersionForData=function(e,r){let i,n=s.from(r,s.M);if(Array.isArray(e)){if(e.length>1){for(let r=1;r<=40;r++)if(function(e,t){let r=0;return e.forEach(function(e){let i=l(e.mode,t);r+=i+e.getBitsLength()}),r}(e,r)<=t.getCapacity(r,n,o.MIXED))return r;return}if(0===e.length)return 1;i=e[0]}else i=e;return function(e,r,i){for(let n=1;n<=40;n++)if(r<=t.getCapacity(n,i,e))return n}(i.mode,i.getLength(),n)},t.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error("Invalid QR Code version");let t=e<<12;for(;i.getBCHDigit(t)-c>=0;)t^=7973<<i.getBCHDigit(t)-c;return e<<12|t}},70064:(e,t,r)=>{"use strict";var i=r(78239),n=r(98392),s=r(43770),o=r(92963),a=i.assert;function c(e){o.call(this,"short",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}function l(e,t,r,i){o.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new n(t,16),this.y=new n(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function h(e,t,r,i){o.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new n(0)):(this.x=new n(t,16),this.y=new n(r,16),this.z=new n(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s(c,o),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){if(e.beta)t=new n(e.beta,16).toRed(this.red);else{var t,r,i,s=this._getEndoRoots(this.p);t=(t=0>s[0].cmp(s[1])?s[0]:s[1]).toRed(this.red)}if(e.lambda)r=new n(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return i=e.basis?e.basis.map(function(e){return{a:new n(e.a,16),b:new n(e.b,16)}}):this._getEndoBasis(r),{beta:t,lambda:r,basis:i}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:n.mont(e),r=new n(2).toRed(t).redInvm(),i=r.redNeg(),s=new n(3).toRed(t).redNeg().redSqrt().redMul(r);return[i.redAdd(s).fromRed(),i.redSub(s).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,r,i,s,o,a,c,l,h,u=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,f=this.n.clone(),p=new n(1),g=new n(0),m=new n(0),y=new n(1),b=0;0!==d.cmpn(0);){var w=f.div(d);l=f.sub(w.mul(d)),h=m.sub(w.mul(p));var v=y.sub(w.mul(g));if(!i&&0>l.cmp(u))t=c.neg(),r=p,i=l.neg(),s=h;else if(i&&2==++b)break;c=l,f=d,d=l,m=p,p=h,y=g,g=v}o=l.neg(),a=h;var x=i.sqr().add(s.sqr());return o.sqr().add(a.sqr()).cmp(x)>=0&&(o=t,a=r),i.negative&&(i=i.neg(),s=s.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:i,b:s},{a:o,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],n=i.b.mul(e).divRound(this.n),s=r.b.neg().mul(e).divRound(this.n),o=n.mul(r.a),a=s.mul(i.a),c=n.mul(r.b),l=s.mul(i.b);return{k1:e.sub(o).sub(a),k2:c.add(l).neg()}},c.prototype.pointFromX=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(0!==i.redSqr().redSub(r).cmp(this.zero))throw Error("invalid point");var s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(e,i)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return 0===r.redSqr().redISub(n).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,s=0;s<e.length;s++){var o=this._endoSplit(t[s]),a=e[s],c=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),c=c.neg(!0)),i[2*s]=a,i[2*s+1]=c,n[2*s]=o.k1,n[2*s+1]=o.k2}for(var l=this._wnafMulAdd(1,i,n,2*s,r),h=0;h<2*s;h++)i[h]=null,n[h]=null;return l},s(l,o.BasePoint),c.prototype.point=function(e,t,r){return new l(this,e,t,r)},c.prototype.pointFromJSON=function(e,t){return l.fromJSON(this,e,t)},l.prototype._getBeta=function(){if(this.curve.endo){var e=this.prec
vendor: 4,173 bytes, line 524
524omputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,i=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t}},l.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},l.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var i=e.point(t[0],t[1],r);if(!t[2])return i;function n(t){return e.point(t[0],t[1],r)}var s=t[2];return i.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[i].concat(s.doubles.points.map(n))},naf:s.naf&&{wnd:s.naf.wnd,points:[i].concat(s.naf.points.map(n))}},i},l.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},l.prototype.isInfinity=function(){return this.inf},l.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e)||0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},l.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),s=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},l.prototype.getX=function(){return this.x.fromRed()},l.prototype.getY=function(){return this.y.fromRed()},l.prototype.mul=function(e){return(e=new n(e,16),this.isInfinity())?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},l.prototype.mulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},l.prototype.jmulAdd=function(e,t,r){var i=[this,t],n=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},l.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},l.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t},l.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},s(h,o.BasePoint),c.prototype.jpoint=function(e,t,r){return new h(this,e,t,r)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),n=e.x.redMul(r),s=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),a=i.redSub(n),c=s.redSub(o);if(0===a.cmpn(0))if(0!==c.cmpn(0))return this.curve.jpoint(null,null,null);else return this.dbl();var l=a.redSqr(),h=l.redMul(a),u=i.redMul(l),d=c.redSqr().redIAdd(h).redISub(u).redISub(u),f=c.redMul(u.redISub(d)).redISub(s.redMul(h)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(d,f,p)},h.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;
524var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),n=this.y,s=e.y.redMul(t).redMul(this.z),o=r.redSub(i),a=n.redSub(s);if(0===o.cmpn(0))if(0!==a.cmpn(0))return this.curve.jpoint(null,null,null);else return this.dbl();var c=o.redSqr(),l=c.redMul(o),h=r.redMul(c),u=a.redSqr().redIAdd(l).redISub(h).redISub(h),d=a.redMul(h.redISub(u)).redISub(n.redMul(l)),f=this.z.redMul(o);return this.curve.jpoint(u,d,f)},h.prototype.dblp=function(e){if(0===e||this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){var t,r=this;for(t=0;t<e;t++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,s=this.x,o=this.y,a=this.z,c=a.redSqr().redSqr(),l=o.redAdd(o);for(t=0;t<e;t++){var h=s.redSqr(),u=l.redSqr(),d=u.redSqr(),f=h.redAdd(h).redIAdd(h).redIAdd(i.redMul(c)),p=s.redMul(u),g=f.redSqr().redISub(p.redAdd(p)),m=p.redISub(g),y=f.redMul(m);y=y.redIAdd(y).redISub(d);var b=l.redMul(a);t+1<e&&(c=c.redMul(d)),s=g,a=b,l=y}return this.curve.jpoint(s,l.redMul(n),a)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},h.prototype._zeroDbl=function(){if(this.zOne){var e,t,r,i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(s);o=o.redIAdd(o);var a=i.redAdd(i).redIAdd(i),c=a.redSqr().redISub(o).redISub(o),l=s.redIAdd(s);l=(l=l.redIAdd(l)).redIAdd(l),e=c,t=a.redMul(o.redISub(c)).redISub(l),r=this.y.redAdd(this.y)}else{var h=this.x.redSqr(),u=this.y.redSqr(),d=u.redSqr(),f=this.x.redAdd(u).redSqr().redISub(h).redISub(d);f=f.redIAdd(f);var p=h.redAdd(h).redIAdd(h),g=p.redSqr(),m=d.redIAdd(d);m=(m=m.redIAdd(m)).redIAdd(m),e=g.redISub(f).redISub(f),t=p.redMul(f.redISub(e)).redISub(m),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},h.prototype._threeDbl=function(){if(this.zOne){var e,t,r,i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(s);o=o.redIAdd(o);var a=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),c=a.redSqr().redISub(o).redISub(o);e=c;var l=s.redIAdd(s);l=(l=l.redIAdd(l)).redIAdd(l),t=a.redMul(o.redISub(c)).redISub(l),r=this.y.redAdd(this.y)}else{var h=this.z.redSqr(),u=this.y.redSqr(),d=this.x.redMul(u),f=this.x.redSub(h).redMul(this.x.redAdd(h));f=f.redAdd(f).redIAdd(f);var p=d.redIAdd(d),g=(p=p.redIAdd(p)).redAdd(p);e=f.redSqr().redISub(g),r=this.y.redAdd(this.z).redSqr().redISub(u).redISub(h);var m=u.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=f.redMul(p.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,r)},h.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),s=t.redSqr(),o=r.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(e.redMul(n)),c=t.redAdd(t),l=(c=c.redIAdd(c)).redMul(o),h=a.redSqr().redISub(l.redAdd(l)),u=l.redISub(h),d=o.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=a.redMul(u).redISub(d),p=r.redAdd(r).redMul(i);return this.curve.jpoint(h,f,p)},h.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),i=t.redSqr(),n=e.redAdd(e).redIAdd(e),s=n.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(i),a=(o=(o=(o=o.redIAdd(o)).redAdd(o).redIAdd(o)).redISub(s)).redSqr(),c=i.redIAdd(i);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var l=n.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(c),h=t.redMul(l);h=(h=h.redIAdd(h)).redIAdd(h);var u=this.x.redMul(a).redISub(h);u=(u=u.redIAdd(u)).redIAdd(u);var d=this.y.redMul(l.redMul(c.redISub(l)).redISub(o.redMul(a)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(u,d,f)},h.prototype.mul=function(e,t){return e=new n(e,t),this.curve._wnafMul(this,e)},h.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var i=t.redMul(this.z),n=r.redMul(e.z);return 0===this.y.redMul(n).redISub(e.y.redMul(i)).cmpn(0)}
524,h.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var i=e.clone(),n=this.curve.redN.redMul(t);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),0===this.x.cmp(r))return!0}},h.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},70083:(e,t,r)=>{"use strict";var i=r(98392),n=r(78239),s=n.assert;function o(e,t){if(e instanceof o)return e;this._importDER(e,t)||(s(e.r&&e.s,"Signature without r or s"),this.r=new i(e.r,16),this.s=new i(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;var i=15&r;if(0===i||i>4||0===e[t.place])return!1;for(var n=0,s=0,o=t.place;s<i;s++,o++)n<<=8,n|=e[o],n>>>=0;return!(n<=127)&&(t.place=o,n)}function l(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function h(e,t){if(t<128)return void e.push(t);var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}e.exports=o,o.prototype._importDER=function(e,t){e=n.toArray(e,t);var r=new a;if(48!==e[r.place++])return!1;var s=c(e,r);if(!1===s||s+r.place!==e.length||2!==e[r.place++])return!1;var o=c(e,r);if(!1===o||(128&e[r.place])!=0)return!1;var l=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var h=c(e,r);if(!1===h||e.length!==h+r.place||(128&e[r.place])!=0)return!1;var u=e.slice(r.place,h+r.place);if(0===l[0])if(!(128&l[1]))return!1;else l=l.slice(1);if(0===u[0])if(!(128&u[1]))return!1;else u=u.slice(1);return this.r=new i(l),this.s=new i(u),this.recoveryParam=null,!0},o.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=l(t),r=l(r);!r[0]&&!(128&r[1]);)r=r.slice(1);var i=[2];h(i,t.length),(i=i.concat(t)).push(2),h(i,r.length);var s=i.concat(r),o=[48];return h(o,s.length),o=o.concat(s),n.encode(o,e)}},70371:(e,t,r)=>{let i=r(89158),n=r(54415),s=r(31937),o=r(44006),a=r(73987),c=r(53896),l=r(46342),h=r(88072);function u(e){return unescape(encodeURIComponent(e)).length}function d(e,t,r){let i,n=[];for(;null!==(i=e.exec(r));)n.push({data:i[0],index:i.index,mode:t,length:i[0].length});return n}function f(e){let t,r,n=d(c.NUMERIC,i.NUMERIC,e),s=d(c.ALPHANUMERIC,i.ALPHANUMERIC,e);return l.isKanjiModeEnabled()?(t=d(c.BYTE,i.BYTE,e),r=d(c.KANJI,i.KANJI,e)):(t=d(c.BYTE_KANJI,i.BYTE,e),r=[]),n.concat(s,t,r).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function p(e,t){switch(t){case i.NUMERIC:return n.getBitsLength(e);case i.ALPHANUMERIC:return s.getBitsLength(e);case i.KANJI:return a.getBitsLength(e);case i.BYTE:return o.getBitsLength(e)}}function g(e,t){let r,c=i.getBestModeForData(e);if((r=i.from(t,c))!==i.BYTE&&r.bit<c.bit)throw Error('"'+e+'" cannot be encoded with mode '+i.toString(r)+".\n Suggested mode is: "+i.toString(c));switch(r===i.KANJI&&!l.isKanjiModeEnabled()&&(r=i.BYTE),r){case i.NUMERIC:return new n(e);case i.ALPHANUMERIC:return new s(e);case i.KANJI:return new a(e);case i.BYTE:return new o(e)}}t.fromArray=function(e){return e.reduce(function(e,t){return"string"==typeof t?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},t.fromString=function(e,r){let n=function(e,t){let r={},n={start:{}},s=["start"];for(let o=0;o<e.length;o++){let a=e[o],c=[];for(let e=0;e<a.length;e++){let l=a[e],h=""+o+e;c.push(h),r[h]={node:l,lastCount:0},n[h]={};for(let e=0;e<s.length;e++){let o=s[e];r[o]&&r[o].node.mode===l.mode?(n[o][h]=p(r[o].lastCount+l.length,l.mode)-p(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),n[o][h]=p(l.length,l.mode)+4+i.getCharCountIndicator(l.mode,t))}}s=c}for(let e=0;e<s.length;e++)n[s[e]].end=0;return{map:n,table:r}}(function(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r];switch(n.mode){case i.NUMERIC:t.push([n,{data:n.data,mode:i.ALPHANUMERIC,length:n.length},{data:n.data,mode:i.BYTE,length:n.length}]);break;case i.ALPHANUMERIC:t.push([n,{data:n.data,mode:i.BYTE,length:n.length}]);break;case i.KANJI:t.push([n,{data:n.data,mode:i.BYTE,length:u(n.data)}]);break;case i.BYTE:t.push([{data:n.data,mode:i.BYTE,length:u(n.data)}])}}return t}(f(e,l.isKanjiModeEnabled())),r),s=h.find_path(n.map,"start","end"),o=[];for(let e=1;e<s.length-1;e++)o.push(n.table[s[e]].node);return t.fromArray(o.reduce(function(e,t){let r=e.length-1>=0?e[e.length-1]:null;return r&&r.mode===t.mode?e[e.length-1].data+=t.data:e.push(t),e},[]))},t.rawSplit=function(e){return t.fromArray(f(e,l.isKanjiModeEnabled()))}},70417:(e,t,r)=>{"use strict";r.d(t,{E:()=>g});var i=r(70524),n=r(67934),s=r(93965),o=r(12319),a=r(32464),c=r(58051),l=r(52502),h=r(55480);let u=o.w.getAnalyticsUrl(),d=new a.Z({baseUrl:u,clientId:null}),f=["MODAL_CREATED"],p=(0,i.BX)({timestamp:Date.now(),reportedErrors:{},data:{type:"track",event:"MODAL_CREATED"}}),g={state:p,subscribe:e=>(0,i.B1)(p,()=>e(p)),getSdkProperties(){let{projectId:e,sdkType:t,sdkVersion:r}=h.H.state;return{projectId:e,st:t,sv:r||"html-wagmi-4.2.2"}},async _sendAnalyticsEvent(e){try{let t=c.U.state.address;if(f.includes(e.data.event)||"undefined"==typeof window)return;await d.post({path:"/e",params:g.getSdkProperties(),body:{eventId:o.w.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:e.timestamp,props:{...e.data,address:t}}}),p.reportedErrors.FORBIDDEN=!1}
524catch(e){e instanceof Error&&e.cause instanceof Response&&e.cause.status===n.o.HTTP_STATUS_CODES.FORBIDDEN&&!p.reportedErrors.FORBIDDEN&&(l.h.open({shortMessage:"Invalid App Configuration",longMessage:`Origin ${(0,s.IP)()?window.origin:"uknown"} not found on Allowlist - update configuration on cloud.reown.com`},"error"),p.reportedErrors.FORBIDDEN=!0)}},sendEvent(e){p.timestamp=Date.now(),p.data=e,h.H.state.features?.analytics&&g._sendAnalyticsEvent(p)}}},70524:(e,t,r)=>{"use strict";r.d(t,{BX:()=>d,KR:()=>g,P9:()=>p,B1:()=>f}),Symbol();let i=Symbol(),n=Object.getPrototypeOf,s=new WeakMap,o=e=>(e=>e&&(s.has(e)?s.get(e):n(e)===Object.prototype||n(e)===Array.prototype))(e)&&e[i]||null,a=(e,t=!0)=>{s.set(e,t)},c=e=>"object"==typeof e&&null!==e,l=new WeakMap,h=new WeakSet,[u]=((e=Object.is,t=(e,t)=>new Proxy(e,t),r=e=>c(e)&&!h.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer),i=e=>{switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e}},n=new WeakMap,s=(e,t,r=i)=>{let o=n.get(e);if((null==o?void 0:o[0])===t)return o[1];let c=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return a(c,!0),n.set(e,[t,c]),Reflect.ownKeys(e).forEach(t=>{if(Object.getOwnPropertyDescriptor(c,t))return;let i=Reflect.get(e,t),{enumerable:n}=Reflect.getOwnPropertyDescriptor(e,t),o={value:i,enumerable:n,configurable:!0};if(h.has(i))a(i,!1);else if(i instanceof Promise)delete o.value,o.get=()=>r(i);else if(l.has(i)){let[e,t]=l.get(i);o.value=s(e,t(),r)}Object.defineProperty(c,t,o)}),Object.preventExtensions(c)},u=new WeakMap,d=[1,1],f=i=>{if(!c(i))throw Error("object required");let n=u.get(i);if(n)return n;let a=d[0],p=new Set,g=(e,t=++d[0])=>{a!==t&&(a=t,p.forEach(r=>r(e,t)))},m=d[1],y=(e=++d[1])=>(m===e||p.size||(m=e,w.forEach(([t])=>{let r=t[1](e);r>a&&(a=r)})),a),b=e=>(t,r)=>{let i=[...t];i[1]=[e,...i[1]],g(i,r)},w=new Map,v=(e,t)=>{if(w.has(e))throw Error("prop listener already exists");if(p.size){let r=t[3](b(e));w.set(e,[t,r])}else w.set(e,[t])},x=e=>{var t;let r=w.get(e);r&&(w.delete(e),null==(t=r[1])||t.call(r))},E=e=>{p.add(e),1===p.size&&w.forEach(([e,t],r)=>{if(t)throw Error("remove already exists");let i=e[3](b(r));w.set(r,[e,i])});let t=()=>{p.delete(e),0===p.size&&w.forEach(([e,t],r)=>{t&&(t(),w.set(r,[e]))})};return t},_=Array.isArray(i)?[]:Object.create(Object.getPrototypeOf(i)),I={deleteProperty(e,t){let r=Reflect.get(e,t);x(t);let i=Reflect.deleteProperty(e,t);return i&&g(["delete",[t],r]),i},set(t,i,n,s){let a=Reflect.has(t,i),d=Reflect.get(t,i,s);if(a&&(e(d,n)||u.has(n)&&e(d,u.get(n))))return!0;x(i),c(n)&&(n=o(n)||n);let p=n;if(n instanceof Promise)n.then(e=>{n.status="fulfilled",n.value=e,g(["resolve",[i],e])}).catch(e=>{n.status="rejected",n.reason=e,g(["reject",[i],e])});else{!l.has(n)&&r(n)&&(p=f(n));let e=!h.has(p)&&l.get(p);e&&v(i,e)}return Reflect.set(t,i,p,s),g(["set",[i],n,d]),!0}},A=t(_,I);u.set(i,A);let S=[_,y,s,E];
524return l.set(A,S),Reflect.ownKeys(i).forEach(e=>{let t=Object.getOwnPropertyDescriptor(i,e);"value"in t&&(A[e]=i[e],delete t.value,delete t.writable),Object.defineProperty(_,e,t)}),A})=>[f,l,h,e,t,r,i,n,s,u,d])();function d(e={}){return u(e)}function f(e,t,r){let i,n=l.get(e);n||console.warn("Please use proxy object");let s=[],o=n[3],a=!1,c=o(e=>{if(s.push(e),r)return void t(s.splice(0));i||(i=Promise.resolve().then(()=>{i=void 0,a&&t(s.splice(0))}))});return a=!0,()=>{a=!1,c()}}function p(e,t){let r=l.get(e);r||console.warn("Please use proxy object");let[i,n,s]=r;return s(i,n(),t)}function g(e){return h.add(e),e}},71018:(e,t,r)=>{"use strict";r.d(t,{D5:()=>A,U5:()=>I,h6:()=>n.a,iP:()=>E,oI:()=>_});var i=r(65727),n=r.n(i),s=r(25042);let o={level:"info"},a="custom_context";class c{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}}class l{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){let t=new c(e);if(t.size>this.maxSizeInBytes)throw 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.head=t,this.tail=t,this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;let e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){let e=[],t=this.head;for(;null!==t;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};let t=e.value;return e=e.next,{done:!1,value:t}}}}}class h{constructor(e,t=1024e3){this.level=e??"error",this.levelValue=i.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new l(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===i.levels.values.error?console.error(e):t===i.levels.values.warn?console.warn(e):t===i.levels.values.debug?console.debug(e):t===i.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append((0,s.h)({timestamp:new Date().toISOString(),log:e}));let t="string"==typeof e?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new l(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){let t=this.getLogArray();return t.push((0,s.h)({extraMetadata:e})),new Blob(t,{type:"application/json"})}}class u{constructor(e,t=1024e3){this.baseChunkLogger=new h(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){let t=URL.createObjectURL(this.logsToBlob(e)),r=document.createElement("a");r.href=t,r.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(t)}}class d{constructor(e,t=1024e3){this.baseChunkLogger=new h(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 f=Object.defineProperty,p=Object.defineProperties,g=Object.getOwnPropertyDescriptors,m=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable,w=(e,t,r)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,v=(e,t)=>{for(var r in t||(t={}))y.call(t,r)&&w(e,r,t[r]);if(m)for(var r of m(t))b.call(t,r)&&w(e,r,t[r]);return e},x=(e,t)=>p(e,g(t));function E(e){return x(v({},e),{level:e?.level||o.level})}function _(e,t=a){return typeof e.bindings>"u"?function(e,t=a){return e[t]||""}(e,t):e.bindings().context||""}function I(e,t,r=a){let i=function(e,t,r=a){let i=_(e,r);return i.trim()?`${i}/${t}`:t}(e,t,r);return function(e,t,r=a){return e[r]=t,e}(e.child({context:i}),i,r)}function A(e){return"u">typeof e.loggerOverride&&"string"!=typeof e.loggerOverride?{logger:e.loggerOverride,chunkLoggerController:null}:"u">typeof window?function(e){var t,r;let i=new u(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:n()(x(v({},e.opts),{level:"trace",browser:x(v({},null==(r=e.opts)?void 0:r.browser),{write:e=>i.write(e)})})),chunkLoggerController:i}}(e):function(e){var t;let r=new d(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:n()(x(v({},e.opts),{level:"trace"}),r),chunkLoggerController:r}}(e)}},71084:(e,t,r)=>{"use strict";let i,n,s;r.d(t,{JX:()=>l,RF:()=>c,W5:()=>d,ck:()=>p,ds:()=>h,fD:()=>f});var o=r(83138),a=r(52617);function c(e,t){i=document.createElement("style"),n=document.createElement("style"),s=document.createElement("style"),i.textContent=u(e).core.cssText,n.textContent=u(e).dark.cssText,s.textContent=u(e).light.cssText,document.head.appendChild(i),document.head.appendChild(n),document.head.appendChild(s),l(t)}function l(e){n&&s&&("light"===e?(n.removeAttribute("media"),s.media="enabled"):(s.removeAttribute("media"),n.media="enabled"))}function h(e){i&&n&&s&&(i.textContent=u(e).core.cssText,n.textContent=u(e).dark.cssText,s.textContent=u(e).light.cssText)}function u(e){return{core:(0,o.AH)` 525 @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'); 526 @keyframes w3m-shake { 527 0% { 528 transform: scale(1) rotate(0deg); 529 } 530 20% { 531 transform: scale(1) rotate(-1deg); 532 } 533 40% { 534 transform: scale(1) rotate(1.5deg); 535 } 536 60% { 537 transform: scale(1) rotate(-1.5deg); 538 } 539 80% { 540 transform: scale(1) rotate(1deg); 541 } 542 100% { 543 transform: scale(1) rotate(0deg); 544 } 545 } 546 @keyframes w3m-iframe-fade-out { 547 0% { 548 opacity: 1; 549 } 550 100% { 551 opacity: 0; 552 } 553 } 554 @keyframes w3m-iframe-zoom-in { 555 0% { 556 transform: translateY(50px); 557 opacity: 0; 558 } 559 100% { 560 transform: translateY(0px); 561 opacity: 1; 562 } 563 } 564 @keyframes w3m-iframe-zoom-in-mobile { 565 0% { 566 transform: scale(0.95); 567 opacity: 0; 568 } 569 100% { 570 transform: scale(1); 571 opacity: 1; 572 } 573 } 574 :root { 575 --w3m-modal-width: 360px; 576 --w3m-color-mix-strength: ${(0,o.iz)(e?.["--w3m-color-mix-strength"]?`${e["--w3m-color-mix-strength"]}%`:"0%")}; 577 --w3m-font-family: ${(0,o.iz)(e?.["--w3m-font-family"]||"Inter, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;")}; 578 --w3m-font-size-master: ${(0,o.iz)(e?.["--w3m-font-size-master"]||"10px")}; 579 --w3m-border-radius-master: ${(0,o.iz)(e?.["--w3m-border-radius-master"]||"4px")}; 580 --w3m-z-index: ${(0,o.iz)(e?.["--w3m-z-index"]||
vendor: 15,824 bytes, lines 580-1006
580999)}; 581 582 --wui-font-family: var(--w3m-font-family); 583 584 --wui-font-size-mini: calc(var(--w3m-font-size-master) * 0.8); 585 --wui-font-size-micro: var(--w3m-font-size-master); 586 --wui-font-size-tiny: calc(var(--w3m-font-size-master) * 1.2); 587 --wui-font-size-small: calc(var(--w3m-font-size-master) * 1.4); 588 --wui-font-size-paragraph: calc(var(--w3m-font-size-master) * 1.6); 589 --wui-font-size-medium: calc(var(--w3m-font-size-master) * 1.8); 590 --wui-font-size-large: calc(var(--w3m-font-size-master) * 2); 591 --wui-font-size-title-6: calc(var(--w3m-font-size-master) * 2.2); 592 --wui-font-size-medium-title: calc(var(--w3m-font-size-master) * 2.4); 593 --wui-font-size-2xl: calc(var(--w3m-font-size-master) * 4); 594 595 --wui-border-radius-5xs: var(--w3m-border-radius-master); 596 --wui-border-radius-4xs: calc(var(--w3m-border-radius-master) * 1.5); 597 --wui-border-radius-3xs: calc(var(--w3m-border-radius-master) * 2); 598 --wui-border-radius-xxs: calc(var(--w3m-border-radius-master) * 3); 599 --wui-border-radius-xs: calc(var(--w3m-border-radius-master) * 4); 600 --wui-border-radius-s: calc(var(--w3m-border-radius-master) * 5); 601 --wui-border-radius-m: calc(var(--w3m-border-radius-master) * 7); 602 --wui-border-radius-l: calc(var(--w3m-border-radius-master) * 9); 603 --wui-border-radius-3xl: calc(var(--w3m-border-radius-master) * 20); 604 605 --wui-font-weight-light: 400; 606 --wui-font-weight-regular: 500; 607 --wui-font-weight-medium: 600; 608 --wui-font-weight-bold: 700; 609 610 --wui-letter-spacing-2xl: -1.6px; 611 --wui-letter-spacing-medium-title: -0.96px; 612 --wui-letter-spacing-title-6: -0.88px; 613 --wui-letter-spacing-large: -0.8px; 614 --wui-letter-spacing-medium: -0.72px; 615 --wui-letter-spacing-paragraph: -0.64px; 616 --wui-letter-spacing-small: -0.56px; 617 --wui-letter-spacing-tiny: -0.48px; 618 --wui-letter-spacing-micro: -0.2px; 619 --wui-letter-spacing-mini: -0.16px; 620 621 --wui-spacing-0: 0px; 622 --wui-spacing-4xs: 2px; 623 --wui-spacing-3xs: 4px; 624 --wui-spacing-xxs: 6px; 625 --wui-spacing-2xs: 7px; 626 --wui-spacing-xs: 8px; 627 --wui-spacing-1xs: 10px; 628 --wui-spacing-s: 12px; 629 --wui-spacing-m: 14px; 630 --wui-spacing-l: 16px; 631 --wui-spacing-2l: 18px; 632 --wui-spacing-xl: 20px; 633 --wui-spacing-xxl: 24px; 634 --wui-spacing-2xl: 32px; 635 --wui-spacing-3xl: 40px; 636 --wui-spacing-4xl: 90px; 637 --wui-spacing-5xl: 95px; 638 639 --wui-icon-box-size-xxs: 14px; 640 --wui-icon-box-size-xs: 20px; 641 --wui-icon-box-size-sm: 24px; 642 --wui-icon-box-size-md: 32px; 643 --wui-icon-box-size-mdl: 36px; 644 --wui-icon-box-size-lg: 40px; 645 --wui-icon-box-size-2lg: 48px; 646 --wui-icon-box-size-xl: 64px; 647 648 --wui-icon-size-inherit: inherit; 649 --wui-icon-size-xxs: 10px; 650 --wui-icon-size-xs: 12px; 651 --wui-icon-size-sm: 14px; 652 --wui-icon-size-md: 16px; 653 --wui-icon-size-mdl: 18px; 654 --wui-icon-size-lg: 20px; 655 --wui-icon-size-xl: 24px; 656 --wui-icon-size-xxl: 28px; 657 658 --wui-wallet-image-size-inherit: inherit; 659 --wui-wallet-image-size-sm: 40px; 660 --wui-wallet-image-size-md: 56px; 661 --wui-wallet-image-size-lg: 80px; 662 663 --wui-visual-size-size-inherit: inherit; 664 --wui-visual-size-sm: 40px; 665 --wui-visual-size-md: 55px; 666 --wui-visual-size-lg: 80px; 667 668 --wui-box-size-md: 100px; 669 --wui-box-size-lg: 120px; 670 671 --wui-ease-out-power-2: cubic-bezier(0, 0, 0.22, 1); 672 --wui-ease-out-power-1: cubic-bezier(0, 0, 0.55, 1); 673 674 --wui-ease-in-power-3: cubic-bezier(0.66, 0, 1, 1); 675 --wui-ease-in-power-2: cubic-bezier(0.45, 0, 1, 1); 676 --wui-ease-in-power-1: cubic-bezier(0.3, 0, 1, 1); 677 678 --wui-ease-inout-power-1: cubic-bezier(0.45, 0, 0.55, 1); 679 680 --wui-duration-lg: 200ms; 681 --wui-duration-md: 125ms; 682 --wui-duration-sm: 75ms; 683 684 --wui-path-network-sm: path( 685 'M15.4 2.1a5.21 5.21 0 0 1 5.2 0l11.61 6.7a5.21 5.21 0 0 1 2.61 4.52v13.4c0 1.87-1 3.59-2.6 4.52l-11.61 6.7c-1.62.93-3.6.93-5.22 0l-11.6-6.7a5.21 5.21 0 0 1-2.61-4.51v-13.4c0-1.87 1-3.6 2.6-4.52L15.4 2.1Z' 686 ); 687 688 --wui-path-network-md: path( 689 'M43.4605 10.7248L28.0485 1.61089C25.5438 0.129705 22.4562 0.129705 19.9515 1.61088L4.53951 10.7248C2.03626 12.2051 0.5 14.9365 0.5 17.886V36.1139C0.5 39.0635 2.03626 41.7949 4.53951 43.2752L19.9515 52.3891C22.4562 53.8703 25.5438 53.8703 28.0485 52.3891L43.4605 43.2752C45.9637 41.7949 47.5 39.0635 47.5 36.114V17.8861C47.5 14.9365 45.9637 12.2051 43.4605 10.7248Z' 690 ); 691 692 --wui-path-network-lg: path( 693 'M78.3244 18.926L50.1808 2.45078C45.7376 -0.150261 40.2624 -0.150262 35.8192 2.45078L7.6756 18.926C3.23322 21.5266 0.5 26.3301 0.5 31.5248V64.4752C0.5 69.6699 3.23322 74.4734 7.6756 77.074L35.8192 93.5492C40.2624 96.1503 45.7376 96.1503 50.1808 93.5492L78.3244 77.074C82.7668 74.4734 85.5 69.6699 85.5 64.4752V31.5248C85.5 26.3301 82.7668 21.5266 78.3244 18.926Z' 694 ); 695 696 --wui-width-network-sm: 36px; 697 --wui-width-network-md: 48px; 698 --wui-width-network-lg: 86px; 699 700 --wui-height-network-sm: 40px; 701 --wui-height-network-md: 54px; 702 --wui-height-network-lg: 96px; 703 704 --wui-icon-size-network-xs: 12px; 705 --wui-icon-size-network-sm: 16px; 706 --wui-icon-size-network-md: 24px; 707 --wui-icon-size-network-lg: 42px; 708 709 --wui-color-inherit: inherit; 710 711 --wui-color-inverse-100: #fff; 712 --wui-color-inverse-000: #000; 713 714 --wui-cover: rgba(20, 20, 20, 0.8); 715 716 --wui-color-modal-bg: var(--wui-color-modal-bg-base); 717 718 --wui-color-accent-100: var(--wui-color-accent-base-100); 719 --wui-color-accent-090: var(--wui-color-accent-base-090); 720 --wui-color-accent-080: var(--wui-color-accent-base-080); 721 722 --wui-color-success-100: var(--wui-color-success-base-100); 723 --wui-color-success-125: var(--wui-color-success-base-125); 724 725 --wui-color-warning-100: var(--wui-color-warning-base-100); 726 727 --wui-color-error-100: var(--wui-color-error-base-100); 728 --wui-color-error-125: var(--wui-color-error-base-125); 729 730 --wui-color-blue-100: var(--wui-color-blue-base-100); 731 --wui-color-blue-90: var(--wui-color-blue-base-90); 732 733 --wui-icon-box-bg-error-100: var(--wui-icon-box-bg-error-base-100); 734 --wui-icon-box-bg-blue-100: var(--wui-icon-box-bg-blue-base-100); 735 --wui-icon-box-bg-success-100: var(--wui-icon-box-bg-success-base-100); 736 --wui-icon-box-bg-inverse-100: var(--wui-icon-box-bg-inverse-base-100); 737 738 --wui-all-wallets-bg-100: var(--wui-all-wallets-bg-100); 739 740 --wui-avatar-border: var(--wui-avatar-border-base); 741 742 --wui-thumbnail-border: var(--wui-thumbnail-border-base); 743 744 --wui-wallet-button-bg: var(--wui-wallet-button-bg-base); 745 746 --wui-box-shadow-blue: var(--wui-color-accent-glass-020); 747 } 748 749 @supports (background: color-mix(in srgb, white 50%, black)) { 750 :root { 751 --wui-color-modal-bg: color-mix( 752 in srgb, 753 var(--w3m-color-mix) var(--w3m-color-mix-strength), 754 var(--wui-color-modal-bg-base) 755 ); 756 757 --wui-box-shadow-blue: color-mix(in srgb, var(--wui-color-accent-100) 20%, transparent); 758 759 --wui-color-accent-100: color-mix( 760 in srgb, 761 var(--wui-color-accent-base-100) 100%, 762 transparent 763 ); 764 --wui-color-accent-090: color-mix( 765 in srgb, 766 var(--wui-color-accent-base-100) 90%, 767 transparent 768 ); 769 --wui-color-accent-080: color-mix( 770 in srgb, 771 var(--wui-color-accent-base-100) 80%, 772 transparent 773 ); 774 --wui-color-accent-glass-090: color-mix( 775 in srgb, 776 var(--wui-color-accent-base-100) 90%, 777 transparent 778 ); 779 --wui-color-accent-glass-080: color-mix( 780 in srgb, 781 var(--wui-color-accent-base-100) 80%, 782 transparent 783 ); 784 --wui-color-accent-glass-020: color-mix( 785 in srgb, 786 var(--wui-color-accent-base-100) 20%, 787 transparent 788 ); 789 --wui-color-accent-glass-015: color-mix( 790 in srgb, 791 var(--wui-color-accent-base-100) 15%, 792 transparent 793 ); 794 --wui-color-accent-glass-010: color-mix( 795 in srgb, 796 var(--wui-color-accent-base-100) 10%, 797 transparent 798 ); 799 --wui-color-accent-glass-005: color-mix( 800 in srgb, 801 var(--wui-color-accent-base-100) 5%, 802 transparent 803 ); 804 --wui-color-accent-002: color-mix( 805 in srgb, 806 var(--wui-color-accent-base-100) 2%, 807 transparent 808 ); 809 810 --wui-color-fg-100: color-mix( 811 in srgb, 812 var(--w3m-color-mix) var(--w3m-color-mix-strength), 813 var(--wui-color-fg-100) 814 ); 815 --wui-color-fg-125: color-mix( 816 in srgb, 817 var(--w3m-color-mix) var(--w3m-color-mix-strength), 818 var(--wui-color-fg-125) 819 ); 820 --wui-color-fg-150: color-mix( 821 in srgb, 822 var(--w3m-color-mix) var(--w3m-color-mix-strength), 823 var(--wui-color-fg-150) 824 ); 825 --wui-color-fg-175: color-mix( 826 in srgb, 827 var(--w3m-color-mix) var(--w3m-color-mix-strength), 828 var(--wui-color-fg-175) 829 ); 830 --wui-color-fg-200: color-mix( 831 in srgb, 832 var(--w3m-color-mix) var(--w3m-color-mix-strength), 833 var(--wui-color-fg-200) 834 ); 835 --wui-color-fg-225: color-mix( 836 in srgb, 837 var(--w3m-color-mix) var(--w3m-color-mix-strength), 838 var(--wui-color-fg-225) 839 ); 840 --wui-color-fg-250: color-mix( 841 in srgb, 842 var(--w3m-color-mix) var(--w3m-color-mix-strength), 843 var(--wui-color-fg-250) 844 ); 845 --wui-color-fg-275: color-mix( 846 in srgb, 847 var(--w3m-color-mix) var(--w3m-color-mix-strength), 848 var(--wui-color-fg-275) 849 ); 850 --wui-color-fg-300: color-mix( 851 in srgb, 852 var(--w3m-color-mix) var(--w3m-color-mix-strength), 853 var(--wui-color-fg-300) 854 ); 855 --wui-color-fg-325: color-mix( 856 in srgb, 857 var(--w3m-color-mix) var(--w3m-color-mix-strength), 858 var(--wui-color-fg-325) 859 ); 860 --wui-color-fg-350: color-mix( 861 in srgb, 862 var(--w3m-color-mix) var(--w3m-color-mix-strength), 863 var(--wui-color-fg-350) 864 ); 865 866 --wui-color-bg-100: color-mix( 867 in srgb, 868 var(--w3m-color-mix) var(--w3m-color-mix-strength), 869 var(--wui-color-bg-100) 870 ); 871 --wui-color-bg-125: color-mix( 872 in srgb, 873 var(--w3m-color-mix) var(--w3m-color-mix-strength), 874 var(--wui-color-bg-125) 875 ); 876 --wui-color-bg-150: color-mix( 877 in srgb, 878 var(--w3m-color-mix) var(--w3m-color-mix-strength), 879 var(--wui-color-bg-150) 880 ); 881 --wui-color-bg-175: color-mix( 882 in srgb, 883 var(--w3m-color-mix) var(--w3m-color-mix-strength), 884 var(--wui-color-bg-175) 885 ); 886 --wui-color-bg-200: color-mix( 887 in srgb, 888 var(--w3m-color-mix) var(--w3m-color-mix-strength), 889 var(--wui-color-bg-200) 890 ); 891 --wui-color-bg-225: color-mix( 892 in srgb, 893 var(--w3m-color-mix) var(--w3m-color-mix-strength), 894 var(--wui-color-bg-225) 895 ); 896 --wui-color-bg-250: color-mix( 897 in srgb, 898 var(--w3m-color-mix) var(--w3m-color-mix-strength), 899 var(--wui-color-bg-250) 900 ); 901 --wui-color-bg-275: color-mix( 902 in srgb, 903 var(--w3m-color-mix) var(--w3m-color-mix-strength), 904 var(--wui-color-bg-275) 905 ); 906 --wui-color-bg-300: color-mix( 907 in srgb, 908 var(--w3m-color-mix) var(--w3m-color-mix-strength), 909 var(--wui-color-bg-300) 910 ); 911 --wui-color-bg-325: color-mix( 912 in srgb, 913 var(--w3m-color-mix) var(--w3m-color-mix-strength), 914 var(--wui-color-bg-325) 915 ); 916 --wui-color-bg-350: color-mix( 917 in srgb, 918 var(--w3m-color-mix) var(--w3m-color-mix-strength), 919 var(--wui-color-bg-350) 920 ); 921 922 --wui-color-success-100: color-mix( 923 in srgb, 924 var(--w3m-color-mix) var(--w3m-color-mix-strength), 925 var(--wui-color-success-base-100) 926 ); 927 --wui-color-success-125: color-mix( 928 in srgb, 929 var(--w3m-color-mix) var(--w3m-color-mix-strength), 930 var(--wui-color-success-base-125) 931 ); 932 933 --wui-color-warning-100: color-mix( 934 in srgb, 935 var(--w3m-color-mix) var(--w3m-color-mix-strength), 936 var(--wui-color-warning-base-100) 937 ); 938 939 --wui-color-error-100: color-mix( 940 in srgb, 941 var(--w3m-color-mix) var(--w3m-color-mix-strength), 942 var(--wui-color-error-base-100) 943 ); 944 --wui-color-blue-100: color-mix( 945 in srgb, 946 var(--w3m-color-mix) var(--w3m-color-mix-strength), 947 var(--wui-color-blue-base-100) 948 ); 949 --wui-color-blue-90: color-mix( 950 in srgb, 951 var(--w3m-color-mix) var(--w3m-color-mix-strength), 952 var(--wui-color-blue-base-90) 953 ); 954 --wui-color-error-125: color-mix( 955 in srgb, 956 var(--w3m-color-mix) var(--w3m-color-mix-strength), 957 var(--wui-color-error-base-125) 958 ); 959 960 --wui-icon-box-bg-error-100: color-mix( 961 in srgb, 962 var(--w3m-color-mix) var(--w3m-color-mix-strength), 963 var(--wui-icon-box-bg-error-base-100) 964 ); 965 --wui-icon-box-bg-accent-100: color-mix( 966 in srgb, 967 var(--w3m-color-mix) var(--w3m-color-mix-strength), 968 var(--wui-icon-box-bg-blue-base-100) 969 ); 970 --wui-icon-box-bg-success-100: color-mix( 971 in srgb, 972 var(--w3m-color-mix) var(--w3m-color-mix-strength), 973 var(--wui-icon-box-bg-success-base-100) 974 ); 975 --wui-icon-box-bg-inverse-100: color-mix( 976 in srgb, 977 var(--w3m-color-mix) var(--w3m-color-mix-strength), 978 var(--wui-icon-box-bg-inverse-base-100) 979 ); 980 981 --wui-all-wallets-bg-100: color-mix( 982 in srgb, 983 var(--w3m-color-mix) var(--w3m-color-mix-strength), 984 var(--wui-all-wallets-bg-100) 985 ); 986 987 --wui-avatar-border: color-mix( 988 in srgb, 989 var(--w3m-color-mix) var(--w3m-color-mix-strength), 990 var(--wui-avatar-border-base) 991 ); 992 993 --wui-thumbnail-border: color-mix( 994 in srgb, 995 var(--w3m-color-mix) var(--w3m-color-mix-strength), 996 var(--wui-thumbnail-border-base) 997 ); 998 999 --wui-wallet-button-bg: color-mix( 1000 in srgb, 1001 var(--w3m-color-mix) var(--w3m-color-mix-strength), 1002 var(--wui-wallet-button-bg-base) 1003 ); 1004 } 1005 } 1006 `,
1006light:(0,o.AH)` 1007 :root { 1008 --w3m-color-mix: ${(0,o.iz)(e?.["--w3m-color-mix"]||"#fff")}; 1009 --w3m-accent: ${(0,o.iz)((0,a.o)(e,"dark")["--w3m-accent"])}; 1010 --w3m-default: #fff; 1011 1012 --wui-color-modal-bg-base: ${(0,o.iz)((0,a.o)(e,"dark")["--w3m-background"])}; 1013 --wui-color-accent-base-100: var(--w3m-accent); 1014 1015 --wui-color-blueberry-100: hsla(230, 100%, 67%, 1); 1016 --wui-color-blueberry-090: hsla(231, 76%, 61%, 1); 1017 --wui-color-blueberry-080: hsla(230, 59%, 55%, 1); 1018 --wui-color-blueberry-050: hsla(231, 100%, 70%, 0.1); 1019 1020 --wui-color-fg-100: #e4e7e7; 1021 --wui-color-fg-125: #d0d5d5; 1022 --wui-color-fg-150: #a8b1b1; 1023 --wui-color-fg-175: #a8b0b0; 1024 --wui-color-fg-200: #949e9e; 1025 --wui-color-fg-225: #868f8f; 1026 --wui-color-fg-250: #788080; 1027 --wui-color-fg-275: #788181; 1028 --wui-color-fg-300: #6e7777; 1029 --wui-color-fg-325: #9a9a9a; 1030 --wui-color-fg-350: #363636; 1031 1032 --wui-color-bg-100: #141414; 1033 --wui-color-bg-125: #191a1a; 1034 --wui-color-bg-150: #1e1f1f; 1035 --wui-color-bg-175: #222525; 1036 --wui-color-bg-200: #272a2a; 1037 --wui-color-bg-225: #2c3030; 1038 --wui-color-bg-250: #313535; 1039 --wui-color-bg-275: #363b3b; 1040 --wui-color-bg-300: #3b4040; 1041 --wui-color-bg-325: #252525; 1042 --wui-color-bg-350: #ffffff; 1043 1044 --wui-color-success-base-100: #26d962; 1045 --wui-color-success-base-125: #30a46b; 1046 1047 --wui-color-warning-base-100: #f3a13f; 1048 1049 --wui-color-error-base-100: #f25a67; 1050 --wui-color-error-base-125: #df4a34; 1051 1052 --wui-color-blue-base-100: rgba(102, 125, 255, 1); 1053 --wui-color-blue-base-90: rgba(102, 125, 255, 0.9); 1054 1055 --wui-color-success-glass-001: rgba(38, 217, 98, 0.01); 1056 --wui-color-success-glass-002: rgba(38, 217, 98, 0.02); 1057 --wui-color-success-glass-005: rgba(38, 217, 98, 0.05); 1058 --wui-color-success-glass-010: rgba(38, 217, 98, 0.1); 1059 --wui-color-success-glass-015: rgba(38, 217, 98, 0.15); 1060 --wui-color-success-glass-020: rgba(38, 217, 98, 0.2); 1061 --wui-color-success-glass-025: rgba(38, 217, 98, 0.25); 1062 --wui-color-success-glass-030: rgba(38, 217, 98, 0.3); 1063 --wui-color-success-glass-060: rgba(38, 217, 98, 0.6); 1064 --wui-color-success-glass-080: rgba(38, 217, 98, 0.8); 1065 1066 --wui-color-success-glass-reown-020: rgba(48, 164, 107, 0.2); 1067 1068 --wui-color-warning-glass-reown-020: rgba(243, 161, 63, 0.2); 1069 1070 --wui-color-error-glass-001: rgba(242, 90, 103, 0.01); 1071 --wui-color-error-glass-002: rgba(242, 90, 103, 0.02); 1072 --wui-color-error-glass-005: rgba(242, 90, 103, 0.05); 1073 --wui-color-error-glass-010: rgba(242, 90, 103, 0.1); 1074 --wui-color-error-glass-015: rgba(242, 90, 103, 0.15); 1075 --wui-color-error-glass-020: rgba(242, 90, 103, 0.2); 1076 --wui-color-error-glass-025: rgba(242, 90, 103, 0.25); 1077 --wui-color-error-glass-030: rgba(242, 90, 103, 0.3); 1078 --wui-color-error-glass-060: rgba(242, 90, 103, 0.6); 1079 --wui-color-error-glass-080: rgba(242, 90, 103, 0.8); 1080 1081 --wui-color-error-glass-reown-020: rgba(223, 74, 52, 0.2); 1082 1083 --wui-color-gray-glass-001: rgba(255, 255, 255, 0.01); 1084 --wui-color-gray-glass-002: rgba(255, 255, 255, 0.02); 1085 --wui-color-gray-glass-005: rgba(255, 255, 255, 0.05); 1086 --wui-color-gray-glass-010: rgba(255, 255, 255, 0.1); 1087 --wui-color-gray-glass-015: rgba(255, 255, 255, 0.15); 1088 --wui-color-gray-glass-020: rgba(255, 255, 255, 0.2); 1089 --wui-color-gray-glass-025: rgba(255, 255, 255, 0.25); 1090 --wui-color-gray-glass-030: rgba(255, 255, 255, 0.3); 1091 --wui-color-gray-glass-060: rgba(255, 255, 255, 0.6); 1092 --wui-color-gray-glass-080: rgba(255, 255, 255, 0.8); 1093 --wui-color-gray-glass-090: rgba(255, 255, 255, 0.9); 1094 1095 --wui-color-dark-glass-100: rgba(42, 42, 42, 1); 1096 1097 --wui-icon-box-bg-error-base-100: #3c2426; 1098 --wui-icon-box-bg-blue-base-100: #20303f; 1099 --wui-icon-box-bg-success-base-100: #1f3a28; 1100 --wui-icon-box-bg-inverse-base-100: #243240; 1101 1102 --wui-all-wallets-bg-100: #222b35; 1103 1104 --wui-avatar-border-base: #252525; 1105
1106 --wui-thumbnail-border-base: #252525; 1107 1108 --wui-wallet-button-bg-base: var(--wui-color-bg-125); 1109 1110 --w3m-card-embedded-shadow-color: rgb(17 17 18 / 25%); 1111 } 1112 `,dark:(0,o.AH)` 1113 :root { 1114 --w3m-color-mix: ${(0,o.iz)(e?.["--w3m-color-mix"]||"#000")}; 1115 --w3m-accent: ${(0,o.iz)((0,a.o)(e,"light")["--w3m-accent"])}; 1116 --w3m-default: #000; 1117 1118 --wui-color-modal-bg-base: ${(0,o.iz)((0,a.o)(e,"light")["--w3m-background"])}; 1119 --wui-color-accent-base-100: var(--w3m-accent); 1120 1121 --wui-color-blueberry-100: hsla(231, 100%, 70%, 1); 1122 --wui-color-blueberry-090: hsla(231, 97%, 72%, 1); 1123 --wui-color-blueberry-080: hsla(231, 92%, 74%, 1); 1124 1125 --wui-color-fg-100: #141414; 1126 --wui-color-fg-125: #2d3131; 1127 --wui-color-fg-150: #474d4d; 1128 --wui-color-fg-175: #636d6d; 1129 --wui-color-fg-200: #798686; 1130 --wui-color-fg-225: #828f8f; 1131 --wui-color-fg-250: #8b9797; 1132 --wui-color-fg-275: #95a0a0; 1133 --wui-color-fg-300: #9ea9a9; 1134 --wui-color-fg-325: #9a9a9a; 1135 --wui-color-fg-350: #d0d0d0; 1136 1137 --wui-color-bg-100: #ffffff; 1138 --wui-color-bg-125: #f5fafa; 1139 --wui-color-bg-150: #f3f8f8; 1140 --wui-color-bg-175: #eef4f4; 1141 --wui-color-bg-200: #eaf1f1; 1142 --wui-color-bg-225: #e5eded; 1143 --wui-color-bg-250: #e1e9e9; 1144 --wui-color-bg-275: #dce7e7; 1145 --wui-color-bg-300: #d8e3e3; 1146 --wui-color-bg-325: #f3f3f3; 1147 --wui-color-bg-350: #202020; 1148 1149 --wui-color-success-base-100: #26b562; 1150 --wui-color-success-base-125: #30a46b; 1151 1152 --wui-color-warning-base-100: #f3a13f; 1153 1154 --wui-color-error-base-100: #f05142; 1155 --wui-color-error-base-125: #df4a34; 1156 1157 --wui-color-blue-base-100: rgba(102, 125, 255, 1); 1158 --wui-color-blue-base-90: rgba(102, 125, 255, 0.9); 1159 1160 --wui-color-success-glass-001: rgba(38, 181, 98, 0.01); 1161 --wui-color-success-glass-002: rgba(38, 181, 98, 0.02); 1162 --wui-color-success-glass-005: rgba(38, 181, 98, 0.05); 1163 --wui-color-success-glass-010: rgba(38, 181, 98, 0.1); 1164 --wui-color-success-glass-015: rgba(38, 181, 98, 0.15); 1165 --wui-color-success-glass-020: rgba(38, 181, 98, 0.2); 1166 --wui-color-success-glass-025: rgba(38, 181, 98, 0.25); 1167 --wui-color-success-glass-030: rgba(38, 181, 98, 0.3); 1168 --wui-color-success-glass-060: rgba(38, 181, 98, 0.6); 1169 --wui-color-success-glass-080: rgba(38, 181, 98, 0.8); 1170 1171 --wui-color-success-glass-reown-020: rgba(48, 164, 107, 0.2); 1172 1173 --wui-color-warning-glass-reown-020: rgba(243, 161, 63, 0.2); 1174 1175 --wui-color-error-glass-001: rgba(240, 81, 66, 0.01); 1176 --wui-color-error-glass-002: rgba(240, 81, 66, 0.02); 1177 --wui-color-error-glass-005: rgba(240, 81, 66, 0.05); 1178 --wui-color-error-glass-010: rgba(240, 81, 66, 0.1); 1179 --wui-color-error-glass-015: rgba(240, 81, 66, 0.15); 1180 --wui-color-error-glass-020: rgba(240, 81, 66, 0.2); 1181 --wui-color-error-glass-025: rgba(240, 81, 66, 0.25); 1182 --wui-color-error-glass-030: rgba(240, 81, 66, 0.3); 1183 --wui-color-error-glass-060: rgba(240, 81, 66, 0.6); 1184 --wui-color-error-glass-080: rgba(240, 81, 66, 0.8); 1185 1186 --wui-color-error-glass-reown-020: rgba(223, 74, 52, 0.2); 1187 1188 --wui-icon-box-bg-error-base-100: #f4dfdd; 1189 --wui-icon-box-bg-blue-base-100: #d9ecfb; 1190 --wui-icon-box-bg-success-base-100: #daf0e4; 1191 --wui-icon-box-bg-inverse-base-100: #dcecfc; 1192 1193 --wui-all-wallets-bg-100: #e8f1fa; 1194 1195 --wui-avatar-border-base: #f3f4f4; 1196 1197 --wui-thumbnail-border-base: #eaefef; 1198 1199 --wui-wallet-button-bg-base: var(--wui-color-bg-125); 1200 1201 --wui-color-gray-glass-001: rgba(0, 0, 0, 0.01); 1202 --wui-color-gray-glass-002: rgba(0, 0, 0, 0.02); 1203 --wui-color-gray-glass-005: rgba(0, 0, 0, 0.05); 1204 --wui-color-gray-glass-010: rgba(0, 0, 0, 0.1); 1205 --wui-color-gray-glass-015: rgba(0, 0, 0, 0.15); 1206 --wui-color-gray-glass-020: rgba(0, 0, 0, 0.2); 1207 --wui-color-gray-glass-025: rgba(0, 0, 0, 0.25); 1208 --wui-color-gray-glass-030: rgba(0, 0, 0, 0.3); 1209 --wui-color-gray-glass-060: rgba(0, 0, 0, 0.6); 1210 --wui-color-gray-glass-080: rgba(0, 0, 0, 0.8); 1211 --wui-color-gray-glass-090: rgba(0, 0, 0, 0.9); 1212 1213 --wui-color-dark-glass-100: rgba(233, 233, 233, 1); 1214 1215 --w3m-card-embedded-shadow-color: rgb(224 225 233 / 25%); 1216 } 1217 `}}let d=(0,o.AH)` 1218 *, 1219 *::after, 1220 *::before, 1221 :host { 1222 margin: 0; 1223 padding: 0; 1224 box-sizing: border-box; 1225 font-style: normal; 1226 text-rendering: optimizeSpeed; 1227 -webkit-font-smoothing: antialiased; 1228 -moz-osx-font-smoothing: grayscale; 1229 -webkit-tap-highlight-color: transparent; 1230 font-family: var(--wui-font-family); 1231 backface-visibility: hidden; 1232 } 1233`,f=(0,o.AH)` 1234 button, 1235 a { 1236 cursor: pointer; 1237 display: flex; 1238 justify-content: center;
1239 align-items: center; 1240 position: relative; 1241 transition: 1242 color var(--wui-duration-lg) var(--wui-ease-out-power-1), 1243 background-color var(--wui-duration-lg) var(--wui-ease-out-power-1), 1244 border var(--wui-duration-lg) var(--wui-ease-out-power-1), 1245 border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1), 1246 box-shadow var(--wui-duration-lg) var(--wui-ease-out-power-1); 1247 will-change: background-color, color, border, box-shadow, border-radius; 1248 outline: none; 1249 border: none; 1250 column-gap: var(--wui-spacing-3xs); 1251 background-color: transparent; 1252 text-decoration: none; 1253 } 1254 1255 wui-flex { 1256 transition: border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1); 1257 will-change: border-radius; 1258 } 1259 1260 button:disabled > wui-wallet-image, 1261 button:disabled > wui-all-wallets-image, 1262 button:disabled > wui-network-image, 1263 button:disabled > wui-image, 1264 button:disabled > wui-transaction-visual, 1265 button:disabled > wui-logo { 1266 filter: grayscale(1); 1267 } 1268 1269 @media (hover: hover) and (pointer: fine) { 1270 button:hover:enabled { 1271 background-color: var(--wui-color-gray-glass-005); 1272 } 1273 1274 button:active:enabled { 1275 background-color: var(--wui-color-gray-glass-010); 1276 } 1277 } 1278 1279 button:disabled > wui-icon-box { 1280 opacity: 0.5; 1281 } 1282 1283 input { 1284 border: none; 1285 outline: none; 1286 appearance: none; 1287 } 1288`,p=(0,o.AH)` 1289 .wui-color-inherit { 1290 color: var(--wui-color-inherit); 1291 } 1292 1293 .wui-color-accent-100 { 1294 color: var(--wui-color-accent-100); 1295 } 1296 1297 .wui-color-error-100 { 1298 color: var(--wui-color-error-100); 1299 } 1300 1301 .wui-color-blue-100 { 1302 color: var(--wui-color-blue-100); 1303 } 1304 1305 .wui-color-blue-90 { 1306 color: var(--wui-color-blue-90); 1307 } 1308 1309 .wui-color-error-125 { 1310 color: var(--wui-color-error-125); 1311 } 1312 1313 .wui-color-success-100 { 1314 color: var(--wui-color-success-100); 1315 } 1316 1317 .wui-color-success-125 { 1318 color: var(--wui-color-success-125); 1319 } 1320 1321 .wui-color-inverse-100 { 1322 color: var(--wui-color-inverse-100); 1323 } 1324 1325 .wui-color-inverse-000 { 1326 color: var(--wui-color-inverse-000); 1327 } 1328 1329 .wui-color-fg-100 { 1330 color: var(--wui-color-fg-100); 1331 } 1332 1333 .wui-color-fg-200 { 1334 color: var(--wui-color-fg-200); 1335 } 1336 1337 .wui-color-fg-300 { 1338 color: var(--wui-color-fg-300); 1339 } 1340 1341 .wui-color-fg-325 { 1342 color: var(--wui-color-fg-325); 1343 } 1344 1345 .wui-color-fg-350 { 1346 color: var(--wui-color-fg-350); 1347 } 1348 1349 .wui-bg-color-inherit { 1350 background-color: var(--wui-color-inherit); 1351 } 1352 1353 .wui-bg-color-blue-100 { 1354 background-color: var(--wui-color-accent-100); 1355 } 1356 1357 .wui-bg-color-error-100 { 1358 background-color: var(--wui-color-error-100); 1359 } 1360 1361 .wui-bg-color-error-125 { 1362 background-color: var(--wui-color-error-125); 1363 } 1364 1365 .wui-bg-color-success-100 { 1366 background-color: var(--wui-color-success-100); 1367 } 1368 1369 .wui-bg-color-success-125 { 1370 background-color: var(--wui-color-success-100); 1371 } 1372 1373 .wui-bg-color-inverse-100 { 1374 background-color: var(--wui-color-inverse-100); 1375 } 1376 1377 .wui-bg-color-inverse-000 { 1378 background-color: var(--wui-color-inverse-000); 1379 } 1380 1381 .wui-bg-color-fg-100 { 1382 background-color: var(--wui-color-fg-100); 1383 } 1384 1385 .wui-bg-color-fg-200 { 1386 background-color: var(--wui-color-fg-200); 1387 } 1388 1389 .wui-bg-color-fg-300 { 1390 background-color: var(--wui-color-fg-300); 1391 } 1392 1393 .wui-color-fg-325 { 1394 background-color: var(--wui-color-fg-325); 1395 } 1396 1397 .wui-color-fg-350 { 1398 background-color: var(--wui-color-fg-350); 1399 } 1400`},72880:(e,t,r)=>{"use strict";r.d(t,{N:()=>y});var i=r(70524),n=r(98866),s=r(14744),o=r(12319),a=r(32464),c=r(58653),l=r(29936),h=r(67695),u=r(66254),d=r(70417),f=r(55480);let p=o.w.getApiUrl(),g=new a.Z({baseUrl:p,clientId:null}),m=(0,i.BX)({promises:{},page:1,count:0,featured:[],allFeatured:[],recommended:[],allRecommended:[],wallets:[],search:[],isAnalyticsEnabled:!1,excludedWallets:[],isFetchingRecommendedWallets:!1}),y={state:m,subscribeKey:(e,t)=>(0,n.u$)(m,e,t),_getSdkProperties(){let{projectId:e,sdkType:t,sdkVersion:r}=f.H.state;return{projectId:e,st:t||"appkit",sv:r||"html-wagmi-4.2.2"}},_filterOutExtensions:e=>f.H.state.isUniversalProvider?e.filter(e=>!!(e.mobile_link||e.desktop_link||e.webapp_link)):e,async _fetchWalletImage(e){let t=`${g.baseUrl}/getWalletImage/${e}`,r=await g.getBlob({path:t,params:y._getSdkProperties()});l.j.setWalletImage(e,URL.createObjectURL(r))},async _fetchNetworkImage(e){let t=`${g.baseUrl}/public/getAssetImage/${e}`,r=await g.getBlob({path:t,params:y._getSdkProperties()});l.j.setNetworkImage(e,URL.createObjectURL(r))},async _fetchConnectorImage(e){let t=`${g.baseUrl}/public/getAssetImage/${e}`,r=await g.getBlob({path:t,params:y._getSdkProperties()});l.j.setConnectorImage(e,URL.createObjectURL(r))},async _fetchCurrencyImage(e){let t=`${g.baseUrl}/public/getCurrencyImage/${e}`,r=await g.getBlob({path:t,params:y._getSdkProperties()});l.j.setCurrencyImage(e,URL.createObjectURL(r))},async _fetchTokenImage(e){let t=`${g.baseUrl}/public/getTokenImage/${e}`,r=await g.getBlob({path:t,params:y._getSdkProperties()});l.j.setTokenImage(e,URL.createObjectURL(r))},async fetchNetworkImages(){let e=h.W.getAllRequestedCaipNetworks(),t=e?.map(({assets:e})=>
1400e?.imageId).filter(Boolean).filter(e=>!s.$.getNetworkImageById(e));t&&await Promise.allSettled(t.map(e=>y._fetchNetworkImage(e)))},async fetchConnectorImages(){let{connectors:e}=u.a.state,t=e.map(({imageId:e})=>e).filter(Boolean);await Promise.allSettled(t.map(e=>y._fetchConnectorImage(e)))},async fetchCurrencyImages(e=[]){await Promise.allSettled(e.map(e=>y._fetchCurrencyImage(e)))},async fetchTokenImages(e=[]){await Promise.allSettled(e.map(e=>y._fetchTokenImage(e)))},async fetchFeaturedWallets(){let{featuredWalletIds:e}=f.H.state;if(e?.length){let{data:t}=await g.get({path:"/getWallets",params:{...y._getSdkProperties(),page:"1",entries:e?.length?String(e.length):"4",include:e?.join(",")}});t.sort((t,r)=>e.indexOf(t.id)-e.indexOf(r.id));let r=t.map(e=>e.image_id).filter(Boolean);await Promise.allSettled(r.map(e=>y._fetchWalletImage(e))),m.featured=t,m.allFeatured=t}},async fetchRecommendedWallets(){try{m.isFetchingRecommendedWallets=!0;let{includeWalletIds:e,excludeWalletIds:t,featuredWalletIds:r}=f.H.state,i=[...t??[],...r??[]].filter(Boolean),n=h.W.getRequestedCaipNetworkIds().join(","),{data:s,count:o}=await g.get({path:"/getWallets",params:{...y._getSdkProperties(),page:"1",chains:n,entries:"4",include:e?.join(","),exclude:i?.join(",")}}),a=c.i.getRecentWallets(),l=s.map(e=>e.image_id).filter(Boolean),u=a.map(e=>e.image_id).filter(Boolean);await Promise.allSettled([...l,...u].map(e=>y._fetchWalletImage(e))),m.recommended=s,m.allRecommended=s,m.count=o??0}catch{}finally{m.isFetchingRecommendedWallets=!1}},async fetchWallets({page:e}){let{includeWalletIds:t,excludeWalletIds:r,featuredWalletIds:i}=f.H.state,n=h.W.getRequestedCaipNetworkIds().join(","),s=[...m.recommended.map(({id:e})=>e),...r??[],...i??[]].filter(Boolean),{data:a,count:c}=await g.get({path:"/getWallets",params:{...y._getSdkProperties(),page:String(e),entries:"40",chains:n,include:t?.join(","),exclude:s.join(",")}}),l=a.slice(0,20).map(e=>e.image_id).filter(Boolean);await Promise.allSettled(l.map(e=>y._fetchWalletImage(e))),m.wallets=o.w.uniqueBy([...m.wallets,...y._filterOutExtensions(a)],"id"),m.count=c>m.count?c:m.count,m.page=e},async initializeExcludedWallets({ids:e}){let t=h.W.getRequestedCaipNetworkIds().join(","),{data:r}=await g.get({path:"/getWallets",params:{...y._getSdkProperties(),page:"1",entries:String(e.length),chains:t,include:e?.join(",")}});r&&r.forEach(e=>{e?.rdns&&m.excludedWallets.push({rdns:e.rdns,name:e.name})})},async searchWallet({search:e,badge:t}){let{includeWalletIds:r,excludeWalletIds:i}=f.H.state;m.search=[];let n=h.W.getRequestedCaipNetworkIds().join(","),{data:s}=await g.get({path:"/getWallets",params:{...y._getSdkProperties(),page:"1",entries:"100",search:e?.trim(),badge_type:t,chains:n,include:r?.join(","),exclude:i?.join(",")}});d.E.sendEvent({type:"track",event:"SEARCH_WALLET",properties:{badge:t??"",search:e??""}});let a=s.map(e=>e.image_id).filter(Boolean);await Promise.allSettled([...a.map(e=>y._fetchWalletImage(e)),o.w.wait(300)]),m.search=y._filterOutExtensions(s)},initPromise(e,t){let r=m.promises[e];return r||(m.promises[e]=t())},prefetch:({fetchConnectorImages:e=!0,fetchFeaturedWallets:t=!0,fetchRecommendedWallets:r=!0,fetchNetworkImages:i=!0}={})=>Promise.allSettled([e&&y.initPromise("connectorImages",y.fetchConnectorImages),t&&y.initPromise("featuredWallets",y.fetchFeaturedWallets),r&&y.initPromise("recommendedWallets",y.fetchRecommendedWallets),i&&y.initPromise("networkImages",y.fetchNetworkImages)].filter(Boolean)),prefetchAnalyticsConfig(){f.H.state.features?.anal
1400ytics&&y.fetchAnalyticsConfig()},async fetchAnalyticsConfig(){try{let{isAnalyticsEnabled:e}=await g.get({path:"/getAnalyticsConfig",params:y._getSdkProperties()});f.H.setFeatures({analytics:e})}catch(e){f.H.setFeatures({analytics:!1})}},setFilterByNamespace(e){if(!e){m.featured=m.allFeatured,m.recommended=m.allRecommended;return}let t=h.W.getRequestedCaipNetworkIds().join(",");m.featured=m.allFeatured.filter(e=>e.chains?.some(e=>t.includes(e))),m.recommended=m.allRecommended.filter(e=>e.chains?.some(e=>t.includes(e)))}}},73537:(e,t,r)=>{"use strict";r.d(t,{Vl:()=>n});var i=r(87358);void 0!==i&&void 0!==i.env&&i.env.NEXT_PUBLIC_SECURE_SITE_SDK_URL,void 0!==i&&void 0!==i.env&&i.env.NEXT_PUBLIC_DEFAULT_LOG_LEVEL,void 0!==i&&void 0!==i.env&&i.env.NEXT_PUBLIC_SECURE_SITE_SDK_VERSION;let n={SAFE_RPC_METHODS:["eth_accounts","eth_blockNumber","eth_call","eth_chainId","eth_estimateGas","eth_feeHistory","eth_gasPrice","eth_getAccount","eth_getBalance","eth_getBlockByHash","eth_getBlockByNumber","eth_getBlockReceipts","eth_getBlockTransactionCountByHash","eth_getBlockTransactionCountByNumber","eth_getCode","eth_getFilterChanges","eth_getFilterLogs","eth_getLogs","eth_getProof","eth_getStorageAt","eth_getTransactionByBlockHashAndIndex","eth_getTransactionByBlockNumberAndIndex","eth_getTransactionByHash","eth_getTransactionCount","eth_getTransactionReceipt","eth_getUncleCountByBlockHash","eth_getUncleCountByBlockNumber","eth_maxPriorityFeePerGas","eth_newBlockFilter","eth_newFilter","eth_newPendingTransactionFilter","eth_sendRawTransaction","eth_syncing","eth_uninstallFilter","wallet_getCapabilities","wallet_getCallsStatus","eth_getUserOperationReceipt","eth_estimateUserOperationGas","eth_getUserOperationByHash","eth_supportedEntryPoints","wallet_getAssets"],NOT_SAFE_RPC_METHODS:["personal_sign","eth_signTypedData_v4","eth_sendTransaction","solana_signMessage","solana_signTransaction","solana_signAllTransactions","solana_signAndSendTransaction","wallet_sendCalls","wallet_grantPermissions","wallet_revokePermissions","eth_sendUserOperation"],GET_CHAIN_ID:"eth_chainId",RPC_METHOD_NOT_ALLOWED_MESSAGE:"Requested RPC call is not allowed",RPC_METHOD_NOT_ALLOWED_UI_MESSAGE:"Action not allowed",ACCOUNT_TYPES:{EOA:"eoa",SMART_ACCOUNT:"smartAccount"}}},73987:(e,t,r)=>{let i=r(89158),n=r(46342);function s(e){this.mode=i.KANJI,this.data=e}s.getBitsLength=function(e){return 13*e},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let r=n.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");r=(r>>>8&255)*192+(255&r),e.put(r,13)}},e.exports=s},74534:(e,t,r)=>{"use strict";r.d(t,{S:()=>o});var i=r(25223),n=r(12115),s=r(84034);let o=({children:e,endpoint:t,config:r={commitment:"confirmed"}})=>{let o=(0,n.useMemo)(()=>new i.Connection(t,r),[t,r]);return n.createElement(s.E.Provider,{value:{connection:o}},e)}},75009:(e,t,r)=>{"use strict";r.d(t,{bI:()=>C});var i=r(34918),n=r(458);class s extends n.Vw{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,(0,n.sd)(e);let r=(0,n.ZJ)(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?e.create().update(r).digest():r);for(let e=0;e<s.length;e++)s[e]^=54;this.iHash.update(s),this.oHash=e.create();for(let e=0;e<s.length;e++)s[e]^=106;this.oHash.update(s),(0,n.uH)(s)}update(e){return(0,n.CC)(this),this.iHash.update(e),this}digestInto(e){(0,n.CC)(this),(0,n.DO)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:r,finished:i,destroyed:n,blockLen:s,outputLen:o}=this;return e.finished=i,e.destroyed=n,e.blockLen=s,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let o=(e,t,r)=>new s(e,t).update(r).digest();o.create=(e,t)=>
vendor: 13,031 bytes, line 1400
1400new s(e,t);var a=r(5257),c=r(40950),l=r(22527);let h=(e,t)=>(e+(e>=0?t:-t)/y)/t;function u(e){if(!["compact","recovered","der"].includes(e))throw Error('Signature format must be "compact", "recovered", or "der"');return e}function d(e,t){let r={};for(let i of Object.keys(t))r[i]=void 0===e[i]?t[i]:e[i];return(0,a.d6)(r.lowS,"lowS"),(0,a.d6)(r.prehash,"prehash"),void 0!==r.format&&u(r.format),r}class f extends Error{constructor(e=""){super(e)}}let p={Err:f,_tlv:{encode:(e,t)=>{let{Err:r}=p;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");let i=t.length/2,n=(0,a.zW)(i);if(n.length/2&128)throw new r("tlv.encode: long form length too big");let s=i>127?(0,a.zW)(n.length/2|128):"";return(0,a.zW)(e)+s+n+t},decode(e,t){let{Err:r}=p,i=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[i++]!==e)throw new r("tlv.decode: wrong tlv");let n=t[i++],s=0;if(128&n){let e=127&n;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");let o=t.subarray(i,i+e);if(o.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===o[0])throw new r("tlv.decode(long): zero leftmost byte");for(let e of o)s=s<<8|e;if(i+=e,s<128)throw new r("tlv.decode(long): not minimal encoding")}else s=n;let o=t.subarray(i,i+s);if(o.length!==s)throw new r("tlv.decode: wrong value length");return{v:o,l:t.subarray(i+s)}}},_int:{encode(e){let{Err:t}=p;if(e<g)throw new t("integer: negative integers are not allowed");let r=(0,a.zW)(e);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=p;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return(0,a.Ph)(e)}},toSig(e){let{Err:t,_int:r,_tlv:i}=p,n=(0,a.qj)("signature",e),{v:s,l:o}=i.decode(48,n);if(o.length)throw new t("invalid signature: left bytes after parsing");let{v:c,l:l}=i.decode(2,s),{v:h,l:u}=i.decode(2,l);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(c),s:r.decode(h)}},hexFromSig(e){let{_tlv:t,_int:r}=p,i=t.encode(2,r.encode(e.r)),n=t.encode(2,r.encode(e.s));return t.encode(48,i+n)}},g=BigInt(0),m=BigInt(1),y=BigInt(2),b=BigInt(3),w=BigInt(4);function v(e,t){let r,{BYTES:i}=e;if("bigint"==typeof t)r=t;else{let n=(0,a.qj)("private key",t);try{r=e.fromBytes(n)}catch(e){throw Error(`invalid private key: expected ui8a of size ${i}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw Error("invalid private key: out of range [1..N-1]");return r}function x(e){return Uint8Array.of(e?2:3)}function E(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}let _={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},I={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},A=BigInt(2),S=(0,l.D0)(_.p,{sqrt:function(e){let t=_.p,r=BigInt(3),i=BigInt(6),n=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),h=e*e*e%t,u=h*h*e%t,d=(0,l.zH)(u,r,t)*u%t,f=(0,l.zH)(d,r,t)*u%t,p=(0,l.zH)(f,A,t)*h%t,g=(0,l.zH)(p,n,t)*p%t,m=(0,l.zH)(g,s,t)*g%t,y=(0,l.zH)(m,a,t)*m%t,b=(0,l.zH)(y,c,t)*y%t,w=(0,l.zH)(b,a,t)*m%t,v=(0,l.zH)(w,r,t)*u%t,x=(0,l.zH)(v,o,t)*g%t,E=(0,l.zH)(x,i,t)*h%t,I=(0,l.zH)(E,A,t);if(!S.eql(S.sqr(I),e))throw Error("Cannot find square root");return I}}),C=function(e,t){let r=t=>(function(e){let{CURVE:t,curveOpts:r,hash:i,ecdsaOpts:s}=function(e){let{CURVE:t,curveOpts:r}=function(e){let t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},r=e.Fp,i=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(e=>Math.ceil(e/2)))):void 0,n={Fp:r,Fn:(0,l.D0)(t.n,{BITS:e.nBitLength,allowedLengths:i,modFromBytes:e.wrapPrivateKey}),allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:n}}(e),i={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:r,hash:e.hash,ecdsaOpts:i}}(e),f=function(e,t,r={}){(0,n.sd)(t),(0,a.DS)(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let i=r.randomBytes||n.po,s=r.hmac||((e,...r)=>o(t,e,(0,n.Id)(...r))),{Fp:c,Fn:h}=e,{ORDER:f,BITS:b}=h,{keygen:w,getPublicKey:_,getSharedSecret:I,utils:A,lengths:S}=function(e,t={}){let{Fn:r}=e,i=t.randomBytes||n.po,s=Object.assign(E(e.Fp,r),{seed:(0,l.Tp)(r.ORDER)});function o(e){try{return!!v(r,e)}catch(e){return!1}}function c(e=i(s.seed)){return(0,l.qy)((0,a.eV)(e,s.seed,"seed"),r.ORDER)}function h(t,i=!0){return e.BASE.multiply(v(r,t)).toBytes(i)}function u(t){if("bigint"==typeof t)return!1;if(t instanceof e)return!0;let{secretKey:i,publicKey:n,publicKeyUncompressed:o}=s;if(r.allowedLengths||i===n)return;let c=(0,a.qj)("key",t).length;return c===n||c===o}return Object.freeze({getPublicKey:h,getSharedSecret:function(t,i,n=!0){if(!0===u(t))throw Error("first arg must be private key");if(!1===u(i))throw Error("second arg must be public key");let s=v(r,t);return e.fromHex(i).multiply(s).toBytes(n)},keygen:function(e){let t=c(e);return{secretKey:t,publicKey:h(t)}},Point:e,utils:{isValidSecretKey:o,isValidPublicKey:function(t,r){let{publicKey:i,publicKeyUncompressed:n}=s;try{let s=t.length;if(!0===r&&s!==i||!1===r&&s!==n)return!1;return!!e.fromBytes(t)}catch(e){return!1}},randomSecretKey:c,isValidPrivateKey:o,randomPrivateKey:c,normPrivateKeyToScalar:e=>v(r,e),precompute:(t=8,r=e.BASE)=>r.precompute(t,!1)},lengths:s})}(e,r),C={prehash:!1,lowS:"boolean"==typeof r.lowS&&r.lowS,format:void 0,extraEntropy:!1},N="compact";function O(e,t){if(!h.isValidNot0(t))throw Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}class P{constructor(e,t,r){this.r=O("r",e),this.s=O("s",t),null!=r&&(this.recovery=r),Object.freeze(this)}static fromBytes(e,t=N){let r;if(!function(e,t){u(t);let r=S.signature;(0,a.eV)(e,"compact"===t?r:"recovered"===t?r+1:void 0,`${t} signature`)}(e,t),"der"===t){let{r:t,s:r}=p.toSig((0,a.eV)(e));return new P(t,r)}"recovered"===t&&(r=e[0],t="compact",e=e.subarray(1));let i=h.BYTES,n=e.subarray(0,i),s=e.subarray(i,2*i);return new P(h.fromBytes(n),h.fromBytes(s),r)}static fromHex(e,t){return this.fromBytes((0,n.aT)(e),t)}addRecoveryBit(e){return new P(this.r,this.s,e)}recoverPublicKey(t){let r=c.ORDER,{r:i,s,recovery:o}=this;if(null==o||![0,1,2,3].includes(o))throw Error("recovery id invalid");if(f*y<r&&o>1)throw Error("recovery id is ambiguous for h>1 curve");let l=2===o||3===o?i+f:i;if(!c.isValid(l))throw Error("recovery id 2 or 3 invalid");let u=c.toBytes(l),d=e.fromBytes((0,n.Id)(x((1&o)==0),u)),p=h.inv(l),g=M((0,a.qj)("msgHash",t)),m=h.create(-g*p),b=h.create(s*p),w=e.BASE.multiplyUnsafe(m).add(d.multiplyUnsafe(b));if(w.is0())throw Error("point at infinify");return w.assertValidity(),w}hasHighS(){return this.s>f>>m}toBytes(e=N){if(u(e),"der"===e)return(0,n.aT)(p.hexFromSig(this));let t=h.toBytes(this.r),r=h.toBytes(this.s);if("recovered"===e){if(null==this.recovery)throw Error("recovery bit must be present");return(0,n.Id)(Uint8Array.of(this.recovery),t,r)}return(0,n.Id)(t,r)}toHex(e){return(0,n.My)(this.toBytes(e))}assertValidity(){}static fromCompact(e){return P.fromBytes((0,a.qj)("sig",e),"compact")}static fromDER(e){return P.fromBytes((0,a.qj)("sig",e),"der")}normalizeS(){return this.hasHighS()?new P(this.r,h.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return(0,n.My)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,n.My)(this.toBytes("compact"))}}let T=r.bits2int||function(e){if(e.length>8192)throw Error("input is too large");let t=(0,a.Ph)(e),r=8*e.length-b;return r>0?t>>BigInt(r):t},M=r.bits2int_modN||function(e){return h.create(T(e))},R=(0,a.OG)(b);function k(e){return(0,a.aK)("num < 2^"+b,e,g,R),h.toBytes(e)}function D(e,r){return(0,a.eV)(e,void 0,"message"),r?(0,a.eV)(t(e),void 0,"prehashed message"):e}return Object.freeze({keygen:w,getPublicKey:_,getSharedSecret:I,utils:A,lengths:S,Point:e,sign:function(r,o,c={}){let{seed:l,k2sig:u}=function(t,r,s){if(["recovered","canonical"].some(e=>e in s))throw Error("sign() legacy options not supported");let{lowS:o,prehash:c,extraEntropy:l}=d(s,C),u=M(t=D(t,c)),p=v(h,r),y=[k(p),k(u)];if(null!=l&&!1!==l){let e=!0===l?i(S.secretKey):l;y.push((0,a.qj)("extraEntropy",e))}return{seed:(0,n.Id)(...y),k2sig:function(t){let r=T(t);if(!h.isValidNot0(r))return;let i=h.inv(r),n=e.BASE.multiply(r).toAffine(),s=h.create(n.x);if(s===g)return;let a=h.create(i*h.create(u+s*p));if(a===g)return;let c=2*(n.x!==s)|Number(n.y&m),l=a;return o&&a>f>>m&&(l=h.neg(a),c^=1),new P(s,l,c)}}}(r=(0,a.qj)("message",r),o,c);return(0,a.fg)(t.outputLen,h.BYTES,s)(l,u)},verify:function(t,r,i,s={}){let{lowS:o,prehash:c,format:l}=d(s,C);if(i=(0,a.qj)("publicKey",i),r=D((0,a.qj)("message",r),c),"strict"in s)throw Error("options.strict was renamed to lowS");let u=void 0===l?function(e){let t,r="string"==typeof e||(0,n.aY)(e),i=!r&&null!==e&&"object"==typeof e&&"bigint"==typeof e.r&&"bigint"==typeof e.s;if(!r&&!i)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(i)t=new P(e.r,e.s);else if(r){try{t=P.fromBytes((0,a.qj)("sig",e),"der")}catch(e){if(!(e instanceof p.Err))throw e}if(!t)try{t=P.fromBytes((0,a.qj)("sig",e),"compact")}catch(e){return!1}}return!!t&&t}(t):P.fromBytes((0,a.qj)("sig",t),l);if(!1===u)return!1;try{let t=e.fromBytes(i);if(o&&u.hasHighS())return!1;let{r:n,s}=u,a=M(r),c=h.inv(s),l=h.create(a*c),d=h.create(n*c),f=e.BASE.multiplyUnsafe(l).add(t.multiplyUnsafe(d));if(f.is0())return!1;return h.create(f.x)===n}catch(e){return!1}},recoverPublicKey:function(e,t,r={}){let{prehash:i}=d(r,C);return t=D(t,i),P.fromBytes(e,"recovered").recoverPublicKey(t).toBytes()},Signature:P,hash:t})}(function(e,t={}){let r=(0,c.UT)("weierstrass",e,t),{Fp:i,Fn:s}=r,o=r.CURVE,{h:l,n:u}=o;(0,a.DS)(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:d}=t;if(d&&(!i.is0(o.a)||"bigint"!=typeof d.beta||!Array.isArray(d.basises)))throw Error('invalid endo: expected "beta": bigint and "basises": array');let f=E(i,s);function p(){if(!i.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}let y=t.toBytes||function(e,t,r){let{x:s,y:o}=t.toAffine(),c=i.toBytes(s);if((0,a.d6)(r,"isCompressed"),!r)return(0,n.Id)(Uint8Array.of(4),c,i.toBytes(o));{p();let e=!i.isOdd(o);return(0,n.Id)(x(e),c)}},_=t.fromBytes||function(e){(0,a.eV)(e,void 0,"Point");let{publicKey:t,publicKeyUncompressed:r}=f,n=e.length,s=e[0],o=e.subarray(1);if(n===t&&(2===s||3===s)){let e,t=i.fromBytes(o);if(!i.isValid(t))throw Error("bad point: is not on curve, wrong x");let r=I(t);try{e=i.sqrt(r)}catch(e){throw Error("bad point: is not on curve, sqrt error"+(e instanceof Error?": "+e.message:""))}return p(),(1&s)==1!==i.isOdd(e)&&(e=i.neg(e)),{x:t,y:e}}if(n===r&&4===s){let e=i.BYTES,t=i.fromBytes(o.subarray(0,e)),r=i.fromBytes(o.subarray(e,2*e));if(!A(t,r))throw Error("bad point: is not on curve");return{x:t,y:r}}throw Error(`bad point: got length ${n}, expected compressed=${t} or uncompressed=${r}`)};function I(e){let t=i.sqr(e),r=i.mul(t,e);return i.add(i.add(r,i.mul(e,o.a)),o.b)}function A(e,t){let r=i.sqr(t),n=I(e);return i.eql(r,n)}if(!A(o.Gx,o.Gy))throw Error("bad curve params: generator point");let S=i.mul(i.pow(o.a,b),w),C=i.mul(i.sqr(o.b),BigInt(27));if(i.is0(i.add(S,C)))throw Error("bad curve params: a or b");function N(e,t,r=!1){if(!i.isValid(t)||r&&i.is0(t))throw Error(`bad point coordinate ${e}`);return t}function O(e){if(!(e instanceof k))throw Error("ProjectivePoint expected")}function P(e){if(!d||!d.basises)throw Error("no endo");return function(e,t,r){let[[i,n],[s,o]]=t,c=h(o*e,r),l=h(-n*e,r),u=e-c*i-l*s,d=-c*n-l*o,f=u<g,p=d<g;f&&(u=-u),p&&(d=-d);let y=(0,a.OG)(Math.ceil((0,a.dJ)(r)/2))+m;if(u<g||u>=y||d<g||d>=y)throw Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:f,k1:u,k2neg:p,k2:d}}(e,d.basises,s.ORDER)}let T=(0,a.x)((e,t)=>{let{X:r,Y:n,Z:s}=e;if(i.eql(s,i.ONE))return{x:r,y:n};let o=e.is0();null==t&&(t=o?i.ONE:i.inv(s));let a=i.mul(r,t),c=i.mul(n,t),l=i.mul(s,t);if(o)return{x:i.ZERO,y:i.ZERO};
1400if(!i.eql(l,i.ONE))throw Error("invZ was invalid");return{x:a,y:c}}),M=(0,a.x)(e=>{if(e.is0()){if(t.allowInfinityPoint&&!i.is0(e.Y))return;throw Error("bad point: ZERO")}let{x:r,y:n}=e.toAffine();if(!i.isValid(r)||!i.isValid(n))throw Error("bad point: x or y not field elements");if(!A(r,n))throw Error("bad point: equation left != right");if(!e.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});function R(e,t,r,n,s){return r=new k(i.mul(r.X,e),r.Y,r.Z),t=(0,c.u0)(n,t),r=(0,c.u0)(s,r),t.add(r)}class k{constructor(e,t,r){this.X=N("x",e),this.Y=N("y",t,!0),this.Z=N("z",r),Object.freeze(this)}static CURVE(){return o}static fromAffine(e){let{x:t,y:r}=e||{};if(!e||!i.isValid(t)||!i.isValid(r))throw Error("invalid affine point");if(e instanceof k)throw Error("projective point not allowed");return i.is0(t)&&i.is0(r)?k.ZERO:new k(t,r,i.ONE)}static fromBytes(e){let t=k.fromAffine(_((0,a.eV)(e,void 0,"point")));return t.assertValidity(),t}static fromHex(e){return k.fromBytes((0,a.qj)("pointHex",e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return L.createCache(this,e),t||this.multiply(b),this}assertValidity(){M(this)}hasEvenY(){let{y:e}=this.toAffine();if(!i.isOdd)throw Error("Field doesn't support isOdd");return!i.isOdd(e)}equals(e){O(e);let{X:t,Y:r,Z:n}=this,{X:s,Y:o,Z:a}=e,c=i.eql(i.mul(t,a),i.mul(s,n)),l=i.eql(i.mul(r,a),i.mul(o,n));return c&&l}negate(){return new k(this.X,i.neg(this.Y),this.Z)}double(){let{a:e,b:t}=o,r=i.mul(t,b),{X:n,Y:s,Z:a}=this,c=i.ZERO,l=i.ZERO,h=i.ZERO,u=i.mul(n,n),d=i.mul(s,s),f=i.mul(a,a),p=i.mul(n,s);return p=i.add(p,p),h=i.mul(n,a),h=i.add(h,h),c=i.mul(e,h),l=i.mul(r,f),l=i.add(c,l),c=i.sub(d,l),l=i.add(d,l),l=i.mul(c,l),c=i.mul(p,c),h=i.mul(r,h),f=i.mul(e,f),p=i.sub(u,f),p=i.mul(e,p),p=i.add(p,h),h=i.add(u,u),u=i.add(h,u),u=i.add(u,f),u=i.mul(u,p),l=i.add(l,u),f=i.mul(s,a),f=i.add(f,f),u=i.mul(f,p),c=i.sub(c,u),h=i.mul(f,d),h=i.add(h,h),new k(c,l,h=i.add(h,h))}add(e){O(e);let{X:t,Y:r,Z:n}=this,{X:s,Y:a,Z:c}=e,l=i.ZERO,h=i.ZERO,u=i.ZERO,d=o.a,f=i.mul(o.b,b),p=i.mul(t,s),g=i.mul(r,a),m=i.mul(n,c),y=i.add(t,r),w=i.add(s,a);y=i.mul(y,w),w=i.add(p,g),y=i.sub(y,w),w=i.add(t,n);let v=i.add(s,c);return w=i.mul(w,v),v=i.add(p,m),w=i.sub(w,v),v=i.add(r,n),l=i.add(a,c),v=i.mul(v,l),l=i.add(g,m),v=i.sub(v,l),u=i.mul(d,w),l=i.mul(f,m),u=i.add(l,u),l=i.sub(g,u),u=i.add(g,u),h=i.mul(l,u),g=i.add(p,p),g=i.add(g,p),m=i.mul(d,m),w=i.mul(f,w),g=i.add(g,m),m=i.sub(p,m),m=i.mul(d,m),w=i.add(w,m),p=i.mul(g,w),h=i.add(h,p),p=i.mul(v,w),l=i.mul(y,l),l=i.sub(l,p),p=i.mul(y,g),u=i.mul(v,u),new k(l,h,u=i.add(u,p))}subtract(e){return this.add(e.negate())}is0(){return this.equals(k.ZERO)}multiply(e){let r,i,{endo:n}=t;if(!s.isValidNot0(e))throw Error("invalid scalar: out of range");let o=e=>L.cached(this,e,e=>(0,c.Ak)(k,e));if(n){let{k1neg:t,k1:s,k2neg:a,k2:c}=P(e),{p:l,f:h}=o(s),{p:u,f:d}=o(c);i=h.add(d),r=R(n.beta,l,u,t,a)}else{let{p:t,f:n}=o(e);r=t,i=n}return(0,c.Ak)(k,[r,i])[0]}multiplyUnsafe(e){let{endo:r}=t;if(!s.isValid(e))throw Error("invalid scalar: out of range");if(e===g||this.is0())return k.ZERO;if(e===m)return this;if(L.hasCache(this))return this.multiply(e);if(!r)return L.unsafe(this,e);{let{k1neg:t,k1:i,k2neg:n,k2:s}=P(e),{p1:o,p2:a}=(0,c.fH)(k,this,i,s);return R(r.beta,o,a,t,n)}}multiplyAndAddUnsafe(e,t,r){let i=this.multiplyUnsafe(t).add(e.multiplyUnsafe(r));return i.is0()?void 0:i}toAffine(e){return T(this,e)}isTorsionFree(){let{isTorsionFree:e}=t;return l===m||(e?e(k,this):L.unsafe(this,u).is0())}clearCofactor(){let{clearCofactor:e}=t;return l===m?this:e?e(k,this):this.multiplyUnsafe(l)}isSmallOrder(){return this.multiplyUnsafe(l).is0()}toBytes(e=!0){return(0,a.d6)(e,"isCompressed"),this.assertValidity(),y(k,this,e)}toHex(e=!0){return(0,n.My)(this.toBytes(e))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(e=!0){return this.toBytes(e)}_setWindowSize(e){this.precompute(e)}static normalizeZ(e){return(0,c.Ak)(k,e)}static msm(e,t){return(0,c.Xf)(k,s,e,t)}static fromPrivateKey(e){return k.BASE.multiply(v(s,e))}}k.BASE=new k(o.Gx,o.Gy,i.ONE),k.ZERO=new k(i.ZERO,i.ONE,i.ZERO),k.Fp=i,k.Fn=s;let D=s.BITS,L=new c.hT(k,t.endo?Math.ceil(D/2):D);return k.BASE.precompute(8),k}(t,r),i,s),_=f.Point;return Object.assign({},f,{ProjectivePoint:_,CURVE:Object.assign({},e,(0,l.LH)(_.Fn.ORDER,_.Fn.BITS))})})({...e,hash:t});return{...r(t),create:r}}({..._,Fp:S,lowS:!0,endo:I},i.sc)},75644:(e,t,r)=>{"use strict";r.d(t,{_:()=>o});var i=r(20218);r(76688);var n=r(25223),s={SIGN_TRANSACTION:"sol_signTransaction",SIGN_MESSAGE:"sol_signMessage",PARTIAL_SIGN_TRANSACTION:"sol_partialSignTransaction"},o=class extends i.YY.Internal{constructor(e){super(),this.solanaConfig=e,this.config={rpcUrl:e.rpcUrl,chainType:"SOLANA"}}name="solana";config={};signTransaction=(e,t)=>this.request({id:42,jsonrpc:"2.0",method:s.SIGN_TRANSACTION,params:{type:e instanceof n.Transaction?"legacy":0,seri
1400alized:e.serialize(t),serializeConfig:t}});signMessage=e=>this.request({id:42,jsonrpc:"2.0",method:s.SIGN_MESSAGE,params:{message:e}});partialSignTransaction=(e,t)=>this.request({id:42,jsonrpc:"2.0",method:s.PARTIAL_SIGN_TRANSACTION,params:{type:e instanceof n.Transaction?"legacy":0,serialized:e.serialize(t),serializeConfig:t}})}},76190:(e,t,r)=>{"use strict";r.d(t,{L:()=>i});let i={caipNetworkIdToNumber:e=>e?Number(e.split(":")[1]):void 0,parseEvmChainId(e){return"string"==typeof e?this.caipNetworkIdToNumber(e):e},getNetworksByNamespace:(e,t)=>e?.filter(e=>e.chainNamespace===t)||[],getFirstNetworkByNamespace(e,t){return this.getNetworksByNamespace(e,t)[0]}}},76688:(e,t,r)=>{"use strict";r.d(t,{$G:()=>c,C4:()=>M,C9:()=>g,E:()=>i,F8:()=>u,H$:()=>j,Hh:()=>o,Pk:()=>m,QN:()=>n,RQ:()=>B,V1:()=>N,aW:()=>D,eE:()=>l,fS:()=>s,jA:()=>w,jY:()=>_,kI:()=>P,pI:()=>R,p_:()=>x,rK:()=>h});var i=(e=>(e.MissingApiKey="MISSING_API_KEY",e.ModalNotReady="MODAL_NOT_READY",e.ConnectionLost="CONNECTION_WAS_LOST",e.MalformedResponse="MALFORMED_RESPONSE",e.InvalidArgument="INVALID_ARGUMENT",e.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",e.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",e))(i||{}),n=(e=>(e.SyncWeb3Method="SYNC_WEB3_METHOD",e.DuplicateIframe="DUPLICATE_IFRAME",e.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",e.DeprecationNotice="DEPRECATION_NOTICE",e.ProductAnnouncement="ANNOUNCEMENT",e))(n||{}),s=(e=>(e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",e[e.MagicLinkExpired=-10001]="MagicLinkExpired",e[e.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",e[e.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",e[e.UpdateEmailFailed=-10004]="UpdateEmailFailed",e[e.UserRequestEditEmail=-10005]="UserRequestEditEmail",e[e.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",e[e.InactiveRecipient=-10010]="InactiveRecipient",e[e.AccessDeniedToUser=-10011]="AccessDeniedToUser",e[e.UserRejectedAction=-10012]="UserRejectedAction",e[e.RequestCancelled=-10014]="RequestCancelled",e[e.RedirectLoginComplete=-10015]="RedirectLoginComplete",e[e.SessionTerminated=-10016]="SessionTerminated",e[e.PopupRequestOverriden=-10017]="PopupRequestOverriden",e[e.SanEmail=-10018]="SanEmail",e[e.DpopInvalidated=-10019]="DpopInvalidated",e[e.MaxAttemptsReached=-10031]="MaxAttemptsReached",e[e.UserRequiredMfa=-10033]="UserRequiredMfa",e))(s||{}),o=(e=>(e.PROVIDER="magic_3pw_provider",e.ADDRESS="magic_3pw_address",e.CHAIN_ID="magic_3pw_chainId",e))(o||{}),a=(e=>(e.WalletConnected="wallet_connected",e.WalletRejected="wallet_rejected",e.Web3ModalSelected="web3modal_selected",e))(a||{}),c=(e=>
1400(e.LoginWithSms="magic_auth_login_with_sms",e.LoginWithEmailOTP="magic_auth_login_with_email_otp",e.LoginWithMagicLink="magic_auth_login_with_magic_link",e.LoginWithCredential="magic_auth_login_with_credential",e.SetAuthorizationToken="magic_auth_set_authorization_token",e.GetIdToken="magic_auth_get_id_token",e.GenerateIdToken="magic_auth_generate_id_token",e.GetMetadata="magic_auth_get_metadata",e.IsLoggedIn="magic_is_logged_in",e.Logout="magic_auth_logout",e.UpdateEmail="magic_auth_update_email",e.UserSettings="magic_auth_settings",e.UserSettingsTestMode="magic_auth_settings_testing_mode",e.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",e.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",e.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",e.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",e.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",e.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",e.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",e.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",e.LogoutTestMode="magic_auth_logout_testing_mode",e.UpdateEmailTestMode="magic_auth_update_email_testing_mode",e.IntermediaryEvent="magic_intermediary_event",e.RequestAccounts="eth_requestAccounts",e.GetInfo="magic_get_info",e.ShowUI="magic_wallet",e.NFTPurchase="magic_nft_purchase",e.NFTCheckout="magic_nft_checkout",e.NFTTransfer="magic_nft_transfer",e.RequestUserInfoWithUI="mc_request_user_info",e.Disconnect="mc_disconnect",e.RecoverAccount="magic_auth_recover_account",e.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",e.MagicBoxHeartBeat="magic_box_heart_beat",e.AutoConnect="mc_auto_connect",e.Login="mc_login",e.EncryptV1="magic_auth_encrypt_v1",e.DecryptV1="magic_auth_decrypt_v1",e.ShowNFTs="magic_show_nfts",e.ShowOnRamp="magic_show_fiat_onramp",e.ShowSendTokensUI="magic_show_send_tokens_ui",e.ShowAddress="magic_show_address",e.ShowBalances="magic_show_balances",e.RevealPK="magic_reveal_key",e.EnableMFA="magic_auth_enable_mfa_flow",e.DisableMFA="magic_auth_disable_mfa_flow",e.GetMultichainPublicAddress="magic_get_multichain_public_address",e.Sign7702Authorization="magic_wallet_sign_7702_authorization",e.Send7702Transaction="eth_send7702Transaction",e))(c||{}),l=["magic_intermediary_event","magic_nft_checkout","mc_login"],h=(e=>(e.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",e.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",e.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",e.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",e.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",e.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",e.MAGIC_SEND_PRODUCT_ANNOUNCEMENT="MAGIC_SEND_PRODUCT_ANNOUNCEMENT",e.MAGIC_PONG="MAGIC_PONG",e.MAGIC_POPUP_RESPONSE="MAGIC_POPUP_RESPONSE",e.MAGIC_POPUP_OAUTH_VERIFY_RESPONSE="MAGIC_POPUP_OAUTH_VERIFY_RESPONSE",e.MAGIC_THIRD_PARTY_WALLET_REQUEST="MAGIC_THIRD_PARTY_WALLET_REQUEST",e.MAGIC_OPEN_MOBILE_URL="MAGIC_OPEN_MOBILE_URL",e))(h||{}),u=(e=>(e.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",e.MAGIC_THIRD_PARTY_WALLET_RESPONSE="MAGIC_THIRD_PARTY_WALLET_RESPONSE",e.MAGIC_THIRD_PARTY_WALLET_UPDATE="MAGIC_THIRD_PARTY_WALLET_EVENT",e.MAGIC_PING="MAGIC_PING",e))(u||{}),d=(e=>(e.UpdateEmail="update-email",e.MFA="mfa",e.Recovery="recovery",e))(d||{}),f=(e=>(e.Retry="retry",e))(f||{}),p=(e=>(e.EmailSent="email-sent",e.EmailNotDeliverable="email-not-deliverable",e))(p||{}),g=(e=>(e.VerifyEmailOtp="verify-email-otp",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e.Cancel="cancel",e))(g||{}),m=(e=>(e.VerifySmsOtp="verify-sms-otp",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e.Cancel="cancel",e.Retry="retry",e))(m||{}),y=(e=>(e.SmsOTPSent="sms-otp-sent",e.InvalidSmsOtp="invalid-sms-otp",e.ExpiredSmsOtp="expired-sms-otp",e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.LoginThrottled="login-throttled",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(y||{}),b=(e=>(e.EmailOTPSent="email-otp-sent",e.InvalidEmailOtp="invalid-email-otp",e.InvalidMfaOtp="invalid-mfa-otp",e.ExpiredEmailOtp="expired-email-otp",e.MfaSentHandle="mfa-sent-handle",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e.LoginThrottled="login-throttled",e.MaxAttemptsReached="max-attempts-reached",e))(b||{}),w=(e=>(e.Retry="device-retry",e))(w||{}),v=(e=>(e.DeviceApproved="device-approved",e.DeviceNeedsApproval="device-needs-approval",e.DeviceVerificationLinkExpired="device-verification-link-expired",e.DeviceVerificationEmailSent="device-verification-email-sent",e))(v||{}),x=(e=>
1400(e.Retry="Recency/auth-factor-retry",e.Cancel="Recency/auth-factor-verification-cancel",e.VerifyEmailOtp="Recency/auth-factor-verify-email-otp",e.VerifyMFACode="Recency/verify-mfa-code",e))(x||{}),E=(e=>(e.PrimaryAuthFactorNeedsVerification="Recency/auth-factor-needs-verification",e.PrimaryAuthFactorVerified="Recency/auth-factor-verified",e.InvalidEmailOtp="Recency/auth-factor-invalid-email-otp",e.EmailExpired="Recency/auth-factor-verification-email-expired",e.EmailSent="Recency/auth-factor-verification-email-sent",e.EmailNotDeliverable="Recency/auth-factor-verification-email-not-deliverable",e))(E||{}),_=(e=>(e.RetryWithNewEmail="UpdateEmail/retry-with-new-email",e.Cancel="UpdateEmail/new-email-verification-cancel",e.VerifyEmailOtp="UpdateEmail/new-email-verify-otp",e))(_||{}),I=(e=>(e.NewAuthFactorNeedsVerification="UpdateEmail/new-email-needs-verification",e.EmailUpdated="UpdateEmail/email-updated",e.InvalidEmailOtp="UpdateEmail/new-email-invalid-email-otp",e.EmailExpired="UpdateEmail/new-email-verification-email-expired",e.EmailSent="UpdateEmail/new-email-verification-email-sent",e.EmailNotDeliverable="UpdateEmail/new-email-verification-email-not-deliverable",e.InvalidEmail="UpdateEmail/new-email-invalid",e.EmailAlreadyExists="UpdateEmail/new-email-already-exists",e))(I||{}),A=(e=>(e.IDTokenCreated="Auth/id-token-created",e))(A||{}),S=(e=>(e.Cancel="Farcaster/cancel",e))(S||{}),C=(e=>(e.MFASecretGenerated="mfa-secret-generated",e.InvalidMFAOtp="invalid-mfa-otp",e.MFARecoveryCodes="mfa-recovery-codes",e))(C||{}),N=(e=>(e.VerifyMFACode="verify-mfa-code",e.Cancel="cancel-mfa-setup",e))(N||{}),O=(e=>(e.MFACodeRequested="mfa-code-requested",e.InvalidMFAOtp="invalid-mfa-otp",e.InvalidRecoveryCode="invalid-recovery-code",e))(O||{}),P=(e=>(e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.Cancel="cancel-mfa-disable",e))(P||{}),T=(e=>(e.Harmony="HARMONY",e))(T||{}),M=(e=>(e.ClosedByUser="closed-by-user",e))(M||{}),R=(e=>(e.ClosedByUser="closed-by-user-on-received",e))(R||{}),k=(e=>(e.EnterNewPhoneNumber="enter-new-phone-number",e.EnterOtpCode="enter-otp-code",e.RecoveryFactorAlreadyExists="recovery-factor-already-exists",e.MalformedPhoneNumber="malformed-phone-number",e.InvalidOtpCode="invalid-otp-code",e.RecoveryFactorUpdated="recovery-factor-updated",e.RecoveryFactorDeleted="recovery-factor-deleted",e))(k||{}),D=(e=>(e.SendNewPhoneNumber="send-new-phone-number",e.SendOtpCode="send-otp-code",e.Cancel="cancel",e.StartEditPhoneNumber="start-edit-phone-number",e))(D||{}),L=(e=>(e.PhoneNumber="phone_number",e))(L||{}),U=(e=>(e.SmsOtpSent="sms-otp-sent",e.LoginThrottled="login-throttled",e.InvalidSmsOtp="invalid-sms-otp",e.SmsVerified="sms-verified",e.AccountRecovered="account-recovered",e.UpdateEmailRequired="update-email-required",e))(U||{}),B=(e=>(e.Cancel="cancel",e.VerifyOtp="verify-otp-code",e.ResendSms="resend-sms-otp",e.UpdateEmail="update-email",e))(B||{}),j=(e=>(e.Success="nft-checkout-success",e.Failure="nft-checkout-failure",e.Initiated="nft-checkout-initiated",e.Disconnect="disconnect",e))(j||{}),$=(e=>(e.WalletInfoFetched="Wallet/wallet-info-fetched",e))($||{}),z=(e=>(e.CloseMagicWindow="close-magic-window",e))(z||{}),q=(e=>(e.Cancel="cancel",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e))(q||{}),H=(e=>(e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(H||{}),F=(e=>(e.PopupUrl="popup-url",e))(F||{}),W=(e=>(e.PopupEvent="popup-event",e))(W||{}),V=(e=>(e.Cancel="cancel",e.VerifyMFACode="verify-mfa-code",e.LostDevice="lost-device",e.VerifyRecoveryCode="verify-recovery-code",e))(V||{}),K=(e=>(e.MfaSentHandle="mfa-sent-handle",e.InvalidMfaOtp="invalid-mfa-otp",e.RecoveryCodeSentHandle="recovery-code-sent-handle",e.InvalidRecoveryCode="invalid-recovery-code",e.RecoveryCodeSuccess="recovery-code-success",e))(K||{})},77946:(e,t,r)=>{"use strict";function i(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function n(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function s(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");i(e.outputLen),i(e.blockLen)}function o(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function a(e,t){n(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}r.d(t,{CC:()=>o,DO:()=>n,Fe:()=>i,Ht:()=>a,sd:()=>s})},78239:(e,t,r)=>{"use strict";var i=r(98392),n=r(3285),s=r(95119);t.assert=n,t.toArray=s.toArray,t.zero2=s.zero2,t.toHex=s.toHex,t.encode=s.encode,t.getNAF=function(e,t,r){var i=Array(Math.max(e.bitLength(),r)+1);for(o=0;o<i.length;o+=1)i[o]=0;var n=1<<t+1,s=e.clone();for(o=0;o<i.length;o++){var o,a,c=s.andln(n-1);s.isOdd()?(a=c>(n>>1)-1?(n>>1)-c:c,s.isubn(a)):a=0,i[o]=a,s.iushrn(1)}return i},t.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var i=0,n=0;e.cmpn(-i)>0||t.cmpn(-n)>0;){var s,o,a,c=e.andln(3)+i&3,l=t.andln(3)+n&3;3===c&&(c=-1),3===l&&(l=-1),o=(1&c)==0?0:(3==(s=e.andln(7)+i&7)||5===s)&&2===l?-c:c,r[0].push(o),a=(1&l)==0?0:(3==(s=t.andln(7)+n&7)||5===s)&&2===c?-l:l,r[1].push(a),2*i===o+1&&(i=1-i),2*n===a+1&&(n=1-n),e.iushrn(1),t.iushrn(1)}return r},t.cachedProperty=function(e,t,r){var i="_"+t;e.prototype[t]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new i(e,"hex","le")}},78710:(e,t,r)=>{"use strict";r.d(t,{B4:()=>f,CQ:()=>v,CW:()=>w,Ei:()=>u,F8:()=>x,P5:()=>d,TH:()=>E,Vl:()=>y,Vr:()=>b,WM:()=>p,WQ:()=>m,im:()=>g,jm:()=>a,lD:()=>s,qh:()=>h,rE:()=>c,ry:()=>l,xn:()=>o});let i=BigInt(0x100000000-1),n=BigInt(32);function s(e,t=!1){let r=e.length,o=new Uint32Array(r),a=new Uint32Array(r);for(let s=0;s<r;s++){let{h:r,l:c}=function(e,t=!1){return t?{h:Number(e&i),l:Number(e>>n&i)}:{h:0|Number(e>>n&i),l:0|Number(e&i)}}(e[s],t);[o[s],a[s]]=[r,c]}return[o,a]}let o=(e,t,r)=>e>>>r,a=(e,t,r)=>e<<32-r|t>>>r,c=(e,t,r)=>e>>>r|t<<32-r,l=(e,t,r)=>e<<32-r|t>>>r,h=(e,t,r)=>e<<64-r|t>>>r-32,u=(e,t,r)=>e>>>r-32|t<<64-r,d=(e,t,r)=>e<<r|t>>>32-r,f=(e,t,r)=>t<<r|e>>>32-r,p=(e,t,r)=>t<<r-32|e>>>64-r,g=(e,t,r)=>e<<r-32|t>>>64-r;
1400function m(e,t,r,i){let n=(t>>>0)+(i>>>0);return{h:e+r+(n/0x100000000|0)|0,l:0|n}}let y=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),b=(e,t,r,i)=>t+r+i+(e/0x100000000|0)|0,w=(e,t,r,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0),v=(e,t,r,i,n)=>t+r+i+n+(e/0x100000000|0)|0,x=(e,t,r,i,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0)+(n>>>0),E=(e,t,r,i,n,s)=>t+r+i+n+s+(e/0x100000000|0)|0},79355:(e,t,r)=>{"use strict";r.d(t,{y:()=>n});var i=r(8567);let n={getCaipTokens(e){if(!e)return;let t={};return Object.entries(e).forEach(([e,r])=>{t[`${i.o.EIP155}:${e}`]=r}),t},isLowerCaseMatch:(e,t)=>e?.toLowerCase()===t?.toLowerCase()}},80361:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=5*t.ONE_MINUTE,t.TEN_MINUTES=10*t.ONE_MINUTE,t.THIRTY_MINUTES=30*t.ONE_MINUTE,t.SIXTY_MINUTES=60*t.ONE_MINUTE,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=3*t.ONE_HOUR,t.SIX_HOURS=6*t.ONE_HOUR,t.TWELVE_HOURS=12*t.ONE_HOUR,t.TWENTY_FOUR_HOURS=24*t.ONE_HOUR,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=3*t.ONE_DAY,t.FIVE_DAYS=5*t.ONE_DAY,t.SEVEN_DAYS=7*t.ONE_DAY,t.THIRTY_DAYS=30*t.ONE_DAY,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=2*t.ONE_WEEK,t.THREE_WEEKS=3*t.ONE_WEEK,t.FOUR_WEEKS=4*t.ONE_WEEK,t.ONE_YEAR=365*t.ONE_DAY},81010:(e,t,r)=>{let i=r(24967),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],s=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];t.getBlocksCount=function(e,t){switch(t){case i.L:return n[(e-1)*4+0];case i.M:return n[(e-1)*4+1];case i.Q:return n[(e-1)*4+2];case i.H:return n[(e-1)*4+3];default:return}},t.getTotalCodewordsCount=function(e,t){switch(t){case i.L:return s[(e-1)*4+0];case i.M:return s[(e-1)*4+1];case i.Q:return s[(e-1)*4+2];case i.H:return s[(e-1)*4+3];default:return}}},81055:(e,t,r)=>{"use strict";e.exports=function(e){return!function(t){var r=e.lib,i=r.WordArray,n=r.Hasher,s=e.x64.Word,o=e.algo,a=[],c=[],l=[];!function(){for(var e=1,t=0,r=0;r<24;r++){a[e+5*t]=(r+1)*(r+2)/2%64;var i=t%5,n=(2*e+3*t)%5;e=i,t=n}for(var e=0;e<5;e++)for(var t=0;t<5;t++)c[e+5*t]=t+(2*e+3*t)%5*5;for(var o=1,h=0;h<24;h++){for(var u=0,d=0,f=0;f<7;f++){if(1&o){var p=(1<<f)-1;p<32?d^=1<<p:u^=1<<p-32}128&o?o=o<<1^113:o<<=1}l[h]=s.create(u,d)}}();for(var h=[],u=0;u<25;u++)h[u]=s.create();var d=o.SHA3=n.extend({cfg:n.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,i=this.blockSize/2,n=0;n<i;n++){var s=e[t+2*n],o=e[t+2*n+1];s=(s<<8|s>>>24)&0xff00ff|(s<<24|s>>>8)&0xff00ff00,o=(o<<8|o>>>24)&0xff00ff|(o<<24|o>>>8)&0xff00ff00;var u=r[n];u.high^=o,u.low^=s}for(var d=0;d<24;d++){for(var f=0;f<5;f++){for(var p=0,g=0,m=0;m<5;m++){var u=r[f+5*m];p^=u.high,g^=u.low}var y=h[f];y.high=p,y.low=g}for(var f=0;f<5;f++)for(var b=h[(f+4)%5],w=h[(f+1)%5],v=w.high,x=w.low,p=b.high^(v<<1|x>>>31),g=b.low^(x<<1|v>>>31),m=0;m<5;m++){var u=r[f+5*m];u.high^=p,u.low^=g}for(var E=1;E<25;E++){var p,g,u=r[E],_=u.high,I=u.low,A=a[E];A<32?(p=_<<A|I>>>32-A,g=I<<A|_>>>32-A):(p=I<<A-32|_>>>64-A,g=_<<A-32|I>>>64-A);var S=h[c[E]];S.high=p,S.low=g}var C=h[0],N=r[0];C.high=N.high,C.low=N.low;for(var f=0;f<5;f++)for(var m=0;m<5;m++){var E=f+5*m,u=r[E],O=h[E],P=h[(f+1)%5+5*m],T=h[(f+2)%5+5*m];u.high=O.high^~P.high&T.high,u.low=O.low^~P.low&T.low}var u=r[0],M=l[d];u.high^=M.high,u.low^=M.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var n=8*e.sigBytes,s=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(t.ceil((n+1)/s)*s>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var o=this._state,a=this.cfg.outputLength/8,c=a/8,l=[],h=0;h<c;h++){var u=o[h],d=u.high,f=u.low;d=(d<<8|d>>>
vendor: 5,471 bytes, line 1400
140024)&0xff00ff|(d<<24|d>>>8)&0xff00ff00,f=(f<<8|f>>>24)&0xff00ff|(f<<24|f>>>8)&0xff00ff00,l.push(f),l.push(d)}return new i.init(l,a)},clone:function(){for(var e=n.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});e.SHA3=n._createHelper(d),e.HmacSHA3=n._createHmacHelper(d)}(Math),e.SHA3}(r(16611),r(38530))},81290:(e,t,r)=>{"use strict";r.d(t,{KC:()=>S,KJ:()=>y,L5:()=>C,NW:()=>A,PV:()=>I,YO:()=>g,Yj:()=>_,ai:()=>v,au:()=>N,bz:()=>p,eu:()=>b,g1:()=>E,lq:()=>x,me:()=>w,vA:()=>h,vt:()=>u,zM:()=>m});class i extends TypeError{constructor(e,t){let r,{message:i,explanation:n,...s}=e,{path:o}=e,a=0===o.length?i:`At path: ${o.join(".")} -- ${i}`;super(n??a),null!=n&&(this.cause=a),Object.assign(this,s),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...t()])}}function n(e){return"object"==typeof e&&null!=e}function s(e){return n(e)&&!Array.isArray(e)}function o(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function*a(e,t,r,i){var s;for(let a of(n(s=e)&&"function"==typeof s[Symbol.iterator]||(e=[e]),e)){let e=function(e,t,r,i){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});let{path:n,branch:s}=t,{type:a}=r,{refinement:c,message:l=`Expected a value of type \`${a}\`${c?` with refinement \`${c}\``:""}, but received: \`${o(i)}\``}=e;return{value:i,type:a,refinement:c,key:n[n.length-1],path:n,branch:s,...e,message:l}}(a,t,r,i);e&&(yield e)}}function*c(e,t,r={}){let{path:i=[],branch:s=[e],coerce:o=!1,mask:a=!1}=r,l={path:i,branch:s,mask:a};o&&(e=t.coercer(e,l));let h="valid";for(let i of t.validator(e,l))i.explanation=r.message,h="not_valid",yield[i,void 0];for(let[u,d,f]of t.entries(e,l))for(let t of c(d,f,{path:void 0===u?i:[...i,u],branch:void 0===u?s:[...s,d],coerce:o,mask:a,message:r.message}))t[0]?(h=null!=t[0].refinement?"not_refined":"not_valid",yield[t[0],void 0]):o&&(d=t[1],void 0===u?e=d:e instanceof Map?e.set(u,d):e instanceof Set?e.add(d):n(e)&&(void 0!==d||u in e)&&(e[u]=d));if("not_valid"!==h)for(let i of t.refiner(e,l))i.explanation=r.message,h="not_refined",yield[i,void 0];"valid"===h&&(yield[void 0,e])}class l{constructor(e){let{type:t,schema:r,validator:i,refiner:n,coercer:s=e=>e,entries:o=function*(){}}=e;this.type=t,this.schema=r,this.entries=o,this.coercer=s,i?this.validator=(e,t)=>a(i(e,t),t,this,e):this.validator=()=>[],n?this.refiner=(e,t)=>a(n(e,t),t,this,e):this.refiner=()=>[]}assert(e,t){return h(e,this,t)}create(e,t){return u(e,this,t)}is(e){var t,r;return t=e,r=this,!d(t,r)[0]}mask(e,t){var r=e,i=this,n=t;let s=d(r,i,{coerce:!0,mask:!0,message:n});if(!s[0])return s[1];throw s[0]}validate(e,t={}){return d(e,this,t)}}function h(e,t,r){let i=d(e,t,{message:r});if(i[0])throw i[0]}function u(e,t,r){let i=d(e,t,{coerce:!0,message:r});if(!i[0])return i[1];throw i[0]}function d(e,t,r={}){let n=c(e,t,r),s=function(e){let{done:t,value:r}=e.next();return t?void 0:r}(n);return s[0]?[new i(s[0],function*(){for(let e of n)e[0]&&(yield e[0])}),void 0]:[void 0,s[1]]}function f(e,t){return new l({type:e,schema:null,validator:t})}function p(){return f("any",()=>!0)}function g(e){return new l({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(let[r,i]of t.entries())yield[r,i,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${o(e)}`})}function m(){return f("boolean",e=>"boolean"==typeof e)}function y(e){return f("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${o(t)}`)}function b(e){let t=o(e),r=typeof e;return new l({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?e:null,validator:r=>r===e||`Expected the literal \`${t}\`, but received: ${o(r)}`})}function w(e){return new l({...e,validator:(t,r)=>null===t||e.validator(t,r),refiner:(t,r)=>null===t||e.refiner(t,r)})}function v(){return f("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${o(e)}`)}function x(e){return new l({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function E(e,t){return new l({type:"record",schema:null,*entries(r){if(n(r))for(let i in r){let n=r[i];yield[i,i,e],yield[i,n,t]}},validator:e=>s(e)||`Expected an object, but received: ${o(e)}`,coercer:e=>s(e)?{...e}:e})}function _(){return f("string",e=>"string"==typeof e||`Expected a string, but received: ${o(e)}`)}function I(e){let t=f("never",()=>!1);return new l({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){let i=Math.max(e.length,r.length);for(let n=0;n<i;n++)yield[n,r[n],e[n]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${o(e)}`,coercer:e=>Array.isArray(e)?e.slice():e})}function A(e){let t=Object.keys(e);return new l({type:"type",schema:e,*entries(r){if(n(r))for(let i of t)yield[i,r[i],e[i]]},validator:e=>s(e)||`Expected an object, but received: ${o(e)}`,coercer:e=>s(e)?{...e}:e})}function S(e){let t=e.map(e=>e.type).join(" | ");return new l({type:"union",schema:null,coercer(t,r){for(let i of e){let[e,n]=i.validate(t,{coerce:!0,mask:r.mask});if(!e)return n}return t},validator(r,i){let n=[];for(let t of e){let[...e]=c(r,t,i),[s]=e;if(!s[0])return[];for(let[t]of e)t&&n.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${o(r)}`,...n]}})}function C(){return f("unknown",()=>!0)}function N(e,t,r){return new l({...e,coercer:(i,n)=>d(i,t)[0]?e.coercer(i,n):e.coercer(r(i,n),n)})}},81452:(e,t)=>
1400{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_THOUSAND=t.ONE_HUNDRED=void 0,t.ONE_HUNDRED=100,t.ONE_THOUSAND=1e3},81480:(e,t,r)=>{"use strict";function i(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function n(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function s(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");i(e.outputLen),i(e.blockLen)}function o(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function a(e,t){n(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}r.d(t,{CC:()=>o,DO:()=>n,Fe:()=>i,Ht:()=>a,sd:()=>s})},81530:(e,t,r)=>{"use strict";e.exports=function(e){return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function r(e){if((e>>24&255)==255){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0+(t<<16)+(r<<8)+i}else e+=0x1000000;return e}var i=t.Encryptor=t.extend({processBlock:function(e,t){var i,n=this._cipher,s=n.blockSize,o=this._iv,a=this._counter;o&&(a=this._counter=o.slice(0),this._iv=void 0),0===((i=a)[0]=r(i[0]))&&(i[1]=r(i[1]));var c=a.slice(0);n.encryptBlock(c,0);for(var l=0;l<s;l++)e[t+l]^=c[l]}});return t.Decryptor=i,t}(),e.mode.CTRGladman}(r(16611),r(99229))},81701:(e,t,r)=>{"use strict";r.d(t,{W:()=>m});var i=r(70524),n=r(98866),s=r(12319),o=r(58051),a=r(72880),c=r(67695),l=r(88097),h=r(66254),u=r(70417),d=r(55480),f=r(6578),p=r(67869);let g=(0,i.BX)({loading:!1,loadingNamespaceMap:new Map,open:!1,shake:!1,namespace:void 0}),m={state:g,subscribe:e=>(0,i.B1)(g,()=>e(g)),subscribeKey:(e,t)=>(0,n.u$)(g,e,t),async open(e){let t="connected"===o.U.state.status;l.x.state.wcBasic?a.N.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1}):await a.N.prefetch({fetchConnectorImages:!t,fetchFeaturedWallets:!t,fetchRecommendedWallets:!t}),e?.namespace?(await c.W.switchActiveNamespace(e.namespace),m.setLoading(!0,e.namespace)):m.setLoading(!0),h.a.setFilterByNamespace(e?.namespace);let r=c.W.getAccountData(e?.namespace)?.caipAddress;c.W.state.noAdapters&&!r?s.w.isMobile()?p.I.reset("AllWallets"):p.I.reset("ConnectingWalletConnectBasic"):e?.view?p.I.reset(e.view):r?p.I.reset("Account"):p.I.reset("Connect"),g.open=!0,f.z.set({open:!0}),u.E.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:!!r}})},close(){let e=d.H.state.enableEmbedded,t=!!c.W.state.activeCaipAddress;g.open&&u.E.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:t}}),g.open=!1,m.clearLoading(),e?t?p.I.replace("Account"):p.I.push("Connect"):f.z.set({open:!1}),l.x.resetUri()},setLoading(e,t){t&&g.loadingNamespaceMap.set(t,e),g.loading=e,f.z.set({loading:e})},clearLoading(){g.loadingNamespaceMap.clear(),g.loading=!1},shake(){g.shake||(g.shake=!0,setTimeout(()=>{g.shake=!1},500))}}},81803:(e,t)=>{"use strict";function r(e,t,r){return t<=e&&e<=r}function i(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function n(e){this.tokens=[].slice.call(e)}function s(e,t){if(e)throw TypeError("Decoder error");return t||65533}n.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(e){if(Array.isArray(e))for(;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(e)},push:function(e){if(Array.isArray(e))for(;e.length;)this.tokens.push(e.shift());else this.tokens.push(e)}};var o="utf-8";function a(e,t){if(!(this instanceof a))return new a(e,t);
vendor: 4,559 bytes, line 1400
1400if((e=void 0!==e?String(e).toLowerCase():o)!==o)throw Error("Encoding not supported. Only utf-8 is supported");t=i(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function c(e,t){if(!(this instanceof c))return new c(e,t);if((e=void 0!==e?String(e).toLowerCase():o)!==o)throw Error("Encoding not supported. Only utf-8 is supported");t=i(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}function l(e){var t=e.fatal,i=0,n=0,o=0,a=128,c=191;this.handler=function(e,l){if(-1===l&&0!==o)return o=0,s(t);if(-1===l)return -1;if(0===o){if(r(l,0,127))return l;if(r(l,194,223))o=1,i=l-192;else if(r(l,224,239))224===l&&(a=160),237===l&&(c=159),o=2,i=l-224;else{if(!r(l,240,244))return s(t);240===l&&(a=144),244===l&&(c=143),o=3,i=l-240}return i<<=6*o,null}if(!r(l,a,c))return i=o=n=0,a=128,c=191,e.prepend(l),s(t);if(a=128,c=191,n+=1,i+=l-128<<6*(o-n),n!==o)return null;var h=i;return i=o=n=0,h}}function h(e){e.fatal,this.handler=function(e,t){if(-1===t)return -1;if(r(t,0,127))return t;r(t,128,2047)?(i=1,n=192):r(t,2048,65535)?(i=2,n=224):r(t,65536,1114111)&&(i=3,n=240);for(var i,n,s=[(t>>6*i)+n];i>0;){var o=t>>6*(i-1);s.push(128|63&o),i-=1}return s}}a.prototype={decode:function(e,t){r="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=i(t),this._streaming||(this._decoder=new l({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.stream;for(var r,s,o=new n(r),a=[];!o.endOfStream()&&-1!==(s=this._decoder.handler(o,o.read()));)null!==s&&(Array.isArray(s)?a.push.apply(a,s):a.push(s));if(!this._streaming){do{if(-1===(s=this._decoder.handler(o,o.read())))break;if(null===s)continue;Array.isArray(s)?a.push.apply(a,s):a.push(s)}while(!o.endOfStream());this._decoder=null}!a.length||-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===a[0]?(this._BOMseen=!0,a.shift()):this._BOMseen=!0);for(var c="",h=0;h<a.length;++h){var u=a[h];u<=65535?c+=String.fromCharCode(u):(u-=65536,c+=String.fromCharCode((u>>10)+55296,(1023&u)+56320))}return c}},c.prototype={encode:function(e,t){e=e?String(e):"",t=i(t),this._streaming||(this._encoder=new h(this._options)),this._streaming=!!t.stream;for(var r,s=[],o=new n(function(e){for(var t=String(e),r=t.length,i=0,n=[];i<r;){var s=t.charCodeAt(i);if(s<55296||s>57343)n.push(s);else if(56320<=s&&s<=57343)n.push(65533);else if(55296<=s&&s<=56319)if(i===r-1)n.push(65533);else{var o=e.charCodeAt(i+1);if(56320<=o&&o<=57343){var a=1023&s,c=1023&o;n.push(65536+(a<<10)+c),i+=1}else n.push(65533)}i+=1}return n}(e));!o.endOfStream()&&-1!==(r=this._encoder.handler(o,o.read()));)Array.isArray(r)?s.push.apply(s,r):s.push(r);if(!this._streaming){for(;-1!==(r=this._encoder.handler(o,o.read()));)Array.isArray(r)?s.push.apply(s,r):s.push(r);this._encoder=null}return new Uint8Array(s)}},t.TextEncoder=c,t.TextDecoder=a},82544:(e,t,r)=>{"use strict";e.exports=function(e){return!function(t){var r=e.lib,i=r.WordArray,n=r.Hasher,s=e.algo,o=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),a=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),h=i.create([0,0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xa953fd4e]),u=i.create([0x50a28be6,0x5c4dd124,0x6d703ef3,0x7a6d76e9,0]),d=s.RIPEMD160=n.extend({_doReset:function(){this._hash=i.create([0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0])},_doProcessBlock:function(e,t){for(var r,i,n,s,d,p,g,m,y,b,w,v,x,E,_,I,A,S,C,N=0;N<16;N++){var O=t+N,P=e[O];e[O]=(P<<8|P>>>
140024)&0xff00ff|(P<<24|P>>>8)&0xff00ff00}var T=this._hash.words,M=h.words,R=u.words,k=o.words,D=a.words,L=c.words,U=l.words;E=y=T[0],_=b=T[1],I=w=T[2],A=v=T[3],S=x=T[4];for(var N=0;N<80;N+=1){C=y+e[t+k[N]]|0,N<16?C+=(b^w^v)+M[0]:N<32?C+=((r=b)&w|~r&v)+M[1]:N<48?C+=((b|~w)^v)+M[2]:N<64?C+=(i=b,n=w,(i&(s=v)|n&~s)+M[3]):C+=(b^(w|~v))+M[4],C|=0,C=(C=f(C,L[N]))+x|0,y=x,x=v,v=f(w,10),w=b,b=C,C=E+e[t+D[N]]|0,N<16?C+=(_^(I|~A))+R[0]:N<32?C+=(d=_,p=I,(d&(g=A)|p&~g)+R[1]):N<48?C+=((_|~I)^A)+R[2]:N<64?C+=((m=_)&I|~m&A)+R[3]:C+=(_^I^A)+R[4],C|=0,C=(C=f(C,U[N]))+S|0,E=S,S=A,A=f(I,10),I=_,_=C}C=T[1]+w+A|0,T[1]=T[2]+v+S|0,T[2]=T[3]+x+E|0,T[3]=T[4]+y+_|0,T[4]=T[0]+b+I|0,T[0]=C},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[(i+64>>>9<<4)+14]=(r<<8|r>>>24)&0xff00ff|(r<<24|r>>>8)&0xff00ff00,e.sigBytes=(t.length+1)*4,this._process();for(var n=this._hash,s=n.words,o=0;o<5;o++){var a=s[o];s[o]=(a<<8|a>>>24)&0xff00ff|(a<<24|a>>>8)&0xff00ff00}return n},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});function f(e,t){return e<<t|e>>>32-t}e.RIPEMD160=n._createHelper(d),e.HmacRIPEMD160=n._createHmacHelper(d)}(Math),e.RIPEMD160}(r(16611))},82910:(e,t,r)=>{"use strict";r.d(t,{EK:()=>o,FX:()=>a,sy:()=>s,x5:()=>n});var i=r(25223);let n=new i.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),s=new i.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),o=new i.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"),a=new i.PublicKey("So11111111111111111111111111111111111111112");new i.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP")},82965:(e,t,r)=>{"use strict";var i=r(98392),n=r(17891),s=r(78239),o=r(13798),a=r(66725),c=s.assert,l=r(87094),h=r(70083);function u(e){if(!(this instanceof u))return new u(e);"string"==typeof e&&(c(Object.prototype.hasOwnProperty.call(o,e),"Unknown curve "+e),e=o[e]),e instanceof o.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=u,u.prototype.keyPair=function(e){return new l(this,e)},u.prototype.keyFromPrivate=function(e,t){return l.fromPrivate(this,e,t)},u.prototype.keyFromPublic=function(e,t){return l.fromPublic(this,e,t)},u.prototype.genKeyPair=function(e){e||(e={});for(var t=new n({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),s=this.n.sub(new i(2));;){var o=new i(t.generate(r));if(!(o.cmp(s)>0))return o.iaddn(1),this.keyFromPrivate(o)}},u.prototype._truncateToN=function(e,t,r){if(i.isBN(e)||"number"==typeof e)n=(e=new i(e,16)).byteLength();else if("object"==typeof e)n=e.length,e=new i(e,16);else{var n,s=e.toString();n=s.length+1>>>1,e=new i(s,16)}"number"!=typeof r&&(r=8*n);var o=r-this.n.bitLength();return(o>0&&(e=e.ushrn(o)),!t&&e.cmp(this.n)>=0)?e.sub(this.n):e},u.prototype.sign=function(e,t,r,s){if("object"==typeof r&&(s=r,r=null),s||(s={}),"string"!=typeof e&&"number"!=typeof e&&!i.isBN(e)){c("object"==typeof e&&e&&"number"==typeof e.length,"Expected message to be an array-like, a hex string, or a BN instance"),c(e.length>>>0===e.length);for(var o=0;o<e.length;o++)c((255&e[o])===e[o])}t=this.keyFromPrivate(t,r),c(!(e=this._truncateToN(e,!1,s.msgBitLength)).isNeg(),"Can not sign a negative message");var a=this.n.byteLength(),l=t.getPrivate().toArray("be",a),u=e.toArray("be",a);c(new i(u).eq(e),"Can not sign message");for(var d=new n({hash:this.hash,entropy:l,nonce:u,pers:s.pers,persEnc:s.persEnc||"utf8"}),f=this.n.sub(new i(1)),p=0;;p++){var g=s.k?s.k(p):new i(d.generate(this.n.byteLength()));if(0>=(g=this._truncateToN(g,!0)).cmpn(1)||g.cmp(f)>=0)continue;var m=this.g.mul(g);if(!m.isInfinity()){var y=m.getX(),b=y.umod(this.n);if(0!==b.cmpn(0)){var w=g.invm(this.n).mul(b.mul(t.getPrivate()).iadd(e));if(0!==(w=w.umod(this.n)).cmpn(0)){var v=!!m.getY().isOdd()|2*(0!==y.cmp(b));return s.canonical&&w.cmp(this.nh)>0&&(w=this.n.sub(w),v^=1),new h({r:b,s:w,recoveryParam:v})}}}}},u.prototype.verify=function(e,t,r,i,n){n||(n={}),e=this._truncateToN(e,!1,n.msgBitLength),r=this.keyFromPublic(r,i);var s,o=(t=new h(t,"hex")).r,a=t.s;if(0>o.cmpn(1)||o.cmp(this.n)>=0||0>a.cmpn(1)||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),l=c.mul(e).umod(this.n),u=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(l,r.getPublic(),u)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(l,r.getPublic(),u)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},u.prototype.recoverPubKey=function(e,t,r,n){c((3&r)===r,"The recovery param is more than two bits"),t=new h(t,n);var s=this.n,o=new i(e),a=t.r,l=t.s,u=1&r,d=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw Error("Unable to find sencond key candinate");a=d?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var f=t.r.invm(s),p=s.sub(o).mul(f).umod(s),g=l.mul(f).umod(s);return this.g.mulAdd(p,a,g)},u.prototype.getKeyRecoveryParam=function(e,t,r,i){if(null!==(t=new h(t,i)).recoveryParam)return t.recoveryParam;for(var n,s=0;s<4;s++){try{n=this.recoverPubKey(e,t,s)}catch(e){continue}if(n.eq(r))return s}throw Error("Unable to find valid recovery factor")}},83138:(e,t,r)=>{"use strict";r.d(t,{WF:()=>o,AH:()=>i.AH,qy:()=>n.qy,JW:()=>n.JW,iz:()=>i.iz});var i=r(98502),n=r(52321);let s=globalThis;class o extends i.mN{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=(0,n.XX)(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return n.c0}}o._$litElement$=!0,o.finalized=!0,s.litElementHydrateSupport?.({LitElement:o});let a=s.litElementPolyfillSupport;a?.({LitElement:o}),(s.litElementVersions??=[]).push("4.2.2")},83176:(e,t,r)=>{"use strict";var i=r(98392),n=r(43770),s=r(92963),o=r(78239);function a(e){s.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,r){s.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}n(a,s),e.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),i=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===i.redSqrt().redSqr().cmp(i)},n(c,s.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(o.toArray(e,t),1)},a.prototype.point=function(e,t){return new c(this,e,t)},a.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>
1400":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),i=e.redMul(t),n=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(i,n)},c.prototype.add=function(){throw Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),i=this.x.redSub(this.z),n=e.x.redAdd(e.z),s=e.x.redSub(e.z).redMul(r),o=n.redMul(i),a=t.z.redMul(s.redAdd(o).redSqr()),c=t.x.redMul(s.redISub(o).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(e){for(var t=e.clone(),r=this,i=this.curve.point(null,null),n=[];0!==t.cmpn(0);t.iushrn(1))n.push(t.andln(1));for(var s=n.length-1;s>=0;s--)0===n[s]?(r=r.diffAdd(i,this),i=i.dbl()):(i=r.diffAdd(i,this),r=r.dbl());return i},c.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},83247:(e,t,r)=>{"use strict";e.exports=function(e){var t,r;t=e.lib.Base,r=e.enc.Utf8,e.algo.HMAC=t.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var i=e.blockSize,n=4*i;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),o=this._iKey=t.clone(),a=s.words,c=o.words,l=0;l<i;l++)a[l]^=0x5c5c5c5c,c[l]^=0x36363636;s.sigBytes=o.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})}(r(16611))},83262:(e,t,r)=>{"use strict";r.d(t,{lc:()=>_,jE:()=>A,_l:()=>l});var i=r(2339),n=r(51838);let s=e=>({decode:e.decode.bind(e),encode:e.encode.bind(e)});var o=r(81029).Buffer;let a=e=>t=>{let r=(0,i.blob)(e,t),{encode:a,decode:c}=s(r);return r.decode=(e,t)=>{let r=c(e,t);return(0,n.toBigIntLE)(o.from(r))},r.encode=(t,r,i)=>a((0,n.toBufferLE)(t,e),r,i),r},c=e=>t=>{let r=(0,i.blob)(e,t),{encode:a,decode:c}=s(r);return r.decode=(e,t)=>{let r=c(e,t);return(0,n.toBigIntBE)(o.from(r))},r.encode=(t,r,i)=>a((0,n.toBufferBE)(t,e),r,i),r},l=a(8);c(8),a(16),c(16),a(24),c(24),a(32),c(32);var h=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,u=Math.ceil,d=Math.floor,f="[BigNumber Error] ",p=f+"Number primitive has more than 15 significant digits: ",g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13];function m(e){var t=0|e;return e>0||e===t?t:t-1}function y(e){for(var t,r,i=1,n=e.length,s=e[0]+"";i<n;){for(r=14-(t=e[i++]+"").length;r--;t="0"+t);s+=t}for(n=s.length;48===s.charCodeAt(--n););return s.slice(0,n+1||1)}function b(e,t){var r,i,n=e.c,s=t.c,o=e.s,a=t.s,c=e.e,l=t.e;if(!o||!a)return null;if(r=n&&!n[0],i=s&&!s[0],r||i)return r?i?0:-a:o;if(o!=a)return o;if(r=o<0,i=c==l,!n||!s)return i?0:!n^r?1:-1;if(!i)return c>l^r?1:-1;for(o=0,a=(c=n.length)<(l=s.length)?c:l;o<a;o++)if(n[o]!=s[o])return n[o]>s[o]^r?1:-1;return c==l?0:c>l^r?1:-1}function w(e,t,r,i){if(e<t||e>r||e!==d(e))throw Error(f+(i||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function v(e){var t=e.c.length-1;return m(e.e/14)==t&&e.c[t]%2!=0}function x(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function E(e,t,r){var i,n;if(t<0){for(n=r+".";++t;n+=r);e=n+e}else if(i=e.length,++t>i){for(n=r,t-=i;--t;n+=r);e+=n}else t<i&&(e=e.slice(0,t)+"."+e.slice(t));return e}new(function e(t){var r,i,n,s,o,a,c,l,_,I=B.prototype={constructor:B,toString:null,valueOf:null},A=new B(1),S=20,C=4,N=-7,O=21,P=-1e7,T=1e7,M=!1,R=1,k=0,D={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xa0",suffix:""},L="0123456789abcdefghijklmnopqrstuvwxyz",U=!0;function B(e,t){var r,i,n,s,o,a,c,u,f=this;if(!(f instanceof B))return new B(e,t);if(null==t){if(e&&!0===e._isBigNumber){f.s=e.s,!e.c||e.e>T?f.c=f.e=null:e.e<P?f.c=[f.e=0]:(f.e=e.e,f.c=e.c.slice());return}if((a="number"==typeof e)&&0*e==0){if(f.s=1/e<0?(e=-e,-1):1,e===~~e){for(s=0,o=e;o>=10;o/=10,s++);s>T?f.c=f.e=null:(f.e=s,f.c=[e]);return}u=String(e)}else{if(!h.test(u=String(e)))return _(f,u,a);f.s=45==u.charCodeAt(0)?(u=u.slice(1),-1):1}(s=u.indexOf("."))>-1&&(u=u.replace(".","")),(o=u.search(/e/i))>0?(s<0&&(s=o),s+=+u.slice(o+1),u=u.substring(0,o)):s<0&&(s=u.length)}
1400else{if(w(t,2,L.length,"Base"),10==t&&U)return q(f=new B(e),S+f.e+1,C);if(u=String(e),a="number"==typeof e){if(0*e!=0)return _(f,u,a,t);if(f.s=1/e<0?(u=u.slice(1),-1):1,B.DEBUG&&u.replace(/^0\.0*|\./,"").length>15)throw Error(p+e)}else f.s=45===u.charCodeAt(0)?(u=u.slice(1),-1):1;for(r=L.slice(0,t),s=o=0,c=u.length;o<c;o++)if(0>r.indexOf(i=u.charAt(o))){if("."==i){if(o>s){s=c;continue}}else if(!n&&(u==u.toUpperCase()&&(u=u.toLowerCase())||u==u.toLowerCase()&&(u=u.toUpperCase()))){n=!0,o=-1,s=0;continue}return _(f,String(e),a,t)}a=!1,(s=(u=l(u,t,10,f.s)).indexOf("."))>-1?u=u.replace(".",""):s=u.length}for(o=0;48===u.charCodeAt(o);o++);for(c=u.length;48===u.charCodeAt(--c););if(u=u.slice(o,++c)){if(c-=o,a&&B.DEBUG&&c>15&&(e>0x1fffffffffffff||e!==d(e)))throw Error(p+f.s*e);if((s=s-o-1)>T)f.c=f.e=null;else if(s<P)f.c=[f.e=0];else{if(f.e=s,f.c=[],o=(s+1)%14,s<0&&(o+=14),o<c){for(o&&f.c.push(+u.slice(0,o)),c-=14;o<c;)f.c.push(+u.slice(o,o+=14));o=14-(u=u.slice(o)).length}else o-=c;for(;o--;u+="0");f.c.push(+u)}}else f.c=[f.e=0]}function j(e,t,r,i){var n,s,o,a,c;if(null==r?r=C:w(r,0,8),!e.c)return e.toString();if(n=e.c[0],o=e.e,null==t)c=y(e.c),c=1==i||2==i&&(o<=N||o>=O)?x(c,o):E(c,o,"0");else if(s=(e=q(new B(e),t,r)).e,a=(c=y(e.c)).length,1==i||2==i&&(t<=s||s<=N)){for(;a<t;c+="0",a++);c=x(c,s)}else if(t-=o+(2===i&&s>o),c=E(c,s,"0"),s+1>a){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=s-a)>0)for(s+1==a&&(c+=".");t--;c+="0");return e.s<0&&n?"-"+c:c}function $(e,t){for(var r,i,n=1,s=new B(e[0]);n<e.length;n++)(i=new B(e[n])).s&&(r=b(s,i))!==t&&(0!==r||s.s!==t)||(s=i);return s}function z(e,t,r){for(var i=1,n=t.length;!t[--n];t.pop());for(n=t[0];n>=10;n/=10,i++);return(r=i+14*r-1)>T?e.c=e.e=null:r<P?e.c=[e.e=0]:(e.e=r,e.c=t),e}function q(e,t,r,i){var n,s,o,a,c,l,h,f=e.c;if(f){e:{for(n=1,a=f[0];a>=10;a/=10,n++);if((s=t-n)<0)s+=14,o=t,h=d((c=f[l=0])/g[n-o-1]%10);else if((l=u((s+1)/14))>=f.length)if(i){for(;f.length<=l;f.push(0));c=h=0,n=1,s%=14,o=s-14+1}else break e;else{for(n=1,c=a=f[l];a>=10;a/=10,n++);s%=14,h=(o=s-14+n)<0?0:d(c/g[n-o-1]%10)}if(i=i||t<0||null!=f[l+1]||(o<0?c:c%g[n-o-1]),i=r<4?(h||i)&&(0==r||r==(e.s<0?3:2)):h>5||5==h&&(4==r||i||6==r&&(s>0?o>0?c/g[n-o]:0:f[l-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,i?(t-=e.e+1,f[0]=g[(14-t%14)%14],e.e=-t||0):f[0]=e.e=0,e;if(0==s?(f.length=l,a=1,l--):(f.length=l+1,a=g[14-s],f[l]=o>0?d(c/g[n-o]%g[o])*a:0),i)for(;;)if(0==l){for(s=1,o=f[0];o>=10;o/=10,s++);for(o=f[0]+=a,a=1;o>=10;o/=10,a++);s!=a&&(e.e++,1e14==f[0]&&(f[0]=1));break}else{if(f[l]+=a,1e14!=f[l])break;f[l--]=0,a=1}for(s=f.length;0===f[--s];f.pop());}e.e>T?e.c=e.e=null:e.e<P&&(e.c=[e.e=0])}return e}function H(e){var t,r=e.e;return null===r?e.toString():(t=y(e.c),t=r<=N||r>=O?x(t,r):E(t,r,"0"),e.s<0?"-"+t:t)}return B.clone=e,B.ROUND_UP=0,B.ROUND_DOWN=1,B.ROUND_CEIL=2,B.ROUND_FLOOR=3,B.ROUND_HALF_UP=4,B.ROUND_HALF_DOWN=5,B.ROUND_HALF_EVEN=6,B.ROUND_HALF_CEIL=7,B.ROUND_HALF_FLOOR=8,B.EUCLID=9,B.config=B.set=function(e){var t,r;if(null!=e)if("object"==typeof e){if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(w(r=e[t],0,1e9,t),S=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(w(r=e[t],0,8,t),C=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(w(r[0],-1e9,0,t),w(r[1],0,1e9,t),N=r[0],O=r[1]):(w(r,-1e9,1e9,t),N=-(O=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)w(r[0],-1e9,-1,t),w(r[1],1,1e9,t),P=r[0],T=r[1];else if(w(r,-1e9,1e9,t),r)P=-(T=r<0?-r:r);else throw Error(f+t+" cannot be zero: "+r);if(e.hasOwnProperty(t="CRYPTO"))if(!!(r=e[t])===r)if(r)if("undefined"!=typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))M=r;else throw M=!r,Error(f+"crypto unavailable");else M=r;else throw Error(f+t+" not true or false: "+r);if(e.hasOwnProperty(t="MODULO_MODE")&&(w(r=e[t],0,9,t),R=r),e.hasOwnProperty(t="POW_PRECISION")&&(w(r=e[t],0,1e9,t),k=r),e.hasOwnProperty(t="FORMAT"))if("object"==typeof(r=e[t]))D=r;else throw Error(f+t+" not an object: "+r);if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(f+t+" invalid: "+r);U="0123456789"==r.slice(0,10),L=r}}else throw Error(f+"Object expected: "+e);return{DECIMAL_PLACES:S,ROUNDING_MODE:C,EXPONENTIAL_AT:[N,O],RANGE:[P,T],CRYPTO:M,MODULO_MODE:R,POW_PRECISION:k,FORMAT:D,ALPHABET:L}},B.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!B.DEBUG)return!0;var t,r,i=e.c,n=e.e,s=e.s;e:if("[object Array]"==({}
1400).toString.call(i)){if((1===s||-1===s)&&n>=-1e9&&n<=1e9&&n===d(n)){if(0===i[0]){if(0===n&&1===i.length)return!0;break e}if((t=(n+1)%14)<1&&(t+=14),String(i[0]).length==t){for(t=0;t<i.length;t++)if((r=i[t])<0||r>=1e14||r!==d(r))break e;if(0!==r)return!0}}}else if(null===i&&null===n&&(null===s||1===s||-1===s))return!0;throw Error(f+"Invalid BigNumber: "+e)},B.maximum=B.max=function(){return $(arguments,-1)},B.minimum=B.min=function(){return $(arguments,1)},r=0x20000000000000*Math.random()&2097151?function(){return d(0x20000000000000*Math.random())}:function(){return(0x40000000*Math.random()|0)*8388608+(8388608*Math.random()|0)},B.random=function(e){var t,i,n,s,o,a=0,c=[],l=new B(A);if(null==e?e=S:w(e,0,1e9),s=u(e/14),M)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(s*=2));a<s;)(o=131072*t[a]+(t[a+1]>>>11))>=9e15?(i=crypto.getRandomValues(new Uint32Array(2)),t[a]=i[0],t[a+1]=i[1]):(c.push(o%1e14),a+=2);a=s/2}else if(crypto.randomBytes){for(t=crypto.randomBytes(s*=7);a<s;)(o=(31&t[a])*0x1000000000000+0x10000000000*t[a+1]+0x100000000*t[a+2]+0x1000000*t[a+3]+(t[a+4]<<16)+(t[a+5]<<8)+t[a+6])>=9e15?crypto.randomBytes(7).copy(t,a):(c.push(o%1e14),a+=7);a=s/7}else throw M=!1,Error(f+"crypto unavailable");if(!M)for(;a<s;)(o=r())<9e15&&(c[a++]=o%1e14);for(s=c[--a],e%=14,s&&e&&(o=g[14-e],c[a]=d(s/o)*o);0===c[a];c.pop(),a--);if(a<0)c=[n=0];else{for(n=-1;0===c[0];c.splice(0,1),n-=14);for(a=1,o=c[0];o>=10;o/=10,a++);a<14&&(n-=14-a)}return l.e=n,l.c=c,l},B.sum=function(){for(var e=1,t=arguments,r=new B(t[0]);e<t.length;)r=r.plus(t[e++]);return r},l=function(){var e="0123456789";function t(e,t,r,i){for(var n,s,o=[0],a=0,c=e.length;a<c;){for(s=o.length;s--;o[s]*=t);for(o[0]+=i.indexOf(e.charAt(a++)),n=0;n<o.length;n++)o[n]>r-1&&(null==o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}return function(r,i,n,s,o){var a,l,h,u,d,f,p,g,m=r.indexOf("."),b=S,w=C;for(m>=0&&(u=k,k=0,r=r.replace(".",""),f=(g=new B(i)).pow(r.length-m),k=u,g.c=t(E(y(f.c),f.e,"0"),10,n,e),g.e=g.c.length),h=u=(p=t(r,i,n,o?(a=L,e):(a=e,L))).length;0==p[--u];p.pop());if(!p[0])return a.charAt(0);if(m<0?--h:(f.c=p,f.e=h,f.s=s,p=(f=c(f,g,b,w,n)).c,d=f.r,h=f.e),m=p[l=h+b+1],u=n/2,d=d||l<0||null!=p[l+1],d=w<4?(null!=m||d)&&(0==w||w==(f.s<0?3:2)):m>u||m==u&&(4==w||d||6==w&&1&p[l-1]||w==(f.s<0?8:7)),l<1||!p[0])r=d?E(a.charAt(1),-b,a.charAt(0)):a.charAt(0);else{if(p.length=l,d)for(--n;++p[--l]>n;)p[l]=0,l||(++h,p=[1].concat(p));for(u=p.length;!p[--u];);for(m=0,r="";m<=u;r+=a.charAt(p[m++]));r=E(r,h,a.charAt(0))}return r}}(),c=function(){function e(e,t,r){var i,n,s,o,a=0,c=e.length,l=t%1e7,h=t/1e7|0;for(e=e.slice();c--;)i=h*(s=e[c]%1e7)+(o=e[c]/1e7|0)*l,a=((n=l*s+i%1e7*1e7+a)/r|0)+(i/1e7|0)+h*o,e[c]=n%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,i){var n,s;if(r!=i)s=r>i?1:-1;else for(n=s=0;n<r;n++)if(e[n]!=t[n]){s=e[n]>t[n]?1:-1;break}return s}function r(e,t,r,i){for(var n=0;r--;)e[r]-=n,n=+(e[r]<t[r]),e[r]=n*i+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(i,n,s,o,a){var c,l,h,u,f,p,g,y,b,w,v,x,E,_,I,A,S,C=i.s==n.s?1:-1,N=i.c,O=n.c;if(!N||!N[0]||!O||!O[0])return new B(!i.s||!n.s||(N?O&&N[0]==O[0]:!O)?NaN:N&&0==N[0]||!O?0*C:C/0);for(b=(y=new B(C)).c=[],C=s+(l=i.e-n.e)+1,a||(a=1e14,l=m(i.e/14)-m(n.e/14),C=C/14|0),h=0;O[h]==(N[h]||0);h++);if(O[h]>(N[h]||0)&&l--,C<0)b.push(1),u=!0;else{for(_=N.length,A=O.length,h=0,C+=2,(f=d(a/(O[0]+1)))>1&&(O=e(O,f,a),N=e(N,f,a),A=O.length,_=N.length),E=A,v=(w=N.slice(0,A)).length;v<A;w[v++]=0);S=[0].concat(S=O.slice()),I=O[0],O[1]>=a/2&&I++;do{if(f=0,(c=t(O,w,A,v))<0){if(x=w[0],A!=v&&(x=x*a+(w[1]||0)),(f=d(x/I))>1)for(f>=a&&(f=a-1),g=(p=e(O,f,a)).length,v=w.length;1==t(p,w,g,v);)f--,r(p,A<g?S:O,g,a),g=p.length,c=1;else 0==f&&(c=f=1),g=(p=O.slice()).length;if(g<v&&(p=[0].concat(p)),r(w,p,v,a),v=w.length,-1==c)for(;1>t(O,w,A,v);)f++,r(w,A<v?S:O,v,a),v=w.length}else 0===c&&(f++,w=[0]);b[h++]=f,w[0]?w[v++]=N[E]||0:(w=[N[E]],v=1)}while((E++<_||null!=w[0])&&C--);u=null!=w[0],b[0]||b.splice(0,1)}if(1e14==a){for(h=1,C=b[0];C>=10;C/=10,h++);q(y,s+(y.e=h+14*l-1)+1,o,u)}else y.e=l,y.r=+u;return y}}(),i=/^(-?)0([xbo])(?=\w[\w.]*$)/i,n=/^([^.]+)\.$/,s=/^\.([^.]+)$/,o=/^-?(Infinity|NaN)$/,a=/^\s*\+(?=[\w.])|^\s+|\s+$/g,_=function(e,t,r,c){var l,h=r?t:t.replace(a,"");if(o.test(h))e.s=isNaN(h)?null:h<0?-1:1;else{if(!r&&(h=h.replace(i,function(e,t,r){return l="x"==(r=r.toLowerCase())?16:"b"==r?2:8,c&&c!=l?e:t}),c&&(l=c,h=h.replace(n,"$1").replace(s,"0.$1")),t!=h))return new B(h,l);if(B.DEBUG)throw Error(f+"Not a"+(c?" base "+c:"")+" number: "+t);e.s=null}e.c=e.e=null},I.absoluteValue=I.abs=function(){var e=new B(this);return e.s<0&&(e.s=1),e},I.comparedTo=function(e,t){return b(this,new B(e,t))},I.decimalPlaces=I.dp=function(e,t){var r,i,n;if(null!=e)return w(e,0,1e9),null==t?t=C:w(t,0,8),q(new B(this),e+this.e+1,t);if(!(r=this.c))return null;if(i=((n=r.length-1)-m(this.e/14))*14,n=r[n])for(;n%10==0;n/=10,i--);return i<0&&(i=0),i},I.dividedBy=I.div=function(e,t){return c(this,new B(e,t),S,C)},I.dividedToIntegerBy=I.idiv=function(e,t){return c(this,new B(e,t),0,1)},I.exponentiatedBy=I.pow=function(e,t){var r,i,n,s,o,a,c,l,h,p=this;
1400if((e=new B(e)).c&&!e.isInteger())throw Error(f+"Exponent not an integer: "+H(e));if(null!=t&&(t=new B(t)),a=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return h=new B(Math.pow(+H(p),a?e.s*(2-v(e)):+H(e))),t?h.mod(t):h;if(c=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new B(NaN);(i=!c&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||a&&p.c[1]>=24e7:p.c[0]<8e13||a&&p.c[0]<=9999975e7)))return s=p.s<0&&v(e)?-0:0,p.e>-1&&(s=1/s),new B(c?1/s:s);k&&(s=u(k/14+2))}for(a?(r=new B(.5),c&&(e.s=1),l=v(e)):l=(n=Math.abs(+H(e)))%2,h=new B(A);;){if(l){if(!(h=h.times(p)).c)break;s?h.c.length>s&&(h.c.length=s):i&&(h=h.mod(t))}if(n){if(0===(n=d(n/2)))break;l=n%2}else if(q(e=e.times(r),e.e+1,1),e.e>14)l=v(e);else{if(0==(n=+H(e)))break;l=n%2}p=p.times(p),s?p.c&&p.c.length>s&&(p.c.length=s):i&&(p=p.mod(t))}return i?h:(c&&(h=A.div(h)),t?h.mod(t):s?q(h,k,C,o):h)},I.integerValue=function(e){var t=new B(this);return null==e?e=C:w(e,0,8),q(t,t.e+1,e)},I.isEqualTo=I.eq=function(e,t){return 0===b(this,new B(e,t))},I.isFinite=function(){return!!this.c},I.isGreaterThan=I.gt=function(e,t){return b(this,new B(e,t))>0},I.isGreaterThanOrEqualTo=I.gte=function(e,t){return 1===(t=b(this,new B(e,t)))||0===t},I.isInteger=function(){return!!this.c&&m(this.e/14)>this.c.length-2},I.isLessThan=I.lt=function(e,t){return 0>b(this,new B(e,t))},I.isLessThanOrEqualTo=I.lte=function(e,t){return -1===(t=b(this,new B(e,t)))||0===t},I.isNaN=function(){return!this.s},I.isNegative=function(){return this.s<0},I.isPositive=function(){return this.s>0},I.isZero=function(){return!!this.c&&0==this.c[0]},I.minus=function(e,t){var r,i,n,s,o=this.s;if(t=(e=new B(e,t)).s,!o||!t)return new B(NaN);if(o!=t)return e.s=-t,this.plus(e);var a=this.e/14,c=e.e/14,l=this.c,h=e.c;if(!a||!c){if(!l||!h)return l?(e.s=-t,e):new B(h?this:NaN);if(!l[0]||!h[0])return h[0]?(e.s=-t,e):new B(l[0]?this:3==C?-0:0)}if(a=m(a),c=m(c),l=l.slice(),o=a-c){for((s=o<0)?(o=-o,n=l):(c=a,n=h),n.reverse(),t=o;t--;n.push(0));n.reverse()}else for(i=(s=(o=l.length)<(t=h.length))?o:t,o=t=0;t<i;t++)if(l[t]!=h[t]){s=l[t]<h[t];break}if(s&&(n=l,l=h,h=n,e.s=-e.s),(t=(i=h.length)-(r=l.length))>0)for(;t--;l[r++]=0);for(t=1e14-1;i>o;){if(l[--i]<h[i]){for(r=i;r&&!l[--r];l[r]=t);--l[r],l[i]+=1e14}l[i]-=h[i]}for(;0==l[0];l.splice(0,1),--c);return l[0]?z(e,l,c):(e.s=3==C?-1:1,e.c=[e.e=0],e)},I.modulo=I.mod=function(e,t){var r,i;return(e=new B(e,t),this.c&&e.s&&(!e.c||e.c[0]))?e.c&&(!this.c||this.c[0])?(9==R?(i=e.s,e.s=1,r=c(this,e,0,3),e.s=i,r.s*=i):r=c(this,e,0,R),(e=this.minus(r.times(e))).c[0]||1!=R||(e.s=this.s),e):new B(this):new B(NaN)},I.multipliedBy=I.times=function(e,t){var r,i,n,s,o,a,c,l,h,u,d,f,p,g=this.c,y=(e=new B(e,t)).c;if(!g||!y||!g[0]||!y[0])return this.s&&e.s&&(!g||g[0]||y)&&(!y||y[0]||g)?(e.s*=this.s,g&&y?(e.c=[0],e.e=0):e.c=e.e=null):e.c=e.e=e.s=null,e;for(i=m(this.e/14)+m(e.e/14),e.s*=this.s,(c=g.length)<(u=y.length)&&(p=g,g=y,y=p,n=c,c=u,u=n),n=c+u,p=[];n--;p.push(0));for(n=u;--n>=0;){for(r=0,d=y[n]%1e7,f=y[n]/1e7|0,s=n+(o=c);s>n;)a=f*(l=g[--o]%1e7)+(h=g[o]/1e7|0)*d,r=((l=d*l+a%1e7*1e7+p[s]+r)/1e14|0)+(a/1e7|0)+f*h,p[s--]=l%1e14;p[s]=r}return r?++i:p.splice(0,1),z(e,p,i)},I.negated=function(){var e=new B(this);return e.s=-e.s||null,e},I.plus=function(e,t){var r,i=this.s;if(t=(e=new B(e,t)).s,!i||!t)return new B(NaN);if(i!=t)return e.s=-t,this.minus(e);var n=this.e/14,s=e.e/14,o=this.c,a=e.c;if(!n||!s){if(!o||!a)return new B(i/0);if(!o[0]||!a[0])return a[0]?e:new B(o[0]?this:0*i)}if(n=m(n),s=m(s),o=o.slice(),i=n-s){for(i>0?(s=n,r=a):(i=-i,r=o),r.reverse();i--;r.push(0));r.reverse()}for((i=o.length)-(t=a.length)<0&&(r=a,a=o,o=r,t=i),i=0;t;)i=(o[--t]=o[t]+a[t]+i)/1e14|0,o[t]=1e14===o[t]?0:o[t]%1e14;return i&&(o=[i].concat(o),++s),z(e,o,s)},I.precision=I.sd=function(e,t){var r,i,n;if(null!=e&&!!e!==e)return w(e,1,1e9),null==t?t=C:w(t,0,8),q(new B(this),e,t);if(!(r=this.c))return null;if(i=14*(n=r.length-1)+1,n=r[n]){for(;n%10==0;n/=10,i--);for(n=r[0];n>=10;n/=10,i++);}return e&&this.e+1>i&&(i=this.e+1),i},I.shiftedBy=function(e){return w(e,-0x1fffffffffffff,0x1fffffffffffff),this.times("1e"+e)},I.squareRoot=I.sqrt=function(){var e,t,r,i,n,s=this.c,o=this.s,a=this.e,l=S+4,h=new B("0.5");
1400if(1!==o||!s||!s[0])return new B(!o||o<0&&(!s||s[0])?NaN:s?this:1/0);if(0==(o=Math.sqrt(+H(this)))||o==1/0?(((t=y(s)).length+a)%2==0&&(t+="0"),o=Math.sqrt(+t),a=m((a+1)/2)-(a<0||a%2),r=new B(t=o==1/0?"5e"+a:(t=o.toExponential()).slice(0,t.indexOf("e")+1)+a)):r=new B(o+""),r.c[0]){for((o=(a=r.e)+l)<3&&(o=0);;)if(n=r,r=h.times(n.plus(c(this,n,l,1))),y(n.c).slice(0,o)===(t=y(r.c)).slice(0,o)){if(r.e<a&&--o,"9999"!=(t=t.slice(o-3,o+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(q(r,r.e+S+2,1),e=!r.times(r).eq(this));break}if(!i&&(q(n,n.e+S+2,0),n.times(n).eq(this))){r=n;break}l+=4,o+=4,i=1}}return q(r,r.e+S+1,C,e)},I.toExponential=function(e,t){return null!=e&&(w(e,0,1e9),e++),j(this,e,t,1)},I.toFixed=function(e,t){return null!=e&&(w(e,0,1e9),e=e+this.e+1),j(this,e,t)},I.toFormat=function(e,t,r){var i;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=D;else if("object"!=typeof r)throw Error(f+"Argument not an object: "+r);if(i=this.toFixed(e,t),this.c){var n,s=i.split("."),o=+r.groupSize,a=+r.secondaryGroupSize,c=r.groupSeparator||"",l=s[0],h=s[1],u=this.s<0,d=u?l.slice(1):l,p=d.length;if(a&&(n=o,o=a,a=n,p-=n),o>0&&p>0){for(n=p%o||o,l=d.substr(0,n);n<p;n+=o)l+=c+d.substr(n,o);a>0&&(l+=c+d.slice(n)),u&&(l="-"+l)}i=h?l+(r.decimalSeparator||"")+((a=+r.fractionGroupSize)?h.replace(RegExp("\\d{"+a+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):l}return(r.prefix||"")+i+(r.suffix||"")},I.toFraction=function(e){var t,r,i,n,s,o,a,l,h,u,d,p,m=this.c;if(null!=e&&(!(a=new B(e)).isInteger()&&(a.c||1!==a.s)||a.lt(A)))throw Error(f+"Argument "+(a.isInteger()?"out of range: ":"not an integer: ")+H(a));if(!m)return new B(this);for(t=new B(A),h=r=new B(A),i=l=new B(A),p=y(m),s=t.e=p.length-this.e-1,t.c[0]=g[(o=s%14)<0?14+o:o],e=!e||a.comparedTo(t)>0?s>0?t:h:a,o=T,T=1/0,a=new B(p),l.c[0]=0;u=c(a,t,0,1),1!=(n=r.plus(u.times(i))).comparedTo(e);)r=i,i=n,h=l.plus(u.times(n=h)),l=n,t=a.minus(u.times(n=t)),a=n;return n=c(e.minus(r),i,0,1),l=l.plus(n.times(h)),r=r.plus(n.times(i)),l.s=h.s=this.s,s*=2,d=1>c(h,i,s,C).minus(this).abs().comparedTo(c(l,r,s,C).minus(this).abs())?[h,i]:[l,r],T=o,d},I.toNumber=function(){return+H(this)},I.toPrecision=function(e,t){return null!=e&&w(e,1,1e9),j(this,e,t,2)},I.toString=function(e){var t,r=this,i=r.s,n=r.e;return null===n?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=n<=N||n>=O?x(y(r.c),n):E(y(r.c),n,"0"):10===e&&U?t=E(y((r=q(new B(r),S+n+1,C)).c),r.e,"0"):(w(e,2,L.length,"Base"),t=l(E(y(r.c),n,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},I.valueOf=I.toJSON=function(){return H(this)},I._isBigNumber=!0,I[Symbol.toStringTag]="BigNumber",I[Symbol.for("nodejs.util.inspect.custom")]=I.valueOf,null!=t&&B.set(t),B}())("1e+18");let _=e=>{let t=(0,i.u8)(e),{encode:r,decode:n}=s(t);return t.decode=(e,t)=>!!n(e,t),t.encode=(e,t,i)=>r(Number(e),t,i),t};var I=r(25223);let A=e=>{let t=(0,i.blob)(32,e),{encode:r,decode:n}=s(t);return t.decode=(e,t)=>{let r=n(e,t);return new I.PublicKey(r)},t.encode=(e,t,i)=>r(e.toBuffer(),t,i),t}},83538:(e,t,r)=>{"use strict";var i=r(48945).Buffer;e.exports=function(e){if(e.length>=255)throw TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==t[o])throw TypeError(s+" is ambiguous");t[o]=n}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function u(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return i.alloc(0);for(var r=0,n=0,s=0;e[r]===c;)n++,r++;for(var o=(e.length-r)*l+1>>>0,h=new Uint8Array(o);r<e.length;){var u=e.charCodeAt(r);if(u>255)return;var d=t[u];if(255===d)return;for(var f=0,p=o-1;(0!==d||f<s)&&-1!==p;p--,f++)d+=a*h[p]>>>0,h[p]=d%256>>>0,d=d/256>>>0;if(0!==d)throw Error("Non-zero carry");s=f,r++}for(var g=o-s;g!==o&&0===h[g];)g++;var m=i.allocUnsafe(n+(o-g));m.fill(0,0,n);for(var y=n;g!==o;)m[y++]=h[g++];return m}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=i.from(t)),!i.isBuffer(t))throw TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,n=0,s=0,o=t.length;s!==o&&0===t[s];)s++,r++;for(var l=(o-s)*h+1>>>0,u=new Uint8Array(l);s!==o;){for(var d=t[s],f=0,p=l-1;(0!==d||f<n)&&-1!==p;p--,f++)d+=256*u[p]>>>0,u[p]=d%a>>>0,d=d/a>>>0;if(0!==d)throw Error("Non-zero carry");n=f,s++}for(var g=l-n;g!==l&&0===u[g];)g++;for(var m=c.repeat(r);g<l;++g)m+=e.charAt(u[g]);return m},decodeUnsafe:u,decode:function(e){var t=u(e);if(t)return t;throw Error("Non-base"+a+" character")}}}},84034:(e,t,r)=>{"use strict";r.d(t,{E:()=>n,w:()=>s});var i=r(12115);let n=(0,i.createContext)({});function s(){return(0,i.useContext)(n)}},85289:(e,t,r)=>{let i=r(52686);t.render=function(e,t,r){var n;let s=r,o=t;void 0!==s||t&&t.getContext||(s=t,t=void 0),t||(o=function(){try{return document.createElement("canvas")}catch(e){throw Error("You need to specify a canvas element")}}()),s=i.getOptions(s);let a=i.getImageWidth(e.modules.size,s),c=o.getContext("2d"),l=c.createImageData(a,a);return i.qrToImageData(l.data,e,s),n=o,c.clearRect(0,0,n.width,n.height),n.style||(n.style={}),n.height=a,n.width=a,n.style.height=a+"px",n.style.width=a+"px",c.putImageData(l,0,0),o},t.renderToDataURL=function(e,r,i){let n=i;void 0!==n||r&&r.getContext||(n=r,r=void 0),n||(n={});let s=t.render(e,r,n),o=n.type||"image/png",a=n.rendererOpts||{};return s.toDataURL(o,a.quality)}},85574:(e,t,r)=>{"use strict";var i=r(78239),n=r(98392),s=r(43770),o=r(92963),a=i.assert;function c(e){this.twisted=(0|e.a)!=1,this.mOneA=this.twisted&&(0|e.a)==-1,this.extended=this.mOneA,o.call(this,"edwards",e),this.a=new n(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new n(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new n(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=(0|e.c)==1}function l(e,t,r,i,s){o.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===i?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new n(t,16),this.y=new n(r,16),this.z=i?new n(i,16):this.curve.one,this.t=s&&new n(s,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}
1400s(c,o),e.exports=c,c.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},c.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},c.prototype.jpoint=function(e,t,r,i){return this.point(e,t,r,i)},c.prototype.pointFromX=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=this.c2.redSub(this.a.redMul(r)),s=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=i.redMul(s.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw Error("invalid point");var c=a.fromRed().isOdd();return(t&&!c||!t&&c)&&(a=a.redNeg()),this.point(e,a)},c.prototype.pointFromY=function(e,t){(e=new n(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),i=r.redSub(this.c2),s=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(s.redInvm());if(0===o.cmp(this.zero))if(!t)return this.point(this.zero,e);else throw Error("invalid point");var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},c.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),i=t.redMul(this.a).redAdd(r),n=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===i.cmp(n)},s(l,o.BasePoint),c.prototype.pointFromJSON=function(e){return l.fromJSON(this,e)},c.prototype.point=function(e,t,r,i){return new l(this,e,t,r,i)},l.fromJSON=function(e,t){return new l(e,t[0],t[1],t[2])},l.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},l.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},l.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(e),n=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),s=i.redAdd(t),o=s.redSub(r),a=i.redSub(t),c=n.redMul(o),l=s.redMul(a),h=n.redMul(a),u=o.redMul(s);return this.curve.point(c,l,u,h)},l.prototype._projDbl=function(){var e,t,r,i,n,s,o=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var l=(i=this.curve._mulA(a)).redAdd(c);this.zOne?(e=o.redSub(a).redSub(c).redMul(l.redSub(this.curve.two)),t=l.redMul(i.redSub(c)),r=l.redSqr().redSub(l).redSub(l)):(n=this.z.redSqr(),s=l.redSub(n).redISub(n),e=o.redSub(a).redISub(c).redMul(s),t=l.redMul(i.redSub(c)),r=l.redMul(s))}else i=a.redAdd(c),n=this.curve._mulC(this.z).redSqr(),s=i.redSub(n).redSub(n),e=this.curve._mulC(o.redISub(i)).redMul(s),t=this.curve._mulC(i).redMul(a.redISub(c)),r=i.redMul(s);return this.curve.point(e,t,r)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},l.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),n=this.z.redMul(e.z.redAdd(e.z)),s=r.redSub(t),o=n.redSub(i),a=n.redAdd(i),c=r.redAdd(t),l=s.redMul(o),h=a.redMul(c),u=s.redMul(c),d=o.redMul(a);return this.curve.point(l,h,d,u)},l.prototype._projAdd=function(e){var t,r,i=this.z.redMul(e.z),n=i.redSqr(),s=this.x.redMul(e.x),o=this.y.redMul(e.y),a=this.curve.d.redMul(s).redMul(o),c=n.redSub(a),l=n.redAdd(a),h=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(s).redISub(o),u=i.redMul(c).redMul(h);return this.curve.twisted?(t=i.redMul(l).redMul(o.redSub(this.curve._mulA(s))),r=c.redMul(l)):(t=i.redMul(l).redMul(o.redSub(s)),r=this.curve._mulC(c).redMul(l)),this.curve.point(u,t,r)},l.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},l.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},l.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},l.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},l.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},l.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},l.prototype.getX=function(){return this.normalize(),this.x.fromRed()},l.prototype.getY=function(){return this.normalize(),this.y.fromRed()},l.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},l.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),0===this.x.cmp(t))return!0}},l.prototype.toP=l.prototype.normalize,l.prototype.mixedAdd=l.prototype.add},85971:(e,t,r)=>{"use strict";r.d(t,{ToastContainer:()=>T,oR:()=>_});var i=r(12115);let n=function(){for(var e,t,r=0,i="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=function e(t){var r,i,n="";if("string"==typeof t||"number"==typeof t)n+=t;else if("object"==typeof t)if(Array.isArray(t)){var s=t.length;for(r=0;r<s;r++)t[r]&&(i=e(t[r]))&&(n&&(n+=" "),n+=i)}else for(i in t)t[i]&&(n&&(n+=" "),n+=i);return n}(e))&&(i&&(i+=" "),i+=t);return i},s=e=>"number"==typeof e&&!isNaN(e),o=e=>"string"==typeof e||"function"==typeof e?e:null,a=e=>(0,i.isValidElement)(e)||"string"==typeof e||"function"==typeof e||s(e);function c(e){let{enter:t,exit:r,appendPosition:n=!1,collapse:s=!0,collapseDuration:o=300}=e;return function(e){let{children:a,position:c,preventExitTransition:l,done:h,nodeRef:u,isIn:d,playToast:f}=e,p=n?"".concat(t,"--").concat(c):t,g=n?"".concat(r,"--").concat(c):r,m=(0,i.useRef)(0);return(0,i.useLayoutEffect)(()=>{let e=u.current,t=p.split(" "),r=i=>{i.target===u.current&&(f(),e.removeEventListener("animationend",r),e.removeEventListener("animationcancel",r),0===m.current&&"animationcancel"!==i.type&&e.classList.remove(...t))};e.classList.add(...t),e.addEventListener("animationend",r),e.addEventListener("animationcancel",r)},[]),(0,i.useEffect)(()=>{let e=u.current,t=()=>{e.removeEventListener("animationend",t),s?function(e,t,r){void 0===r&&(r=300);let{scrollHeight:i,style:n}=e;requestAnimationFrame(()=>{n.minHeight="initial",n.height=i+"px",n.transition="all ".concat(r,"ms"),requestAnimationFrame(()=>{n.height="0",n.padding="0",n.margin="0",setTimeout(t,r)})})}(e,h,o):h()};d||(l?t():(m.current=1,e.className+=" ".concat(g),e.addEventListener("animationend",t)))},[d]),i.createElement(i.Fragment,null,a)}}function l(e,t){return null!=e?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}let h=new Map,u=[],d=new Set,f=e=>
1400d.forEach(t=>t(e));function p(e,t){var r;if(t)return!(null==(r=h.get(t))||!r.isToastActive(e));let i=!1;return h.forEach(t=>{t.isToastActive(e)&&(i=!0)}),i}function g(e,t){a(e)&&(h.size>0||u.push({content:e,options:t}),h.forEach(r=>{r.buildToast(e,t)}))}function m(e,t){h.forEach(r=>{null!=t&&null!=t&&t.containerId?(null==t?void 0:t.containerId)===r.id&&r.toggle(e,null==t?void 0:t.id):r.toggle(e,null==t?void 0:t.id)})}function y(e){let{delay:t,isRunning:r,closeToast:s,type:o="default",hide:a,className:c,style:l,controlledProgress:h,progress:u,rtl:d,isIn:f,theme:p}=e,g=a||h&&0===u,m={...l,animationDuration:"".concat(t,"ms"),animationPlayState:r?"running":"paused"};h&&(m.transform="scaleX(".concat(u,")"));let y=n("Toastify__progress-bar",h?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated","Toastify__progress-bar-theme--".concat(p),"Toastify__progress-bar--".concat(o),{"Toastify__progress-bar--rtl":d}),b="function"==typeof c?c({rtl:d,type:o,defaultClassName:y}):n(y,c);return i.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":g},i.createElement("div",{className:"Toastify__progress-bar--bg Toastify__progress-bar-theme--".concat(p," Toastify__progress-bar--").concat(o)}),i.createElement("div",{role:"progressbar","aria-hidden":g?"true":"false","aria-label":"notification timer",className:b,style:m,...{[h&&u>=1?"onTransitionEnd":"onAnimationEnd"]:h&&u<1?null:()=>{f&&s()}}}))}let b=1,w=()=>""+b++;function v(e,t){return g(e,t),t.toastId}function x(e,t){var r;return{...t,type:t&&t.type||e,toastId:(r=t)&&("string"==typeof r.toastId||s(r.toastId))?r.toastId:w()}}function E(e){return(t,r)=>v(t,x(e,r))}function _(e,t){return v(e,x("default",t))}_.loading=(e,t)=>
1400v(e,x("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),_.promise=function(e,t,r){let i,{pending:n,error:s,success:o}=t;n&&(i="string"==typeof n?_.loading(n,r):_.loading(n.render,{...r,...n}));let a={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},c=(e,t,n)=>{if(null==t)return void _.dismiss(i);let s={type:e,...a,...r,data:n},o="string"==typeof t?{render:t}:t;return i?_.update(i,{...s,...o}):_(o.render,{...s,...o}),n},l="function"==typeof e?e():e;return l.then(e=>c("success",o,e)).catch(e=>c("error",s,e)),l},_.success=E("success"),_.info=E("info"),_.error=E("error"),_.warning=E("warning"),_.warn=_.warning,_.dark=(e,t)=>v(e,x("default",{theme:"dark",...t})),_.dismiss=function(e){var t,r;h.size>0?null==e||"string"==typeof(t=e)||s(t)?h.forEach(t=>{t.removeToast(e)}):e&&("containerId"in e||"id"in e)&&((null==(r=h.get(e.containerId))?void 0:r.removeToast(e.id))||h.forEach(t=>{t.removeToast(e.id)})):u=u.filter(t=>null!=e&&t.options.toastId!==e)},_.clearWaitingQueue=function(e){void 0===e&&(e={}),h.forEach(t=>{!t.props.limit||e.containerId&&t.id!==e.containerId||t.clearQueue()})},_.isActive=p,_.update=function(e,t){void 0===t&&(t={});let r=((e,t)=>{var r;let{containerId:i}=t;return null==(r=h.get(i||1))?void 0:r.toasts.get(e)})(e,t);if(r){let{props:i,content:n}=r,s={delay:100,...i,...t,toastId:t.toastId||e,updateId:w()};s.toastId!==e&&(s.staleId=e);let o=s.render||n;delete s.render,v(o,s)}},_.done=e=>{_.update(e,{progress:1})},_.onChange=function(e){return d.add(e),()=>{d.delete(e)}},_.play=e=>m(!0,e),_.pause=e=>m(!1,e);let I="undefined"!=typeof window?i.useLayoutEffect:i.useEffect,A=e=>{let{theme:t,type:r,isLoading:n,...s}=e;return i.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===t?"currentColor":"var(--toastify-icon-color-".concat(r,")"),...s})},S={info:function(e){return i.createElement(A,{...e},i.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return i.createElement(A,{...e},i.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return i.createElement(A,{...e},i.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return i.createElement(A,{...e},i.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return i.createElement("div",{className:"Toastify__spinner"})}},C=e=>{let{isRunning:t,preventExitTransition:r,toastRef:s,eventHandlers:o,playToast:a}=function(e){var t,r;let[n,s]=(0,i.useState)(!1),[o,a]=(0,i.useState)(!1),c=(0,i.useRef)(null),l=(0,i.useRef)({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:u,pauseOnHover:d,closeToast:f,onClick:p,closeOnClick:g}=e;function m(){s(!0)}function y(){s(!1)}function b(t){let r=c.current;l.canDrag&&r&&(l.didMove=!0,n&&y(),l.delta="x"===e.draggableDirection?t.clientX-l.start:t.clientY-l.start,l.start!==t.clientX&&(l.canCloseOnClick=!1),r.style.transform="translate3d(".concat("x"===e.draggableDirection?"".concat(l.delta,"px, var(--y)"):"0, calc(".concat(l.delta,"px + var(--y))"),",0)"),r.style.opacity=""+(1-Math.abs(l.delta/l.removalDistance)))}function w(){document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",w);let t=c.current;if(l.canDrag&&l.didMove&&t){if(l.canDrag=!1,Math.abs(l.delta)>l.removalDistance)return a(!0),e.closeToast(),void e.collapseAll();t.style.transition="transform 0.2s, opacity 0.2s",t.style.removeProperty("transform"),t.style.removeProperty("opacity")}}null==(r=h.get((t={id:e.toastId,containerId:e.containerId,fn:s}).containerId||1))||r.setToggle(t.id,t.fn),(0,i.useEffect)(()=>
1400{if(e.pauseOnFocusLoss)return document.hasFocus()||y(),window.addEventListener("focus",m),window.addEventListener("blur",y),()=>{window.removeEventListener("focus",m),window.removeEventListener("blur",y)}},[e.pauseOnFocusLoss]);let v={onPointerDown:function(t){if(!0===e.draggable||e.draggable===t.pointerType){l.didMove=!1,document.addEventListener("pointermove",b),document.addEventListener("pointerup",w);let r=c.current;l.canCloseOnClick=!0,l.canDrag=!0,r.style.transition="none","x"===e.draggableDirection?(l.start=t.clientX,l.removalDistance=r.offsetWidth*(e.draggablePercent/100)):(l.start=t.clientY,l.removalDistance=r.offsetHeight*(80===e.draggablePercent?1.5*e.draggablePercent:e.draggablePercent)/100)}},onPointerUp:function(t){let{top:r,bottom:i,left:n,right:s}=c.current.getBoundingClientRect();"touchend"!==t.nativeEvent.type&&e.pauseOnHover&&t.clientX>=n&&t.clientX<=s&&t.clientY>=r&&t.clientY<=i?y():m()}};return u&&d&&(v.onMouseEnter=y,e.stacked||(v.onMouseLeave=m)),g&&(v.onClick=e=>{p&&p(e),l.canCloseOnClick&&f()}),{playToast:m,pauseToast:y,isRunning:n,preventExitTransition:o,toastRef:c,eventHandlers:v}}(e),{closeButton:c,children:l,autoClose:u,onClick:d,type:f,hideProgressBar:p,closeToast:g,transition:m,position:b,className:w,style:v,bodyClassName:x,bodyStyle:E,progressClassName:_,progressStyle:I,updateId:A,role:C,progress:N,rtl:O,toastId:P,deleteToast:T,isIn:M,isLoading:R,closeOnClick:k,theme:D}=e,L=n("Toastify__toast","Toastify__toast-theme--".concat(D),"Toastify__toast--".concat(f),{"Toastify__toast--rtl":O},{"Toastify__toast--close-on-click":k}),U="function"==typeof w?w({rtl:O,position:b,type:f,defaultClassName:L}):n(L,w),B=function(e){let{theme:t,type:r,isLoading:n,icon:s}=e,o=null,a={theme:t,type:r};return!1===s||("function"==typeof s?o=s({...a,isLoading:n}):(0,i.isValidElement)(s)?o=(0,i.cloneElement)(s,a):n?o=S.spinner():r in S&&(o=S[r](a))),o}(e),j=!!N||!u,$={closeToast:g,type:f,theme:D},z=null;return!1===c||(z="function"==typeof c?c($):(0,i.isValidElement)(c)?(0,i.cloneElement)(c,$):function(e){let{closeToast:t,theme:r,ariaLabel:n="close"}=e;return i.createElement("button",{className:"Toastify__close-button Toastify__close-button--".concat(r),type:"button",onClick:e=>{e.stopPropagation(),t(e)},"aria-label":n},i.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},i.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}($)),i.createElement(m,{isIn:M,done:T,position:b,preventExitTransition:r,nodeRef:s,playToast:a},i.createElement("div",{id:P,onClick:d,"data-in":M,className:U,...o,style:v,ref:s},i.createElement("div",{...M&&{role:C},className:"function"==typeof x?x({type:f}):n("Toastify__toast-body",x),style:E},null!=B&&i.createElement("div",{className:n("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!R})},B),i.createElement("div",null,l)),z,i.createElement(y,{...A&&!j?{key:"pb-".concat(A)}:{},rtl:O,theme:D,delay:u,isRunning:t,isIn:M,closeToast:g,hide:p,type:f,style:I,className:_,controlledProgress:j,progress:N||0})))}
1400,N=function(e,t){return void 0===t&&(t=!1),{enter:"Toastify--animate Toastify__".concat(e,"-enter"),exit:"Toastify--animate Toastify__".concat(e,"-exit"),appendPosition:t}},O=c(N("bounce",!0)),P=(c(N("slide",!0)),c(N("zoom")),c(N("flip")),{position:"top-right",transition:O,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"});function T(e){let t={...P,...e},r=e.stacked,[c,d]=(0,i.useState)(!0),m=(0,i.useRef)(null),{getToastToRender:y,isToastActive:b,count:w}=function(e){let{subscribe:t,getSnapshot:r,setProps:n}=(0,i.useRef)(function(e){let t=e.containerId||1;return{subscribe(r){let n=function(e,t,r){let n=1,c=0,h=[],u=[],d=[],f=t,p=new Map,g=new Set,m=()=>{d=Array.from(p.values()),g.forEach(e=>e())},y=e=>{u=null==e?[]:u.filter(t=>t!==e),m()},b=e=>{let{toastId:t,onOpen:n,updateId:s,children:o}=e.props,a=null==s;e.staleId&&p.delete(e.staleId),p.set(t,e),u=[...u,e.props.toastId].filter(t=>t!==e.staleId),m(),r(l(e,a?"added":"updated")),a&&"function"==typeof n&&n((0,i.isValidElement)(o)&&o.props)};return{id:e,props:f,observe:e=>(g.add(e),()=>g.delete(e)),toggle:(e,t)=>{p.forEach(r=>{null!=t&&t!==r.props.toastId||"function"==typeof r.toggle&&r.toggle(e)})},removeToast:y,toasts:p,clearQueue:()=>{c-=h.length,h=[]},buildToast:(t,u)=>{var d,g;if((t=>{let{containerId:r,toastId:i,updateId:n}=t,s=p.has(i)&&null==n;return(r?r!==e:1!==e)||s})(u))return;let{toastId:w,updateId:v,data:x,staleId:E,delay:_}=u,I=()=>{y(w)},A=null==v;A&&c++;let S={...f,style:f.toastStyle,key:n++,...Object.fromEntries(Object.entries(u).filter(e=>{let[t,r]=e;return null!=r})),toastId:w,updateId:v,data:x,closeToast:I,isIn:!1,className:o(u.className||f.toastClassName),bodyClassName:o(u.bodyClassName||f.bodyClassName),progressClassName:o(u.progressClassName||f.progressClassName),autoClose:!u.isLoading&&(d=u.autoClose,g=f.autoClose,!1===d||s(d)&&d>0?d:g),deleteToast(){let e=p.get(w),{onClose:t,children:n}=e.props;"function"==typeof t&&t((0,i.isValidElement)(n)&&n.props),r(l(e,"removed")),p.delete(w),--c<0&&(c=0),h.length>0?b(h.shift()):m()}};S.closeButton=f.closeButton,!1===u.closeButton||a(u.closeButton)?S.closeButton=u.closeButton:!0===u.closeButton&&(S.closeButton=!a(f.closeButton)||f.closeButton);let C=t;(0,i.isValidElement)(t)&&"string"!=typeof t.type?C=(0,i.cloneElement)(t,{closeToast:I,toastProps:S,data:x}):"function"==typeof t&&(C=t({closeToast:I,toastProps:S,data:x}));let N={content:C,props:S,staleId:E};f.limit&&f.limit>0&&c>f.limit&&A?h.push(N):s(_)?setTimeout(()=>{b(N)},_):b(N)},setProps(e){f=e},setToggle:(e,t)=>{p.get(e).toggle=t},isToastActive:e=>u.some(t=>t===e),getSnapshot:()=>f.newestOnTop?d.reverse():d}}(t,e,f);h.set(t,n);let c=n.observe(r);return u.forEach(e=>g(e.content,e.options)),u=[],()=>{c(),h.delete(t)}},setProps(e){var r;null==(r=h.get(t))||r.setProps(e)},getSnapshot(){var e;return null==(e=h.get(t))?void 0:e.getSnapshot()}}}(e)).current;n(e);let c=(0,i.useSyncExternalStore)(t,r,r);return{getToastToRender:function(e){if(!c)return[];let t=new Map;return c.forEach(e=>{let{position:r}=e.props;t.has(r)||t.set(r,[]),t.get(r).push(e)}),Array.from(t,t=>e(t[0],t[1]))},isToastActive:p,count:null==c?void 0:c.length}}(t),{className:v,style:x,rtl:E,containerId:A}=t;function S(){r&&(d(!0),_.play())}return I(()=>{if(r){var e;let r=m.current.querySelectorAll('[data-in="true"]'),i=null==(e=t.position)?void 0:e.includes("top"),n=0,s=0;Array.from(r).reverse().forEach((e,t)=>{e.classList.add("Toastify__toast--stacked"),t>0&&(e.dataset.collapsed="".concat(c)),e.dataset.pos||(e.dataset.pos=i?"top":"bot");let r=n*(c?.2:1)+(c?0:12*t);e.style.setProperty("--y","".concat(i?r:-1*r,"px")),e.style.setProperty("--g","".concat(12)),e.style.setProperty("--s",""+(1-(c?s:0))),n+=e.offsetHeight,s+=.025})}},[c,w,r]),i.createElement("div",{ref:m,className:"Toastify",id:A,onMouseEnter:()=>{r&&(d(!1),_.pause())},onMouseLeave:S},y((e,t)=>{let s=t.length?{...x}:{...x,pointerEvents:"none"};return i.createElement("div",{className:function(e){let t=n("Toastify__toast-container","Toastify__toast-container--".concat(e),{"Toastify__toast-container--rtl":E});return"function"==typeof v?v({position:e,rtl:E,defaultClassName:t}):n(t,o(v))}(e),style:s,key:"container-".concat(e)},t.map(e=>{let{content:t,props:n}=e;return i.createElement(C,{...n,stacked:r,collapseAll:S,isIn:b(n.toastId,n.containerId),style:n.style,key:"toast-".concat(n.key)},t)}))}))}},87012:(e,t,r)=>{"use strict";r.d(t,{c:()=>c});var i=r(45669),n=r(51470),s=r(36452),o=r(51901),a=r(25223);class c extends i.DE{constructor(e={}){super(),this.name="Phantom",this.url="https://phantom.app",this.icon="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDgiIGhlaWdodD0iMTA4IiB2aWV3Qm94PSIwIDAgMTA4IDEwOCIgZmlsbD0ibm9uZSI+CjxyZWN0IHdpZHRoPSIxMDgiIGhlaWdodD0iMTA4IiByeD0iMjYiIGZpbGw9IiNBQjlGRjIiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00Ni41MjY3IDY5LjkyMjlDNDIuMDA1NCA3Ni44NTA5IDM0LjQyOTIgODUuNjE4MiAyNC4zNDggODUuNjE4MkMxOS41ODI0IDg1LjYxODIgMTUgODMuNjU2MyAxNSA3NS4xMzQyQzE1IDUzLjQzMDUgNDQuNjMyNiAxOS44MzI3IDcyLjEyNjggMTkuODMyN0M4Ny43NjggMTkuODMyNyA5NCAzMC42ODQ2IDk0IDQzLjAwNzlDOTQgNTguODI1OCA4My43MzU1IDc2LjkxMjIgNzMuNTMyMSA3Ni45MTIyQzcwLjI5MzkgNzYuOTEyMiA2OC43MDUzIDc1LjEzNDIgNjguNzA1MyA3Mi4zMTRDNjguNzA1MyA3MS41NzgzIDY4LjgyNzUgNzAuNzgxMiA2OS4wNzE5IDY5LjkyMjlDNjUuNTg5MyA3NS44Njk5IDU4Ljg2ODUgODEuMzg3OCA1Mi41NzU0IDgxLjM4NzhDNDcuOTkzIDgxLjM4NzggNDUuNjcxMyA3OC41MDYzIDQ1LjY3MTMgNzQuNDU5OEM0NS42NzEzIDcyLjk4ODQgNDUuOTc2OCA3MS40NTU2IDQ2LjUyNjcgNjkuOTIyOVpNODMuNjc2MSA0Mi41Nzk0QzgzLjY3NjEgNDYuMTcwNCA4MS41NTc1IDQ3Ljk2NTggNzkuMTg3NSA0Ny45NjU4Qzc2Ljc4MTYgNDcuOTY1OCA3NC42OTg5IDQ2LjE3MDQgNzQuNjk4OSA0Mi41Nzk0Qzc0LjY5ODkgMzguOTg4NSA3Ni43ODE2IDM3LjE5MzEgNzkuMTg3NSAzNy4xOTMxQzgxLjU1NzUgMzcuMTkzMSA4My42NzYxIDM4Ljk4ODUgODMuNjc2MSA0Mi41Nzk0Wk03MC4yMTAzIDQyLjU3OTVDNzAuMjEwMyA0Ni4xNzA0IDY4LjA5MTYgNDcuOTY1OCA2NS43MjE2IDQ3Ljk2NThDNjMuMzE1NyA0Ny45NjU4IDYxLjIzMyA0Ni4xNzA0IDYxLjIzMyA0Mi41Nzk1QzYxLjIzMyAzOC45ODg1IDYzLjMxNTcgMzcuMTkzMSA2NS43MjE2IDM3LjE5MzFDNjguMDkxNiAzNy4xOTMxIDcwLjIxMDMgMzguOTg4NSA3MC4yMTAzIDQyLjU3OTVaIiBmaWxsPSIjRkZGREY4Ii8+Cjwvc3ZnPg==",this.supportedTransactionVersions=new Set(["legacy",0]),this._readyState="undefined"==typeof window||"undefined"==typeof document?n.Ok.Unsupported:n.Ok.NotDetected,this._disconnected=()=>{let e=this._wallet;e&&(e.off("disconnect",this._disconnected),e.off("accountChanged",this._accountChanged),this._wallet=null,this._publicKey=null,this.emit
1400("error",new s.PQ),this.emit("disconnect"))},this._accountChanged=e=>{let t=this._publicKey;if(t){try{e=new a.PublicKey(e.toBytes())}catch(e){this.emit("error",new s.Kd(e?.message,e));return}t.equals(e)||(this._publicKey=e,this.emit("connect",e))}},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==n.Ok.Unsupported&&((0,n.Br)()?(this._readyState=n.Ok.Loadable,this.emit("readyStateChange",this._readyState)):(0,n.qG)(()=>!!(window?.isPhantomInstalled&&(window.phantom?.solana?.isPhantom||window.solana?.isPhantom))&&(this._readyState=n.Ok.Installed,this.emit("readyStateChange",this._readyState),!0)))}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async autoConnect(){this.readyState===n.Ok.Installed&&await this.connect()}async connect(){try{let e;if(this.connected||this.connecting)return;if(this.readyState===n.Ok.Loadable){let e=encodeURIComponent(window.location.href),t=encodeURIComponent(window.location.origin);window.location.href=`https://phantom.app/ul/browse/${e}?ref=${t}`;return}if(this.readyState!==n.Ok.Installed)throw new s.AE;this._connecting=!0;let t=window.phantom?.solana||window.solana;if(!t.isConnected)try{await t.connect()}catch(e){throw new s.Y6(e?.message,e)}if(!t.publicKey)throw new s.fk;try{e=new a.PublicKey(t.publicKey.toBytes())}catch(e){throw new s.Kd(e?.message,e)}t.on("disconnect",this._disconnected),t.on("accountChanged",this._accountChanged),this._wallet=t,this._publicKey=e,this.emit("connect",e)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){let e=this._wallet;if(e){e.off("disconnect",this._disconnected),e.off("accountChanged",this._accountChanged),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(e){this.emit("error",new s.Y8(e?.message,e))}}this.emit("disconnect")}async sendTransaction(e,t,r={}){try{let i=this._wallet;if(!i)throw new s.kW;try{let{signers:n,...s}=r;(0,o.Y)(e)?n?.length&&e.sign(n):(e=await this.prepareTransaction(e,t,s),n?.length&&e.partialSign(...n)),s.preflightCommitment=s.preflightCommitment||t.commitment;let{signature:a}=await i.signAndSendTransaction(e,s);return a}catch(e){if(e instanceof s.m7)throw e;throw new s.UF(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signTransaction(e){try{let t=this._wallet;if(!t)throw new s.kW;try{return await t.signTransaction(e)||e}catch(e){throw new s.z4(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signAllTransactions(e){try{let t=this._wallet;if(!t)throw new s.kW;try{return await t.signAllTransactions(e)||e}catch(e){throw new s.z4(e?.message,e)}}catch(e){throw this.emit("error",e),e}}async signMessage(e){try{let t=this._wallet;if(!t)throw new s.kW;try{let{signature:r}=await t.signMessage(e);return r}catch(e){throw new s.K3(e?.message,e)}}catch(e){throw this.emit("error",e),e}}}},87094:(e,t,r)=>{"use strict";var i=r(98392),n=r(78239).assert;function s(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=s,s.fromPublic=function(e,t,r){return t instanceof s?t:new s(e,{pub:t,pubEnc:r})},s.fromPrivate=function(e,t,r){return t instanceof s?t:new s(e,{priv:t,privEnc:r})},s.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},s.prototype.getPublic=function(e,t){return("string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t)?this.pub.encode(t,e):this.pub},s.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},s.prototype._importPrivate=function(e,t){this.priv=new i(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},s.prototype._importPublic=function(e,t){if(e.x||e.y){"mont"===this.ec.curve.type?n(e.x,"Need x coordinate"):("short"===this.ec.curve.type||"edwards"===this.ec.curve.type)&&n(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},s.prototype.derive=function(e){return e.validate()||n(e.validate(),"public point not validated"),e.mul(this.priv).getX()},s.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},s.prototype.verify=function(e,t,r){return this.ec.verify(e,t,this,void 0,r)},s.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},87796:(e,t,r)=>{"use strict";e.exports=function(e){return!function(){var t=e.lib,r=t.WordArray,i=t.BlockCipher,n=e.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],a=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,0x10000000:32768,0x20000000:8421378,0x30000000:2,0x40000000:512,0x50000000:8421890,0x60000000:8389122,0x70000000:8388608,0x80000000:514,0x90000000:8389120,0xa0000000:33280,0xb0000000:8421376,0xc0000000:32770,0xd0000000:8388610,0xe0000000:0,0xf0000000:33282,0x8000000:0,0x18000000:8421890,0x28000000:33282,0x38000000:32768,0x48000000:8421888,0x58000000:512,0x68000000:8421378,0x78000000:2,0x88000000:8389120,0x98000000:33280,0xa8000000:8421376,0xb8000000:8389122,0xc8000000:8388610,0xd8000000:32770,0xe8000000:514,0xf8000000:8388608,1:32768,0x10000001:2,0x20000001:8421888,0x30000001:8388608,0x40000001:8421378,0x50000001:33280,0x60000001:512,0x70000001:8389122,0x80000001:8421890,0x90000001:8421376,0xa0000001:8388610,0xb0000001:33282,0xc0000001:514,0xd0000001:8389120,0xe0000001:32770,0xf0000001:0,0x8000001:8421890,0x18000001:8421376,0x28000001:8388608,0x38000001:512,0x48000001:32768,0x58000001:8388610,0x68000001:2,0x78000001:33282,0x88000001:32770,0x98000001:8389122,0xa8000001:514,0xb8000001:8421888,0xc8000001:8389120,0xd8000001:0,0xe8000001:33280,0xf8000001:8421378},{0:0x40084010,0x1000000:16384,0x2000000:524288,0x3000000:0x40080010,0x4000000:0x40000010,0x5000000:0x40084000,0x6000000:0x40004000,0x7000000:16,0x8000000:540672,0x9000000:0x40004010,0xa000000:0x40000000,0xb000000:540688,0xc000000:524304,0xd000000:0,0xe000000:16400,0xf000000:0x40080000,8388608:0x40004000,0x1800000:540688,0x2800000:16,0x3800000:0x40004010,0x4800000:0x40084010,0x5800000:0x40000000,0x6800000:524288,0x7800000:0x40080010,0x8800000:524304,0x9800000:0,0xa800000:16384,0xb800000:0x40080000,0xc800000:0x40000010,0xd800000:540672,0xe800000:0x40084000,0xf800000:16400,0x10000000:0,0x11000000:0x40080010,0x12000000:0x40004010,0x13000000:0x40084000,0x14000000:0x40080000,0x15000000:16,0x16000000:540688,0x17000000:16384,0x18000000:16400,0x19000000:524288,0x1a000000:524304,0x1b000000:0x40000010,0x1c000000:540672,0x1d000000:0x40004000,0x1e000000:0x40000000,0x1f000000:0x40084010,0x10800000:540688,0x11800000:524288,0x12800000:0x40080000,0x13800000:16384,0x14800000:0x40004000,0x15800000:0x40084010,0x16800000:16,0x17800000:0x40000000,0x18800000:0x40084000,0x19800000:0x40000010,0x1a800000:0x40004010,0x1b800000:524304,0x1c800000:0,0x1d800000:16400,0x1e800000:0x40080010,0x1f800000:540672},{0:260,1048576:0,2097152:0x4000100,3145728:65796,4194304:65540,5242880:0x4000004,6291456:0x4010104,7340032:0x4010000,8388608:0x4000000,9437184:0x4010100,0xa00000:65792,0xb00000:0x4010004,0
vendor: 7,630 bytes, line 1400
1400xc00000:0x4000104,0xd00000:65536,0xe00000:4,0xf00000:256,524288:0x4010100,1572864:0x4010004,2621440:0,3670016:0x4000100,4718592:0x4000004,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,0xa80000:0x4010000,0xb80000:65796,0xc80000:65792,0xd80000:0x4000104,0xe80000:0x4010104,0xf80000:0x4000000,0x1000000:0x4010100,0x1100000:65540,0x1200000:65536,0x1300000:0x4000100,0x1400000:256,0x1500000:0x4010104,0x1600000:0x4000004,0x1700000:0,0x1800000:0x4000104,0x1900000:0x4000000,0x1a00000:4,0x1b00000:65792,0x1c00000:0x4010000,0x1d00000:260,0x1e00000:65796,0x1f00000:0x4010004,0x1080000:0x4000000,0x1180000:260,0x1280000:0x4010100,0x1380000:0,0x1480000:65540,0x1580000:0x4000100,0x1680000:256,0x1780000:0x4010004,0x1880000:65536,0x1980000:0x4010104,0x1a80000:65796,0x1b80000:0x4000004,0x1c80000:0x4000104,0x1d80000:0x4010000,0x1e80000:4,0x1f80000:65792},{0:0x80401000,65536:0x80001040,131072:4198464,196608:0x80400000,262144:0,327680:4198400,393216:0x80000040,458752:4194368,524288:0x80000000,589824:4194304,655360:64,720896:0x80001000,786432:0x80400040,851968:4160,917504:4096,983040:0x80401040,32768:0x80001040,98304:64,163840:0x80400040,229376:0x80001000,294912:4198400,360448:0x80401040,425984:0,491520:0x80400000,557056:4096,622592:0x80401000,688128:4194304,753664:4160,819200:0x80000000,884736:4194368,950272:4198464,1015808:0x80000040,1048576:4194368,1114112:4198400,1179648:0x80000040,1245184:0,1310720:4160,1376256:0x80400040,1441792:0x80401000,1507328:0x80001040,1572864:0x80401040,1638400:0x80000000,1703936:0x80400000,1769472:4198464,1835008:0x80001000,1900544:4194304,1966080:64,2031616:4096,1081344:0x80400000,1146880:0x80401040,1212416:0,1277952:4198400,1343488:4194368,1409024:0x80000000,1474560:0x80001040,1540096:64,1605632:0x80000040,1671168:4096,1736704:0x80001000,1802240:0x80400040,1867776:4160,1933312:0x80401000,1998848:4194304,2064384:4198464},{0:128,4096:0x1040000,8192:262144,12288:0x20000000,16384:0x20040080,20480:0x1000080,24576:0x21000080,28672:262272,32768:0x1000000,36864:0x20040000,40960:0x20000080,45056:0x21040080,49152:0x21040000,53248:0,57344:0x1040080,61440:0x21000000,2048:0x1040080,6144:0x21000080,10240:128,14336:0x1040000,18432:262144,22528:0x20040080,26624:0x21040000,30720:0x20000000,34816:0x20040000,38912:0,43008:0x21040080,47104:0x1000080,51200:0x20000080,55296:0x21000000,59392:0x1000000,63488:262272,65536:262144,69632:128,73728:0x20000000,77824:0x21000080,81920:0x1000080,86016:0x21040000,90112:0x20040080,94208:0x1000000,98304:0x21040080,102400:0x21000000,106496:0x1040000,110592:0x20040000,114688:262272,118784:0x20000080,122880:0,126976:0x1040080,67584:0x21000080,71680:0x1000000,75776:0x1040000,79872:0x20040080,83968:0x20000000,88064:0x1040080,92160:128,96256:0x21040000,100352:262272,104448:0x21040080,108544:0,112640:0x21000000,116736:0x1000080,120832:262144,124928:0x20040000,129024:0x20000080},{0:0x10000008,256:8192,512:0x10200000,768:0x10202008,1024:0x10002000,1280:2097152,1536:2097160,1792:0x10000000,2048:0,2304:0x10002008,2560:2105344,2816:8,3072:0x10200008,3328:2105352,3584:8200,3840:0x10202000,128:0x10200000,384:0x10202008,640:8,896:2097152,1152:2105352,1408:0x10000008,1664:0x10002000,1920:8200,2176:2097160,2432:8192,2688:0x10002008,2944:0x10200008,3200:0,3456:0x10202000,3712:2105344,3968:0x10000000,4096:0x10002000,4352:0x10200008,4608:0x10202008,4864:8200,5120:2097152,5376:0x10000000,5632:0x10000008,5888:2105344,6144:2105352,6400:0,6656:8,6912:0x10200000,7168:8192,7424:0x10002008,7680:0x10202000,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:0x10000008,5248:0x10002000,5504:8200,5760:0x10202008,6016:0x10200000,6272:0x10202000,6528:0x10200008,6784:8192,7040:2105352,7296:2097160,7552:0,7808:0x10000000,8064:0x10002008},{0:1048576,16:0x2000401,32:1024,48:1049601,64:0x2100401,80:0,96:1,112:0x2100001,128:0x2000400,144:1048577,160:0x2000001,176:0x2100400,192:0x2100000,208:1025,224:1049600,240:0x2000000,8:0x2100001,24:0,40:0x2000401,56:0x2100400,72:1048576,88:0x2000001,104:0x2000000,120:1025,136:1049601,152:0x2000400,168:0x2100000,184:1048577,200:1024,216:0x2100401,232:1,248:1049600,256:0x2000000,272:1048576,288:0x2000401,304:0x2100001,320:1048577,336:0x2000400,352:0x2100400,368:1049601,384:1025,400:0x2100401,416:1049600,432:1,448:0,464:0x2100000,480:0x2000001,496:1024,264:1049600,280:0x2000401,296:0x2100001,312:1,328:0x2000000,344:1048576,360:1025,376:0x2100400,392:0x2000001,408:0x2100000,424:0,440:0x2100401,456:1049601,472:1024,488:0x2000400,504:1048577},{0:0x8000820,1:131072,2:0x8000000,3:32,4:131104,5:0x8020820,6:0x8020800,7:2048,8:0x8020000,9:0x8000800,10:133120,11:0x8020020,12:2080,13:0,14:0x8000020,15:133152,0x80000000:2048,0x80000001:0x8020820,0x80000002:0x8000820,0x80000003:0x8000000,0x80000004:0x8020000,0x80000005:133120,0x80000006:133152,0x80000007:32,0x80000008:0x8000020,0x80000009:2080,0x8000000a:131104,0x8000000b:0x8020800,0x8000000c:0,0x8000000d:0x8020020,0x8000000e:0x8000800,0x8000000f:131072,16:133152,17:0x8020800,18:32,19:2048,20:0x8000800,21:0x8000020,22:0x8020020,23:131072,24:0,25:131104,26:0x8020000,27:0x8000820,28:0x8020820,29:133120,30:2080,31:0x8000000,0x80000010:131072,0x80000011:2048,0x80000012:0x8020020,0x80000013:133152,0x80000014:32,0x80000015:0x8020000,0x80000016:0x8000000,0x80000017:0x8000820,0x80000018:0x8020820,0x80000019:0x8000020,0x8000001a:0x8000800,0x8000001b:0,0x8000001c:133120,0x8000001d:2080,0x8000001e:131104,0x8000001f:0x8020800}],l=[0xf8000001,0x1f800000,0x1f80000,2064384,129024,8064,504,0x8000001f],h=n.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=s[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],c=0;c<16;c++){for(var l=n[c]=[],h=a[c],r=0;r<24;r++)l[r/6|0]|=t[(o[r]-1+h)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(o[r+24]-1+h)%28]<<31-r%6;l[0]=l[0]<<1|l[0]>>>31;for(var r=1;r<7;r++)l[r]=l[r]>>>(r-1)*4+3;l[7]=l[7]<<5|l[7]>>>27}for(var u=this._invSubKeys=[],r=0;r<16;r++)u[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],u.call(this,4,0xf0f0f0f),u.call(this,16,65535),d.call(this,2,0x33333333),d.call(this,8,0xff00ff),u.call(this,1,0x55555555);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,o=this._rBlock,a=0,h=0;h<8;h++)a|=c[h][((o^n[h])&l[h])>>>0];this._lBlock=o,this._rBlock=s^a}var f=this._lBlock;this._lBlock=this._rBlock,this._rBlock=f,u.call(this,1,0x55555555),d.call(this,8,0xff00ff),d.call(this,2,0x33333333),u.call(this,16,65535),u.call(this,4,0xf0f0f0f),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function u(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function d(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}e.DES=i._createHelper(h);var f=n.TripleDES=i.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),i=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=h.createEncryptor(r.create(t)),this._des2=h.createEncryptor(r.create(i)),this._des3=h.createEncryptor(r.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=i._createHelper(f)}(),e.TripleDES}(r(16611),r(9956),r(11816),r(93524),r(99229))},87822:(e,t,r)=>{"use strict";
1400Object.defineProperty(t,"__esModule",{value:!0});let i=r(11870);i.__exportStar(r(64663),t),i.__exportStar(r(91609),t)},88072:e=>{"use strict";var t={single_source_shortest_paths:function(e,r,i){var n,s,o,a,c,l,h,u={},d={};d[r]=0;var f=t.PriorityQueue.make();for(f.push(r,0);!f.empty();)for(o in s=(n=f.pop()).value,a=n.cost,c=e[s]||{})c.hasOwnProperty(o)&&(l=a+c[o],h=d[o],(void 0===d[o]||h>l)&&(d[o]=l,f.push(o,l),u[o]=s));if(void 0!==i&&void 0===d[i])throw Error("Could not find a path from "+r+" to "+i+".");return u},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],i=t;i;)r.push(i),e[i],i=e[i];return r.reverse(),r},find_path:function(e,r,i){var n=t.single_source_shortest_paths(e,r,i);return t.extract_shortest_path_from_predecessor_list(n,i)},PriorityQueue:{make:function(e){var r,i=t.PriorityQueue,n={};for(r in e=e||{},i)i.hasOwnProperty(r)&&(n[r]=i[r]);return n.queue=[],n.sorter=e.sorter||i.default_sorter,n},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){this.queue.push({value:e,cost:t}),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t},88097:(e,t,r)=>{"use strict";let i;r.d(t,{x:()=>E});var n=r(70524),s=r(98866),o=r(12319),a=r(67243),c=r(58653),l=r(67695),h=r(66254),u=r(70417),d=r(81701),f=r(67869),p=r(73537),g=r(58051),m=r(44826),y=r(55480),b=r(65374);let w=(0,n.BX)({transactions:[],coinbaseTransactions:{},transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),v={state:w,subscribe:e=>(0,n.B1)(w,()=>e(w)),setLastNetworkInView(e){w.lastNetworkInView=e},async fetchTransactions(e,t){if(!e)throw Error("Transactions can't be fetched without an accountAddress");w.loading=!0;try{let r=await m.T.fetchTransactions({account:e,cursor:w.next,onramp:t,cache:"coinbase"===t?"no-cache":void 0,chainId:l.W.state.activeCaipNetwork?.caipNetworkId}),i=this.filterSpamTransactions(r.data),n=this.filterByConnectedChain(i),s=[...w.transactions,...n];w.loading=!1,"coinbase"===t?w.coinbaseTransactions=this.groupTransactionsByYearAndMonth(w.coinbaseTransactions,r.data):(w.transactions=s,w.transactionsByYear=this.groupTransactionsByYearAndMonth(w.transactionsByYear,n)),w.empty=0===s.length,w.next=r.next?r.next:void 0}catch(t){u.E.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:e,projectId:y.H.state.projectId,cursor:w.next,isSmartAccount:g.U.state.preferredAccountType===p.Vl.ACCOUNT_TYPES.SMART_ACCOUNT}}),b.P.showError("Failed to fetch transactions"),w.loading=!1,w.empty=!0,w.next=void 0}},groupTransactionsByYearAndMonth:(e={},t=[])=>(t.forEach(t=>{let r=new Date(t.metadata.minedAt).getFullYear(),i=new Date(t.metadata.minedAt).getMonth(),n=e[r]??{},s=(n[i]??[]).filter(e=>e.id!==t.id);e[r]={...n,[i]:[...s,t].sort((e,t)=>new Date(t.metadata.minedAt).getTime()-new Date(e.metadata.minedAt).getTime())}}),e),filterSpamTransactions:e=>e.filter(e=>!e.transfers.every(e=>e.nft_info?.flags.is_spam===!0)),filterByConnectedChain(e){let t=l.W.state.activeCaipNetwork?.caipNetworkId;return e.filter(e=>e.metadata.chain===t)},clearCursor(){w.next=void 0},resetTransactions(){w.transactions=[],w.transactionsByYear={},w.lastNetworkInView=void 0,w.loading=!1,w.empty=!1,w.next=void 0}},x=(0,n.BX)({wcError:!1,buffering:!1,status:"disconnected"}),E={state:x,subscribeKey:(e,t)=>(0,s.u$)(x,e,t),_getClient:()=>x._client,setClient(e){x._client=(0,n.KR)(e)},async connectWalletConnect(){if(o.w.isTelegram()||o.w.isSafari()&&o.w.isIos()){if(i){await i,i=void 0;return}if(!o.w.isPairingExpired(x?.wcPairingExpiry)){let e=x.wcUri;x.wcUri=e;return}i=this._getClient()?.connectWalletConnect?.().catch(()=>void 0),this.state.status="connecting",await i,i=void 0,x.wcPairingExpiry=void 0,this.state.status="connected"}else await this._getClient()?.connectWalletConnect?.()},async connectExternal(e,t,r=!0){await this._getClient()?.connectExternal?.(e),r&&l.W.setActiveNamespace(t)},async reconnectExternal(e){await this._getClient()?.reconnectExternal?.(e);let t=e.chain||l.W.state.activeChain;t&&h.a.setConnectorId(e.id,t)},async setPreferredAccountType(e){d.W.setLoading(!0,l.W.state.activeChain);let t=h.a.getAuthConnector();t&&(await t?.provider.setPreferredAccount(e),await this.reconnectExternal(t),d.W.setLoading(!1,l.W.state.activeChain),u.E.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:e,network:l.W.state.activeCaipNetwork?.caipNetworkId||""}}))},async signMessage(e){return this._getClient()?.signMessage(e)},parseUnits(e,t){return this._getClient()?.parseUnits(e,t)},formatUnits(e,t){return this._getClient()?.formatUnits(e,t)},async sendTransaction(e){return this._getClient()?.sendTransaction(e)},async getCapabilities(e){return this._getClient()?.getCapabilities(e)},async grantPermissions(e){return this._getClient()?.grantPermissions(e)},async walletGetAssets(e){return this._getClient()?.walletGetAssets(e)??{}},async estimateGas(e){return this._getClient()?.estimateGas(e)},async writeContract(e){return this._getClient()?.writeContract(e)},async getEnsAddress(e){return this._getClient()?.getEnsAddress(e)},async getEnsAvatar(e){return this._getClient()?.getEnsAvatar(e)},checkInstalled(e){return this._getClient()?.checkInstalled?.(e)||!1},resetWcConnection(){x.wcUri=void 0,x.wcPairingExpiry=void 0,x.wcLinking=void 0,x.recentWallet=void 0,x.status="disconnected",v.resetTransactions(),c.i.deleteWalletConnectDeepLink()},resetUri(){x.wcUri=void 0,x.wcPairingExpiry=void 0},finalizeWcConnection(){let{wcLinking:e,recentWallet:t}=E.state;e&&c.i.setWalletConnectDeepLink(e),t&&c.i.setAppKitRecent(t),u.E.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:e?"mobile":"qrcode",name:f.I.state.data?.wallet?.name||"Unknown"}})},setWcBasic(e){x.wcBasic=e},setUri(e){x.wcUri=e,x.wcPairingExpiry=o.w.getPairingExpiry()},setWcLinking(e){x.wcLinking=e},setWcError(e){x.wcError=e,x.buffering=!1},setRecentWallet(e){x.recentWallet=e},setBuffering(e){x.buffering=e},setStatus(e){x.status=e},async disconnect(e){try{d.W.setLoading(!0,e),await a.U.clearSessions(),await l.W.disconnect(e),d.W.setLoading(!1,e),h.a.setFilterByNamespace(void 0)}catch(e){throw Error("Failed to disconnect")}}}},88759:e=>{"use strict";function t(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}e.exports=function(e,r,i){var n=i&&i.stringify||t;if("object"==typeof e&&null!==e){var s=r.length+1;if(1===s)return e;var o=Array(s);o[0]=n(e);for(var a=1;a<s;a++)o[a]=n(r[a]);return o.join(" ")}if("string"!=typeof e)return e;var c=r.length;if(0===c)return e;for(var l="",h=0,u=-1,d=e&&e.length||0,f=0;f<d;){if(37===e.charCodeAt(f)&&f+1<d){switch(u=u>-1?u:0,e.charCodeAt(f+1)){case 100:case 102:if(h>=c||null==r[h])break;u<f&&(l+=e.slice(u,f)),l+=Number(r[h]),u=f+2,f++;break;case 105:if(h>=c||null==r[h])break;u<f&&(l+=e.slice(u,f)),l+=Math.floor(Number(r[h])),u=f+2,f++;break;case 79:case 111:case 106:if(h>=c||void 0===r[h])break;u<f&&(l+=e.slice(u,f));var p=typeof r[h];if("string"===p){l+="'"+r[h]+"'",u=f+2,f++;break}if("function"===p){l+=r[h].name||"<anonymous>",u=f+2,f++;break}l+=n(r[h]),u=f+2,f++;break;case 115:if(h>=c)break;u<f&&(l+=e.slice(u,f)),l+=String(r[h]),u=f+2,f++;break;case 37:u<f&&(l+=e.slice(u,f)),l+="%",u=f+2,f++,h--}++h}++f}return -1===u?e:(u<d&&(l+=e.slice(u)),l)}},88790:(e,t,r)=>{"use strict";let i=r(32774).v4,n=r(65927),s=function(e,t){if(!(this instanceof s))return new s(e,t);t||(t={}),this.options={reviver:void 0!==t.reviver?t.reviver:null,replacer:void 0!==t.replacer?t.replacer:null,generator:void 0!==t.generator?t.generator:function(){return i()},version:void 0!==t.version?t.version:2,notificationIdNull:"boolean"==typeof t.notificationIdNull&&t.notificationIdNull},this.callServer=e};e.exports=s,s.prototype.request=function(e,t,r,i){let s,o=this,a=null,c=Array.isArray(e)&&"function"==typeof t;if(1===this.options.version&&c)throw TypeError("JSON-RPC 1.0 does not support batching");let l=!c&&e&&"object"==typeof e&&"function"==typeof t;if(c||l)i=t,a=e;else{"function"==typeof r&&(i=r,r=void 0);let s="function"==typeof i;try{a=n(e,t,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(e){if(s)return void i(e);throw e}if(!s)return a}try{s=JSON.stringify(a,this.options.replacer)}catch(e){i(e);return}return this.callServer(s,function(e,t){o._parseResponse(e,t,i)}),a},s.prototype._parseResponse=function(e,t,r){let i;if(e)return void r(e);if(!t)return void r();try{i=JSON.parse(t,this.options.reviver)}catch(e){r(e);return}if(3===r.length)if(!Array.isArray(i))return void r(null,i.error,
1400i.result);else{let e=function(e){return void 0!==e.error};r(null,i.filter(e),i.filter(function(t){return!e(t)}));return}r(null,i)}},88857:(e,t,r)=>{e.exports=r(83538)("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},88885:(e,t,r)=>{"use strict";r.d(t,{kb:()=>o,vE:()=>c});var i=r(81029),n=r(68463),s=class extends n.b{socket;constructor(e,t){super(),this.socket=new window.WebSocket(e,t.protocols),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=e=>this.emit("message",e.data),this.socket.onerror=e=>this.emit("error",e),this.socket.onclose=e=>{this.emit("close",e.code,e.reason)}}send(e,t,r){let i=r||t;try{this.socket.send(e),i()}catch(e){i(e)}}close(e,t){this.socket.close(e,t)}addEventListener(e,t,r){this.socket.addEventListener(e,t,r)}};function o(e,t){return new s(e,t)}var a=class{encode(e){return JSON.stringify(e)}decode(e){return JSON.parse(e)}},c=class extends n.b{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(e,t="ws://localhost:8080",{autoconnect:r=!0,reconnect:i=!0,reconnect_interval:n=1e3,max_reconnects:s=5,...o}={},c,l){super(),this.webSocketFactory=e,this.queue={},this.rpc_id=0,this.address=t,this.autoconnect=r,this.ready=!1,this.reconnect=i,this.reconnect_timer_id=void 0,this.reconnect_interval=n,this.max_reconnects=s,this.rest_options=o,this.current_reconnects=0,this.generate_request_id=c||(()=>"number"==typeof this.rpc_id?++this.rpc_id:Number(this.rpc_id)+1),l?this.dataPack=l:this.dataPack=new a,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}
vendor: 2,830 bytes, line 1400
1400call(e,t,r,i){return i||"object"!=typeof r||(i=r,r=null),new Promise((n,s)=>{if(!this.ready)return s(Error("socket not ready"));let o=this.generate_request_id(e,t);this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:e,params:t||void 0,id:o}),i,e=>{if(e)return s(e);this.queue[o]={promise:[n,s]},r&&(this.queue[o].timeout=setTimeout(()=>{delete this.queue[o],s(Error("reply timeout"))},r))})})}async login(e){let t=await this.call("rpc.login",e);if(!t)throw Error("authentication failed");return t}async listMethods(){return await this.call("__listMethods")}notify(e,t){return new Promise((r,i)=>{if(!this.ready)return i(Error("socket not ready"));this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:e,params:t}),e=>{if(e)return i(e);r()})})}async subscribe(e){"string"==typeof e&&(e=[e]);let t=await this.call("rpc.on",e);if("string"==typeof e&&"ok"!==t[e])throw Error("Failed subscribing to an event '"+e+"' with: "+t[e]);return t}async unsubscribe(e){"string"==typeof e&&(e=[e]);let t=await this.call("rpc.off",e);if("string"==typeof e&&"ok"!==t[e])throw Error("Failed unsubscribing from an event with: "+t);return t}close(e,t){this.socket&&this.socket.close(e||1e3,t)}setAutoReconnect(e){this.reconnect=e}setReconnectInterval(e){this.reconnect_interval=e}setMaxReconnects(e){this.max_reconnects=e}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return void 0!==this.reconnect_timer_id}willReconnect(){return this.reconnect&&(0===this.max_reconnects||this.current_reconnects<this.max_reconnects)}_connect(e,t){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(e,t),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:e})=>{e instanceof ArrayBuffer&&(e=i.Buffer.from(e).toString());try{e=this.dataPack.decode(e)}catch(e){return}if(e.notification&&this.listeners(e.notification).length){if(!Object.keys(e.params).length)return this.emit(e.notification);let t=[e.notification];if(e.params.constructor===Object)t.push(e.params);else for(let r=0;r<e.params.length;r++)t.push(e.params[r]);return Promise.resolve().then(()=>{this.emit.apply(this,t)})}if(!this.queue[e.id])return e.method?Promise.resolve().then(()=>{this.emit(e.method,e?.params)}):void 0;"error"in e=="result"in e&&this.queue[e.id].promise[1](Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[e.id].timeout&&clearTimeout(this.queue[e.id].timeout),e.error?this.queue[e.id].promise[1](e.error):this.queue[e.id].promise[0](e.result),delete this.queue[e.id]}),this.socket.addEventListener("error",e=>this.emit("error",e)),this.socket.addEventListener("close",({code:r,reason:i})=>{this.ready&&setTimeout(()=>
1400this.emit("close",r,i),0),this.ready=!1,this.socket=void 0,1e3!==r&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||0===this.max_reconnects)?this.reconnect_timer_id=setTimeout(()=>this._connect(e,t),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",r,i),1))})}}},88955:(e,t,r)=>{"use strict";t.g=void 0;let i=r(26662);t.g=function(){let e,t,r;try{e=i.getDocumentOrThrow(),t=i.getLocationOrThrow()}catch(e){return null}function n(...t){let r=e.getElementsByTagName("meta");for(let e=0;e<r.length;e++){let i=r[e],n=["itemprop","property","name"].map(e=>i.getAttribute(e)).filter(e=>!!e&&t.includes(e));if(n.length&&n){let e=i.getAttribute("content");if(e)return e}}return""}let s=((r=n("name","og:site_name","og:title","twitter:title"))||(r=e.title),r),o=n("description","og:description","twitter:description","keywords"),a=t.origin;return{description:o,url:a,icons:function(){let r=e.getElementsByTagName("link"),i=[];for(let e=0;e<r.length;e++){let n=r[e],s=n.getAttribute("rel");if(s&&s.toLowerCase().indexOf("icon")>-1){let e=n.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else{let i=t.pathname.split("/");i.pop(),r+=i.join("/")+"/"+e}i.push(r)}else if(0===e.indexOf("//")){let r=t.protocol+e;i.push(r)}else i.push(e)}}return i}(),name:s}}},89158:(e,t,r)=>{let i=r(29762),n=r(53896);t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(e,t){if(!e.ccBits)throw Error("Invalid mode: "+e);if(!i.isValid(t))throw Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},t.getBestModeForData=function(e){return n.testNumeric(e)?t.NUMERIC:n.testAlphanumeric(e)?t.ALPHANUMERIC:n.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(e){if(e&&e.id)return e.id;throw Error("Invalid mode")},t.isValid=function(e){return e&&e.bit&&e.ccBits},t.from=function(e,r){if(t.isValid(e))return e;try{if("string"!=typeof e)throw Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw Error("Unknown mode: "+e)}}catch(e){return r}}},89530:(e,t,r)=>{"use strict";r.d(t,{ER:()=>s,Im:()=>c,dZ:()=>l,eX:()=>o,e_:()=>a});var i=r(92153),n=r(55402);
1400function s(e=3){return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function o(e=6){return BigInt(s(e))}function a(e,t,r){return{id:r||s(),jsonrpc:"2.0",method:e,params:t}}function c(e,t){return{id:e,jsonrpc:"2.0",result:t}}function l(e,t,r){var s,o;return{id:e,jsonrpc:"2.0",error:(s=t,o=r,void 0===s?(0,i.vG)(n.zR):("string"==typeof s&&(s=Object.assign(Object.assign({},(0,i.vG)(n.fO)),{message:s})),void 0!==o&&(s.data=o),(0,i.mE)(s.code)&&(s=(0,i.rI)(s.code)),s))}}},89643:(e,t,r)=>{"use strict";e.exports=function(e){return e.pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,i=4*t,n=i-r%i,s=r+n-1;e.clamp(),e.words[s>>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923}(r(16611),r(99229))},89955:(e,t,r)=>{"use strict";e.exports=function(e){return e.pad.Iso10126={pad:function(t,r){var i=4*r,n=i-t.sigBytes%i;t.concat(e.lib.WordArray.random(n-1)).concat(e.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126}(r(16611),r(99229))},90332:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(12590).__exportStar(r(19511),t)},91074:(e,t,r)=>{"use strict";r.d(t,{CG:()=>i});let i={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}}},91609:(e,t,r)=>{"use strict";var i=r(87358);function n(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function s(){return void 0!==i&&void 0!==i.versions&&void 0!==i.versions.node}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowser=t.isNode=t.isReactNative=void 0,t.isReactNative=n,t.isNode=s,t.isBrowser=function(){return!n()&&!s()}},91791:e=>{e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},91867:(e,t,r)=>{"use strict";r.d(t,{o:()=>n});var i=r(87358);let n={ACCOUNT_TABS:[{label:"Tokens"},{label:"NFTs"},{label:"Activity"}],SECURE_SITE_ORIGIN:(void 0!==i&&void 0!==i.env?i.env.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",VIEW_DIRECTION:{Next:"next",Prev:"prev"},DEFAULT_CONNECT_METHOD_ORDER:["email","social","wallet"],ANIMATION_DURATIONS:{HeaderText:120,ModalHeight:150,ViewTransition:150}}},92153:(e,t,r)=>{"use strict";r.d(t,{eF:()=>a,mE:()=>n,rI:()=>o,vG:()=>s});var i=r(55402);function n(e){return i.jf.includes(e)}function s(e){return Object.keys(i.Uf).includes(e)?i.Uf[e]:i.Uf[i.XW]}function o(e){let t=Object.values(i.Uf).find(t=>t.code===e);return t||i.Uf[i.XW]}function a(e,t,r){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?Error(`Unavailable ${r} RPC url at ${t}`):e}},92475:(e,t,r)=>{"use strict";e.exports=function(e){return!function(t){var r=e.lib,i=r.WordArray,n=r.Hasher,s=e.algo,o=[],a=[];function c(e){return(e-(0|e))*0x100000000|0}for(var l=2,h=0;h<64;)(function(e){for(var r=t.sqrt(e),i=2;i<=r;i++)if(!(e%i))return!1;return!0})(l)&&(h<8&&(o[h]=c(t.pow(l,.5))),a[h]=c(t.pow(l,1/3)),h++),l++;var u=[],d=s.SHA256=n.extend({_doReset:function(){this._hash=new i.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],o=r[3],c=r[4],l=r[5],h=r[6],d=r[7],f=0;f<64;f++){if(f<16)u[f]=0|e[t+f];else{var p=u[f-15],g=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>
14003,m=u[f-2],y=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;u[f]=g+u[f-7]+y+u[f-16]}var b=c&l^~c&h,w=i&n^i&s^n&s,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),x=d+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+b+a[f]+u[f],E=v+w;d=h,h=l,l=c,c=o+x|0,o=s,s=n,n=i,i=x+E|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+c|0,r[5]=r[5]+l|0,r[6]=r[6]+h|0,r[7]=r[7]+d|0},_doFinalize:function(){var e=this._data,r=e.words,i=8*this._nDataBytes,n=8*e.sigBytes;return r[n>>>5]|=128<<24-n%32,r[(n+64>>>9<<4)+14]=t.floor(i/0x100000000),r[(n+64>>>9<<4)+15]=i,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA256=n._createHelper(d),e.HmacSHA256=n._createHmacHelper(d)}(Math),e.SHA256}(r(16611))},92963:(e,t,r)=>{"use strict";var i=r(98392),n=r(78239),s=n.getNAF,o=n.getJSF,a=n.assert;function c(e,t){this.type=e,this.p=new i(t.p,16),this.red=t.prime?i.red(t.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=t.n&&new i(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function l(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw Error("Not implemented")},c.prototype.validate=function(){throw Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var r,i,n=e._getDoubles(),o=s(t,1,this._bitLength),c=(1<<n.step+1)-(n.step%2==0?2:1);c/=3;var l=[];for(r=0;r<o.length;r+=n.step){i=0;for(var h=r+n.step-1;h>=r;h--)i=(i<<1)+o[h];l.push(i)}for(var u=this.jpoint(null,null,null),d=this.jpoint(null,null,null),f=c;f>0;f--){for(r=0;r<l.length;r++)(i=l[r])===f?d=d.mixedAdd(n.points[r]):i===-f&&(d=d.mixedAdd(n.points[r].neg()));u=u.add(d)}return u.toP()},c.prototype._wnafMul=function(e,t){var r=4,i=e._getNAFPoints(r);r=i.wnd;for(var n=i.points,o=s(t,r,this._bitLength),c=this.jpoint(null,null,null),l=o.length-1;l>=0;l--){for(var h=0;l>=0&&0===o[l];l--)h++;if(l>=0&&h++,c=c.dblp(h),l<0)break;var u=o[l];a(0!==u),c="affine"===e.type?u>0?c.mixedAdd(n[u-1>>1]):c.mixedAdd(n[-u-1>>1].neg()):u>0?c.add(n[u-1>>1]):c.add(n[-u-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,r,i,n){var a,c,l,h=this._wnafT1,u=this._wnafT2,d=this._wnafT3,f=0;for(a=0;a<i;a++){var p=(l=t[a])._getNAFPoints(e);h[a]=p.wnd,u[a]=p.points}for(a=i-1;a>=1;a-=2){var g=a-1,m=a;if(1!==h[g]||1!==h[m]){d[g]=s(r[g],h[g],this._bitLength),d[m]=s(r[m],h[m],this._bitLength),f=Math.max(d[g].length,f),f=Math.max(d[m].length,f);continue}var y=[t[g],null,null,t[m]];0===t[g].y.cmp(t[m].y)?(y[1]=t[g].add(t[m]),y[2]=t[g].toJ().mixedAdd(t[m].neg())):0===t[g].y.cmp(t[m].y.redNeg())?(y[1]=t[g].toJ().mixedAdd(t[m]),y[2]=t[g].add(t[m].neg())):(y[1]=t[g].toJ().mixedAdd(t[m]),y[2]=t[g].toJ().mixedAdd(t[m].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],w=o(r[g],r[m]);for(c=0,f=Math.max(w[0].length,f),d[g]=Array(f),d[m]=Array(f);c<f;c++){var v=0|w[0][c],x=0|w[1][c];d[g][c]=b[(v+1)*3+(x+1)],d[m][c]=0,u[g]=y}}var E=this.jpoint(null,null,null),_=this._wnafT4;for(a=f;a>=0;a--){for(var I=0;a>=0;){var A=!0;for(c=0;c<i;c++)_[c]=0|d[c][a],0!==_[c]&&(A=!1);if(!A)break;I++,a--}if(a>=0&&I++,E=E.dblp(I),a<0)break;for(c=0;c<i;c++){var S=_[c];0!==S&&(S>0?l=u[c][S-1>>1]:S<0&&(l=u[c][-S-1>>1].neg()),E="affine"===l.type?E.mixedAdd(l):E.add(l))}}for(a=0;a<i;a++)u[a]=null;return n?E:E.toP()},c.BasePoint=l,l.prototype.eq=function(){throw Error("Not implemented")},l.prototype.validate=function(){return this.curve.validate(this)},c.prototype.decodePoint=function(e,t){e=n.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?a(e[e.length-1]%2==0):7===e[0]&&a(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw Error("Unknown point format")},l.prototype.encodeCompressed=function(e){return this.encode(e,!0)},l.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},l.prototype.encode=function(e,t){return n.encode(this._encode(t),e)}
1400,l.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},l.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},l.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<t;n+=e){for(var s=0;s<e;s++)i=i.dbl();r.push(i)}return{step:e,points:r}},l.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,i=1===r?null:this.dbl(),n=1;n<r;n++)t[n]=t[n-1].add(i);return{wnd:e,points:t}},l.prototype._getBeta=function(){return null},l.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},93136:(e,t,r)=>{"use strict";e.exports=function(e){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,r=t.init;(t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,i=[],n=0;n<t;n++)i[n>>>2]|=e[n]<<24-n%4*8;r.call(this,i,t)}else r.apply(this,arguments)}).prototype=t}return e.lib.WordArray}(r(16611))},93142:(e,t,r)=>{"use strict";e.exports=function(e){return!function(){var t=e.lib.BlockCipher,r=e.algo;let i=[0x243f6a88,0x85a308d3,0x13198a2e,0x3707344,0xa4093822,0x299f31d0,0x82efa98,0xec4e6c89,0x452821e6,0x38d01377,0xbe5466cf,0x34e90c6c,0xc0ac29b7,0xc97c50dd,0x3f84d5b5,0xb5470917,0x9216d5d9,0x8979fb1b],n=[[0xd1310ba6,0x98dfb5ac,0x2ffd72db,0xd01adfb7,0xb8e1afed,0x6a267e96,0xba7c9045,0xf12c7f99,0x24a19947,0xb3916cf7,0x801f2e2,0x858efc16,0x636920d8,0x71574e69,0xa458fea3,0xf4933d7e,0xd95748f,0x728eb658,0x718bcd58,0x82154aee,0x7b54a41d,0xc25a59b5,0x9c30d539,0x2af26013,0xc5d1b023,0x286085f0,0xca417918,0xb8db38ef,0x8e79dcb0,0x603a180e,0x6c9e0e8b,0xb01e8a3e,0xd71577c1,0xbd314b27,0x78af2fda,0x55605c60,0xe65525f3,0xaa55ab94,0x57489862,0x63e81440,0x55ca396a,0x2aab10b6,0xb4cc5c34,0x1141e8ce,0xa15486af,0x7c72e993,0xb3ee1411,0x636fbc2a,0x2ba9c55d,0x741831f6,0xce5c3e16,0x9b87931e,0xafd6ba33,0x6c24cf5c,0x7a325381,0x28958677,0x3b8f4898,0x6b4bb9af,0xc4bfe81b,0x66282193,0x61d809cc,0xfb21a991,0x487cac60,0x5dec8032,0xef845d5d,0xe98575b1,0xdc262302,0xeb651b88,0x23893e81,0xd396acc5,0xf6d6ff3,0x83f44239,0x2e0b4482,0xa4842004,0x69c8f04a,0x9e1f9b5e,0x21c66842,0xf6e96c9a,0x670c9c61,0xabd388f0,0x6a51a0d2,0xd8542f68,0x960fa728,0xab5133a3,0x6eef0b6c,0x137a3be4,0xba3bf050,0x7efb2a98,0xa1f1651d,0x39af0176,0x66ca593e,0x82430e88,0x8cee8619,0x456f9fb4,0x7d84a5c3,0x3b8b5ebe,0xe06f75d8,0x85c12073,0x401a449f,0x56c16aa6,0x4ed3aa62,0x363f7706,0x1bfedf72,0x429b023d,0x37d0d724,0xd00a1248,0xdb0fead3,0x49f1c09b,0x75372c9,0x80991b7b,0x25d479d8,0xf6e8def7,0xe3fe501a,0xb6794c3b,0x976ce0bd,0x4c006ba,0xc1a94fb6,0x409f60c4,0x5e5c9ec2,0x196a2463,0x68fb6faf,0x3e6c53b5,0x1339b2eb,0x3b52ec6f,0x6dfc511f,0x9b30952c,0xcc814544,0xaf5ebd09,0xbee3d004,0
1400xde334afd,0x660f2807,0x192e4bb3,0xc0cba857,0x45c8740f,0xd20b5f39,0xb9d3fbdb,0x5579c0bd,0x1a60320a,0xd6a100c6,0x402c7279,0x679f25fe,0xfb1fa3cc,0x8ea5e9f8,0xdb3222f8,0x3c7516df,0xfd616b15,0x2f501ec8,0xad0552ab,0x323db5fa,0xfd238760,0x53317b48,0x3e00df82,0x9e5c57bb,0xca6f8ca0,0x1a87562e,0xdf1769db,0xd542a8f6,0x287effc3,0xac6732c6,0x8c4f5573,0x695b27b0,0xbbca58c8,0xe1ffa35d,0xb8f011a0,0x10fa3d98,0xfd2183b8,0x4afcb56c,0x2dd1d35b,0x9a53e479,0xb6f84565,0xd28e49bc,0x4bfb9790,0xe1ddf2da,0xa4cb7e33,0x62fb1341,0xcee4c6e8,0xef20cada,0x36774c01,0xd07e9efe,0x2bf11fb4,0x95dbda4d,0xae909198,0xeaad8e71,0x6b93d5a0,0xd08ed1d0,0xafc725e0,0x8e3c5b2f,0x8e7594b7,0x8ff6e2fb,0xf2122b64,0x8888b812,0x900df01c,0x4fad5ea0,0x688fc31c,0xd1cff191,0xb3a8c1ad,0x2f2f2218,0xbe0e1777,0xea752dfe,0x8b021fa1,0xe5a0cc0f,0xb56f74e8,0x18acf3d6,0xce89e299,0xb4a84fe0,0xfd13e0b7,0x7cc43b81,0xd2ada8d9,0x165fa266,0x80957705,0x93cc7314,0x211a1477,0xe6ad2065,0x77b5fa86,0xc75442f5,0xfb9d35cf,0xebcdaf0c,0x7b3e89a0,0xd6411bd3,0xae1e7e49,2428461,0x2071b35e,0x226800bb,0x57b8e0af,0x2464369b,0xf009b91e,0x5563911d,0x59dfa6aa,0x78c14389,0xd95a537f,0x207d5ba2,0x2e5b9c5,0x83260376,0x6295cfa9,0x11c81968,0x4e734a41,0xb3472dca,0x7b14a94a,0x1b510052,0x9a532915,0xd60f573f,0xbc9bc6e4,0x2b60a476,0x81e67400,0x8ba6fb5,0x571be91f,0xf296ec6b,0x2a0dd915,0xb6636521,0xe7b9f9b6,0xff34052e,0xc5855664,0x53b02d5d,0xa99f8fa1,0x8ba4799,0x6e85076a],[0x4b7a70e9,0xb5b32944,0xdb75092e,0xc4192623,290971e4,0x49a7df7d,0x9cee60b8,0x8fedb266,0xecaa8c71,0x699a17ff,0x5664526c,0xc2b19ee1,0x193602a5,0x75094c29,0xa0591340,0xe4183a3e,0x3f54989a,0x5b429d65,0x6b8fe4d6,0x99f73fd6,0xa1d29c07,0xefe830f5,0x4d2d38e6,0xf0255dc1,0x4cdd2086,0x8470eb26,0x6382e9c6,0x21ecc5e,0x9686b3f,0x3ebaefc9,0x3c971814,0x6b6a70a1,0x687f3584,0x52a0e286,0xb79c5305,0xaa500737,0x3e07841c,0x7fdeae5c,0x8e7d44ec,0x5716f2b8,0xb03ada37,0xf0500c0d,0xf01c1f04,0x200b3ff,0xae0cf51a,0x3cb574b2,0x25837a58,0xdc0921bd,0xd19113f9,0x7ca92ff6,0x94324773,0x22f54701,0x3ae5e581,0x37c2dadc,0xc8b57634,0x9af3dda7,0xa9446146,0xfd0030e,0xecc8c73e,0xa4751e41,0xe238cd99,0x3bea0e2f,0x3280bba1,0x183eb331,0x4e548b38,0x4f6db908,0x6f420d03,0xf60a04bf,0x2cb81290,0x24977c79,0x5679b072,0xbcaf89af,0xde9a771f,0xd9930810,0xb38bae12,0xdccf3f2e,0x5512721f,0x2e6b7124,0x501adde6,0x9f84cd87,0x7a584718,0x7408da17,0xbc9f9abc,0xe94b7d8c,0xec7aec3a,0xdb851dfa,0x63094366,0xc464c3d2,0xef1c1847,0x3215d908,0xdd433b37,0x24c2ba16,0x12a14d43,0x2a65c451,0x50940002,0x133ae4dd,0x71dff89e,0x10314e55,0x81ac77d6,0x5f11199b,0x43556f1,0xd7a3c76b,0x3c11183b,0x5924a509,0xf28fe6ed,0x97f1fbfa,0x9ebabf2c,0x1e153c6e,0x86e34570,0xeae96fb1,0x860e5e0a,0x5a3e2ab3,0x771fe71c,0x4e3d06fa,0x2965dcb9,0x99e71d0f,0x803e89d6,0x5266c825,0x2e4cc978,0x9c10b36a,0xc6150eba,0x94e2ea78,0xa5fc3c53,0x1e0a2df4,0xf2f74ea7,0x361d2b3d,0x1939260f,0x19c27960,0x5223a708,0xf71312b6,0xebadfe6e,0xeac31f66,0xe3bc4595,0xa67bc883,0xb17f37d1,0x18cff28,0xc332ddef,0xbe6c5aa5,0x65582185,0x68ab9802,0xeecea50f,0xdb2f953b,0x2aef7dad,0x5b6e2f84,0x1521b628,0x29076170,0xecdd4775,0x619f1510,0x13cca830,0xeb61bd96,0x334fe1e,0xaa0363cf,0xb5735c90,0x4c70a239,0xd59e9e0b,0xcbaade14,0xeecc86bc,0x60622ca7,0x9cab5cab,0xb2f3846e,0x648b1eaf,0x19bdf0ca,0xa02369b9,0x655abb50,0x40685a32,0x3c2ab4b3,0x319ee9d5,0xc021b8f7,0x9b540b19,0x875fa099,0x95f7997e,0x623d7da8,0xf837889a,0x97e32d77,0x11ed935f,0x16681281,0xe358829,0xc7e61fd6,0x96dedfa1,0x7858ba99,0x57f584a5,0x1b227263,0x9b83c3ff,0x1ac24696,0xcdb30aeb,0x532e3054,0x8fd948e4,0x6dbc3128,0x58ebf2ef,0x34c6ffea,0xfe28ed61,0xee7c3c73,0x5d4a14d9,0xe864b7e3,0x42105d14,0x203e13e0,0x45eee2b6,0xa3aaabea,0xdb6c4f15,0xfacb4fd0,0xc742f442,0xef6abbb5,0x654f3b1d,0x41cd2105,0xd81e799e,0x86854dc7,0xe44b476a,0x3d816250,0xcf62a1f2,0x5b8d2646,0xfc8883a0,0xc1c7b6a3,0x7f1524c3,0x69cb7492,0x47848a0b,0x5692b285,0x95bbf00,0xad19489d,0x1462b174,0x23820e00,0x58428d2a,0xc55f5ea,0x1dadf43e,0x233f7061,0x3372f092,0x8d937e41,0xd65fecf1,0x6c223bdb,0x7cde3759,0xcbee7460,0x4085f2a7,0xce77326e,0xa6078084,0x19f8509e,0xe8efd855,0x61d99735,0xa969a7aa,0xc50c06c2,0x5a04abfc,0x800bcadc,0x9e447a2e,0xc3453484,0xfdd56705,0xe1e9ec9,0xdb73dbd3,0x105588cd,0x675fda79,0xe3674340,0xc5c43465,0x713e38d8,0x3d28f89e,0xf16dff20,0x153e21e7,0x8fb03d4a,0xe6e39f2b,0xdb83adf7],[0xe93d5a68,0x948140f7,0xf64c261c,0x94692934,0x411520f7,0x7602d4f7,0xbcf46b2e,0xd4a20068,0xd4082471,0x3320f46a,0x43b7d4b7,0x500061af,0x1e39f62e,0x97244546,0x14214f74,0xbf8b8840,0x4d95fc1d,0x96b591af,0x70f4ddd3,0x66a02f45,0xbfbc09ec,0x3bd9785,0x7fac6dd0,0x31cb8504,0x96eb27b3,0x55fd3941,0xda2547e6,0xabca0a9a,0x28507825,0x530429f4,0xa2c86da,0xe9b66dfb,0x68dc1462,0xd7486900,0x680ec0a4,0x27a18dee,0x4f3ffea2,0xe887ad8c,0xb58ce006,0x7af4d6b6,0xaace1e7c,0xd3375fec,0xce78a399,0
1400x406b2a42,0x20fe9e35,0xd9f385b9,0xee39d7ab,0x3b124e8b,0x1dc9faf7,0x4b6d1856,0x26a36631,0xeae397b2,0x3a6efa74,0xdd5b4332,0x6841e7f7,0xca7820fb,0xfb0af54e,0xd8feb397,0x454056ac,0xba489527,0x55533a3a,0x20838d87,0xfe6ba9b7,0xd096954b,0x55a867bc,0xa1159a58,0xcca92963,0x99e1db33,0xa62a4a56,0x3f3125f9,0x5ef47e1c,0x9029317c,0xfdf8e802,0x4272f70,0x80bb155c,0x5282ce3,0x95c11548,0xe4c66d22,0x48c1133f,0xc70f86dc,0x7f9c9ee,0x41041f0f,0x404779a4,0x5d886e17,0x325f51eb,0xd59bc0d1,0xf2bcc18f,0x41113564,0x257b7834,0x602a9c60,0xdff8e8a3,0x1f636c1b,0xe12b4c2,0x2e1329e,0xaf664fd1,0xcad18115,0x6b2395e0,0x333e92e1,0x3b240b62,0xeebeb922,0x85b2a20e,0xe6ba0d99,0xde720c8c,0x2da2f728,0xd0127845,0x95b794fd,0x647d0862,0xe7ccf5f0,0x5449a36f,0x877d48fa,0xc39dfd27,0xf33e8d1e,0xa476341,0x992eff74,0x3a6f6eab,0xf4f8fd37,0xa812dc60,0xa1ebddf8,0x991be14c,0xdb6e6b0d,0xc67b5510,0x6d672c37,0x2765d43b,0xdcd0e804,0xf1290dc7,0xcc00ffa3,0xb5390f92,0x690fed0b,0x667b9ffb,0xcedb7d9c,0xa091cf0b,0xd9155ea3,0xbb132f88,0x515bad24,0x7b9479bf,0x763bd6eb,0x37392eb3,0xcc115979,0x8026e297,0xf42e312d,0x6842ada7,0xc66a2b3b,0x12754ccc,0x782ef11c,0x6a124237,0xb79251e7,0x6a1bbe6,0x4bfb6350,0x1a6b1018,0x11caedfa,0x3d25bdd8,0xe2e1c3c9,0x44421659,0xa121386,0xd90cec6e,0xd5abea2a,0x64af674e,0xda86a85f,0xbebfe988,0x64e4c3fe,0x9dbc8057,0xf0f7c086,0x60787bf8,0x6003604d,0xd1fd8346,0xf6381fb0,0x7745ae04,0xd736fccc,0x83426b33,0xf01eab71,0xb0804187,0x3c005e5f,0x77a057be,0xbde8ae24,0x55464299,0xbf582e61,0x4e58f48f,0xf2ddfda2,0xf474ef38,0x8789bdc2,0x5366f9c3,0xc8b38e74,0xb475f255,0x46fcd9b9,0x7aeb2661,0x8b1ddf84,0x846a0e79,0x915f95e2,0x466e598e,0x20b45770,0x8cd55591,0xc902de4c,0xb90bace1,0xbb8205d0,0x11a86248,0x7574a99e,0xb77f19b6,0xe0a9dc09,0x662d09a1,0xc4324633,0xe85a1f02,0x9f0be8c,0x4a99a025,0x1d6efe10,0x1ab93d1d,0xba5a4df,0xa186f20f,0x2868f169,0xdcb7da83,0x573906fe,0xa1e2ce9b,0x4fcd7f52,0x50115e01,0xa70683fa,0xa002b5c4,0xde6d027,0x9af88c27,0x773f8641,0xc3604c06,0x61a806b5,0xf0177a28,0xc0f586e0,6314154,0x30dc7d62,0x11e69ed7,0x2338ea63,0x53c2dd94,0xc2c21634,0xbbcbee56,0x90bcb6de,0xebfc7da1,0xce591d76,0x6f05e409,0x4b7c0188,0x39720a3d,0x7c927c24,0x86e3725f,0x724d9db9,0x1ac15bb4,0xd39eb8fc,0xed545578,0x8fca5b5,0xd83d7cd3,0x4dad0fc4,0x1e50ef5e,0xb161e6f8,0xa28514d9,0x6c51133c,0x6fd5c7e7,0x56e14ec4,0x362abfce,0xddc6c837,0xd79a3234,0x92638212,0x670efa8e,0x406000e0],[0x3a39ce37,0xd3faf5cf,0xabc27737,0x5ac52d1b,0x5cb0679e,0x4fa33742,0xd3822740,0x99bc9bbe,0xd5118e9d,0xbf0f7315,0xd62d1c7e,0xc700c47b,0xb78c1b6b,0x21a19045,0xb26eb1be,0x6a366eb4,0x5748ab2f,0xbc946e79,0xc6a376d2,0x6549c2c8,0x530ff8ee,0x468dde7d,0xd5730a1d,0x4cd04dc6,0x2939bbdb,0xa9ba4650,0xac9526e8,0xbe5ee304,0xa1fad5f0,0x6a2d519a,0x63ef8ce2,0x9a86ee22,0xc089c2b8,0x43242ef6,0xa51e03aa,0x9cf2d0a4,0x83c061ba,0x9be96a4d,0x8fe51550,0xba645bd6,0x2826a2f9,0xa73a3ae1,0x4ba99586,0xef5562e9,0xc72fefd3,0xf752f7da,0x3f046f69,0x77fa0a59,0x80e4a915,0x87b08601,0x9b09e6ad,0x3b3ee593,0xe990fd5a,0x9e34d797,0x2cf0b7d9,0x22b8b51,0x96d5ac3a,0x17da67d,0xd1cf3ed6,0x7c7d2d28,0x1f9f25cf,0xadf2b89b,0x5ad6b472,0x5a88f54c,0xe029ac71,0xe019a5e6,0x47b0acfd,0xed93fa9b,0xe8d3c48d,0x283b57cc,0xf8d56629,0x79132e28,0x785f0191,0xed756055,0xf7960e44,0xe3d35e8c,0x15056dd4,0x88f46dba,0x3a16125,0x564f0bd,0xc3eb9e15,0x3c9057a2,0x97271aec,0xa93a072a,0x1b3f6d9b,0x1e6321f5,0xf59c66fb,0x26dcf319,0x7533d928,0xb155fdf5,0x3563482,0x8aba3cbb,0x28517711,0xc20ad9f8,0xabcc5167,0xccad925f,0x4de81751,0x3830dc8e,0x379d5862,0x9320f991,0xea7a90c2,0xfb3e7bce,0x5121ce64,0x774fbe32,0xa8b6e37e,0xc3293d46,0x48de5369,0x6413e680,0xa2ae0810,0xdd6db224,0x69852dfd,0x9072166,0xb39a460a,0x6445c0dd,0x586cdecf,0x1c20c8ae,0x5bbef7dd,0x1b588d40,0xccd2017f,0x6bb4e3bb,0xdda26a7e,0x3a59ff45,0x3e350a44,0xbcb4cdd5,0x72eacea8,0xfa6484bb,0x8d6612ae,0xbf3c6f47,0xd29be463,0x542f5d9e,0xaec2771b,0xf64e6370,0x740e0d8d,0xe75b1357,0xf8721671,0xaf537d5d,0x4040cb08,0x4eb4e2cc,0x34d2466a,0x115af84,3786409e3,0x95983a1d,0x6b89fb4,0xce6ea048,0x6f3f3b82,0x3520ab82,0x11a1d4b,0x277227f8,0x611560b1,0xe7933fdc,0xbb3a792b,0x344525bd,0xa08839e1,0x51ce794b,0x2f32c9b7,0xa01fbac9,0xe01cc87e,0xbcc7d1f6,0xcf0111c3,0xa1e8aac7,0x1a908749,0xd44fbd9a,0xd0dadecb,0xd50ada38,0x339c32a,0xc6913667,0x8df9317c,0xe0b12b4f,0xf79e59b7,0x43f5bb3a,0xf2d519ff,0x27d9459c,0xbf97222c,0x15e6fc2a,0xf91fc71,0x9b941525,0xfae59361,0xceb69ceb,0xc2a86459,0x12baa8d1,0xb6c1075e,0xe3056a0c,0x10d25065,0xcb03a442,0xe0ec6e0e,0x1698db3b,0x4c98a0be,0x3278e964,0x9f1f9532,0xe0d392df,0xd3a0342b,0x8971f21e,0x1b0a7441,0x4ba3348c,0xc5be7120,0xc37632d8,0xdf359f8d,0x9b992f2e,0xe60b6f47,0xfe3f11d,0xe54cda54,0x1edad891,0xce6279cf,0xcd3e7e6f,0x1618b166,0xfd2c1d05,0x848fd2c5,0xf6fb2299,0xf523f357,0xa6327623,0x93a83531,0x56cccd02,0xacf08162,0x5a75ebb5,0x6e163697,0x88d273cc,0xde966292,0x81b949d0,0x4c50901b,0x71c65614,0xe6c6c7bd,0x327a140a,0x45e1d006,0xc3f27b9a,0xc9aa53fd,0x62a80f00,0xbb25bfe2,0x35bdd2f6,0x71126905,0xb2040222,0xb6cbcf7c,0xcd769c2b,0x53113ec0,0x1640e3d3,0x38abbd60,0x2547adf0,0xba38209c,0xf746ce76,0x77afa1c5,0x20756060,0x85cbfe4e,0x8ae88dd8,0x7aaaf9b0,0x4cf9aa7e,0x1948c25c,0x2fb8a8c,0x1c36ae4,0xd6ebe1f9,0x90d4f869,0xa65cdea0,0x3f09252d,0xc208e69f,0xb74e6132,0xce77e25b,0x578fdfe3,0x3ac372e6]];var s={pbox:[],sbox:[]};function o(e,t){let r=e.sbox[0][t>>24&255]+e.sbox[1][t>>16&255];return r^=e.sbox[2][t>>8&255],r+=e.sbox[3][255&t]}function a(e,t,r){let i,n=t,s=r;for(let t=0;t<16;++t)n^=e.pbox[t],s=o(e,n)^s,i=n,n=s,s=i;return i=n,n=s,s=i^e.pbox[16],{left:n^=e.pbox[17],right:s}}var c=r.Blowfish=t.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key;!function(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=n[t][r]}let s=0;for(let n=0;n<18;
1400n++)e.pbox[n]=i[n]^t[s],++s>=r&&(s=0);let o=0,c=0,l=0;for(let t=0;t<18;t+=2)o=(l=a(e,o,c)).left,c=l.right,e.pbox[t]=o,e.pbox[t+1]=c;for(let t=0;t<4;t++)for(let r=0;r<256;r+=2)o=(l=a(e,o,c)).left,c=l.right,e.sbox[t][r]=o,e.sbox[t][r+1]=c}(s,e.words,e.sigBytes/4)}},encryptBlock:function(e,t){var r=a(s,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},decryptBlock:function(e,t){var r=function(e,t,r){let i,n=t,s=r;for(let t=17;t>1;--t)n^=e.pbox[t],s=o(e,n)^s,i=n,n=s,s=i;return i=n,n=s,s=i^e.pbox[1],{left:n^=e.pbox[0],right:s}}(s,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},blockSize:2,keySize:4,ivSize:2});e.Blowfish=t._createHelper(c)}(),e.Blowfish}(r(16611),r(9956),r(11816),r(93524),r(99229))},93524:(e,t,r)=>{"use strict";e.exports=function(e){var t,r,i,n,s,o;return r=(t=e.lib).Base,i=t.WordArray,s=(n=e.algo).MD5,o=n.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,n=this.cfg,s=n.hasher.create(),o=i.create(),a=o.words,c=n.keySize,l=n.iterations;a.length<c;){r&&s.update(r),r=s.update(e).finalize(t),s.reset();for(var h=1;h<l;h++)r=s.finalize(r),s.reset();o.concat(r)}return o.sigBytes=4*c,o}}),e.EvpKDF=function(e,t,r){return o.create(r).compute(e,t)},e.EvpKDF}(r(16611),r(47413),r(83247))},93711:(e,t,r)=>{let i=r(46342),n=r(24967),s=r(35425),o=r(62546),a=r(669),c=r(35630),l=r(19542),h=r(81010),u=r(95230),d=r(69435),f=r(41953),p=r(89158),g=r(70371);function m(e,t,r){let i,n,s=e.size,o=f.getEncodedBits(t,r);for(i=0;i<15;i++)n=(o>>i&1)==1,i<6?e.set(i,8,n,!0):i<8?e.set(i+1,8,n,!0):e.set(s-15+i,8,n,!0),i<8?e.set(8,s-i-1,n,!0):i<9?e.set(8,15-i-1+1,n,!0):e.set(8,15-i-1,n,!0);e.set(s-8,8,1,!0)}t.create=function(e,t){let r,f;if(void 0===e||""===e)throw Error("No input text");let y=n.M;return void 0!==t&&(y=n.from(t.errorCorrectionLevel,n.M),r=d.from(t.version),f=l.from(t.maskPattern),t.toSJISFunc&&i.setToSJISFunction(t.toSJISFunc)),function(e,t,r,n){let f;if(Array.isArray(e))f=g.fromArray(e);else if("string"==typeof e){let i=t;if(!i){let t=g.rawSplit(e);i=d.getBestVersionForData(t,r)}f=g.fromString(e,i||40)}else throw Error("Invalid data");let y=d.getBestVersionForData(f,r);if(!y)throw Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<y)throw Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+y+".\n")}else t=y;let b=function(e,t,r){let n=new s;r.forEach(function(t){n.put(t.mode.bit,4),n.put(t.getLength(),p.getCharCountIndicator(t.mode,e)),t.write(n)});let o=(i.getSymbolTotalCodewords(e)-h.getTotalCodewordsCount(e,t))*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let e=0;e<a;e++)n.put(e%2?17:236,8);return function(e,t,r){let n,s,o=i.getSymbolTotalCodewords(t),a=o-h.getTotalCodewordsCount(t,r),c=h.getBlocksCount(t,r),l=o%c,d=c-l,f=Math.floor(o/c),p=Math.floor(a/c),g=p+1,m=f-p,y=new u(m),b=0,w=Array(c),v=Array(c),x=0,E=new Uint8Array(e.buffer);for(let e=0;e<c;e++){let t=e<d?p:g;w[e]=E.slice(b,b+t),v[e]=y.encode(w[e]),b+=t,x=Math.max(x,t)}let _=new Uint8Array(o),I=0;for(n=0;n<x;n++)for(s=0;s<c;s++)n<w[s].length&&(_[I++]=w[s][n]);for(n=0;n<m;n++)for(s=0;s<c;s++)_[I++]=v[s][n];return _}(n,e,t)}(t,r,f),w=new o(i.getSymbolSize(t));!function(e,t){let r=e.size,i=c.getPositions(t);for(let t=0;t<i.length;t++){let n=i[t][0],s=i[t][1];for(let t=-1;t<=7;t++)if(!(n+t<=-1)&&!(r<=n+t))for(let i=-1;i<=7;i++)s+i<=-1||r<=s+i||(t>=0&&t<=6&&(0===i||6===i)||i>=0&&i<=6&&(0===t||6===t)||t>=2&&t<=4&&i>=2&&i<=4?e.set(n+t,s+i,!0,!0):e.set(n+t,s+i,!1,!0))}}(w,t);let v=w.size;for(let e=8;e<v-8;e++){let t=e%2==0;w.set(e,6,t,!0),w.set(6,e,t,!0)}return!function(e,t){let r=a.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],n=r[t][1];for(let t=-2;t<=2;t++)for(let r=-2;r<=2;r++)-2===t||2===t||-2===r||2===r||0===t&&0===r?e.set(i+t,n+r,!0,!0):e.set(i+t,n+r,!1,!0)}}(w,t),m(w,r,0),t>=7&&function(e,t){let r,i,n,s=e.size,o=d.getEncodedBits(t);for(let t=0;t<18;t++)r=Math.floor(t/3),i=t%3+s-8-3,n=(o>>t&1)==1,e.set(r,i,n,!0),e.set(i,r,n,!0)}(w,t),!function(e,t){let r=e.size,i=-1,n=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(6===a&&a--;;){for(let r=0;r<2;r++)if(!e.isReserved(n,a-r)){let i=!1;o<t.length&&(i=(t[o]>>>s&1)==1),e.set(n,a-r,i),-1==--s&&(o++,s=7)}if((n+=i)<0||r<=n){n-=i,i=-i;break}}}
1400(w,b),isNaN(n)&&(n=l.getBestMask(w,m.bind(null,w,r))),l.applyMask(n,w),m(w,r,n),{modules:w,version:t,errorCorrectionLevel:r,maskPattern:n,segments:f}}(e,r,y,f)}},93965:(e,t,r)=>{"use strict";r.d(t,{IP:()=>o,T8:()=>n,Ud:()=>s,Ws:()=>i});let i={WALLET_ID:"@appkit/wallet_id",WALLET_NAME:"@appkit/wallet_name",SOLANA_WALLET:"@appkit/solana_wallet",SOLANA_CAIP_CHAIN:"@appkit/solana_caip_chain",ACTIVE_CAIP_NETWORK_ID:"@appkit/active_caip_network_id",CONNECTED_SOCIAL:"@appkit/connected_social",CONNECTED_SOCIAL_USERNAME:"@appkit-wallet/SOCIAL_USERNAME",RECENT_WALLETS:"@appkit/recent_wallets",DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",ACTIVE_NAMESPACE:"@appkit/active_namespace",CONNECTED_NAMESPACES:"@appkit/connected_namespaces",CONNECTION_STATUS:"@appkit/connection_status",SIWX_AUTH_TOKEN:"@appkit/siwx-auth-token",SIWX_NONCE_TOKEN:"@appkit/siwx-nonce-token",TELEGRAM_SOCIAL_PROVIDER:"@appkit/social_provider",NATIVE_BALANCE_CACHE:"@appkit/native_balance_cache",PORTFOLIO_CACHE:"@appkit/portfolio_cache",ENS_CACHE:"@appkit/ens_cache",IDENTITY_CACHE:"@appkit/identity_cache"};function n(e){if(!e)throw Error("Namespace is required for CONNECTED_CONNECTOR_ID");return`@appkit/${e}:connected_connector_id`}let s={setItem(e,t){o()&&void 0!==t&&localStorage.setItem(e,t)},getItem(e){if(o())return localStorage.getItem(e)||void 0},removeItem(e){o()&&localStorage.removeItem(e)},clear(){o()&&localStorage.clear()}};function o(){return"undefined"!=typeof window&&"undefined"!=typeof localStorage}},94040:(e,t,r)=>{"use strict";var i;r.d(t,{B:()=>i}),function(e){e.Mainnet="mainnet-beta",e.Testnet="testnet",e.Devnet="devnet"}(i||(i={}))},94545:(e,t,r)=>{"use strict";r.d(t,{Zv:()=>n.Z,EM:()=>h.E,RF:()=>i.RF,JX:()=>i.JX,ds:()=>i.ds});var i=r(71084),n=r(8821),s=r(36117),o=r(34430),a=r(44839),c=r(18085);s.extend(a),s.extend(c);let l={...o,name:"en-web3-modal",relativeTime:{future:"in %s",past:"%s ago",s:"%d sec",m:"1 min",mm:"%d min",h:"1 hr",hh:"%d hrs",d:"1 d",dd:"%d d",M:"1 mo",MM:"%d mo",y:"1 yr",yy:"%d yr"}};s.locale("en-web3-modal",l);var h=r(47327)},94754:(e,t,r)=>{"use strict";function i(e,t){let r=function(e){let t=e.match(RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}(e);return void 0!==r&&new RegExp(t).test(r)}function n(e){return i(e,"^https?:")}function s(e){return i(e,"^wss?:")}function o(e){return RegExp("wss?://localhost(:d{2,5})?").test(e)}r.d(t,{A1:()=>s,q$:()=>n,z:()=>o})},94820:e=>{"use strict";var t=Object.prototype.hasOwnProperty,r="~";function i(){}function n(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function s(e,t,i,s,o){if("function"!=typeof i)throw TypeError("The listener must be a function");var a=new n(i,s||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1)),a.prototype.eventNames=function(){var e,i,n=[];if(0===this._eventsCount)return n;for(i in e=this._events)t.call(e,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},a.prototype.listeners=function(e){var t=r?r+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,s=i.length,o=Array(s);n<s;n++)o[n]=i[n].fn;return o},a.prototype.listenerCount=function(e){var t=r?r+e:e,i=this._events[t];return i?i.fn?1:i.length:0},a.prototype.emit=function(e,t,i,n,s,o){var a=r?r+e:e;if(!this._events[a])return!1;var c,l,h=this._events[a],u=arguments.length;if(h.fn){switch(h.once&&this.removeListener(e,h.fn,void 0,!0),u){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,t),!0;case 3:return h.fn.call(h.context,t,i),!0;case 4:return h.fn.call(h.context,t,i,n),!0;case 5:return h.fn.call(h.context,t,i,n,s),!0;case 6:return h.fn.call(h.context,t,i,n,s,o),!0}for(l=1,c=Array(u-1);l<u;l++)c[l-1]=arguments[l];h.fn.apply(h.context,c)}else{var d,f=h.length;for(l=0;l<f;l++)switch(h[l].once&&this.removeListener(e,h[l].fn,void 0,!0),u){case 1:h[l].fn.call(h[l].context);break;case 2:h[l].fn.call(h[l].context,t);break;case 3:h[l].fn.call(h[l].context,t,i);break;case 4:h[l].fn.call(h[l].context,t,i,n);break;default:if(!c)for(d=1,c=Array(u-1);d<u;d++)c[d-1]=arguments[d];h[l].fn.apply(h[l].context,c)}}return!0},a.prototype.on=function(e,t,r){return s(this,e,t,r,!1)},a.prototype.once=function(e,t,r){return s(this,e,t,r,!0)},a.prototype.removeListener=function(e,t,i,n){var s=r?r+e:e;if(!this._events[s])return this;if(!t)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==t||n&&!a.once||i&&a.context!==i||o(this,s);else{for(var c=0,l=[],h=a.length;c<h;c++)(a[c].fn!==t||n&&!a[c].once||i&&a[c].context!==i)&&l.push(a[c]);l.length?this._events[s]=1===l.length?l[0]:l:o(this,s)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&o(this,t)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,e.exports=a},95119:(e,t)=>{"use strict";function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",i=0;i<e.length;i++)t+=r(e[i].toString(16));return t}t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var i=0;i<e.length;i++)r[i]=0|e[i];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/ig,"")).length%2!=0&&(e="0"+e);for(var i=0;i<e.length;i+=2)r.push(parseInt(e[i]+e[i+1],16))}else for(var i=0;i<e.length;i++){var n=e.charCodeAt(i),s=n>>8,o=255&n;s?r.push(s,o):r.push(o)}return r},t.zero2=r,t.toHex=i,t.encode=function(e,t){return"hex"===t?i(e):e}},95230:(e,t,r)=>{let i=r(50915);function n(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}n.prototype.initialize=function(e){this.degree=e,this.genPoly=i.generateECPolynomial(this.degree)},n.prototype.encode=function(e){if(!this.genPoly)throw Error("Encoder not initialized");let t=new Uint8Array(e.length+this.degree);t.set(e);let r=i.mod(t,this.genPoly),n=this.degree-r.length;if(n>0){let e=new Uint8Array(this.degree);return e.set(r,n),e}return r},e.exports=n},97919:e=>
vendor: 26,139 bytes, line 1400
1400{e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},
vendor: 43,909 bytes, line 1400
140098392:function(e,t,r){!function(e,t){"use strict";function i(e,t){if(!e)throw Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function s(e,t,r){if(s.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&(("le"===t||"be"===t)&&(r=t,t=10),this._init(e||0,t||10,r||"be"))}"object"==typeof e?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{l="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(79368).Buffer}catch(e){}function o(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function a(e,t,r){var i=o(e,r);return r-1>=t&&(i|=o(e,r-1)<<4),i}function c(e,t,r,i){for(var n=0,s=Math.min(e.length,r),o=t;o<s;o++){var a=e.charCodeAt(o)-48;n*=i,a>=49?n+=a-49+10:a>=17?n+=a-17+10:n+=a}return n}s.isBN=function(e){return e instanceof s||null!==e&&"object"==typeof e&&e.constructor.wordSize===s.wordSize&&Array.isArray(e.words)},s.max=function(e,t){return e.cmp(t)>0?e:t},s.min=function(e,t){return 0>e.cmp(t)?e:t},s.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},s.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<0x4000000?(this.words=[0x3ffffff&e],this.length=1):e<0x10000000000000?(this.words=[0x3ffffff&e,e/0x4000000&0x3ffffff],this.length=2):(i(e<0x20000000000000),this.words=[0x3ffffff&e,e/0x4000000&0x3ffffff,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},s.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=Array(this.length);for(var n,s,o=0;o<this.length;o++)this.words[o]=0;var a=0;if("be"===r)for(o=e.length-1,n=0;o>=0;o-=3)s=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[n]|=s<<a&0x3ffffff,this.words[n+1]=s>>>26-a&0x3ffffff,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(o=0,n=0;o<e.length;o+=3)s=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[n]|=s<<a&0x3ffffff,this.words[n+1]=s>>>26-a&0x3ffffff,(a+=24)>=26&&(a-=26,n++);return this.strip()},s.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var i,n=0;n<this.length;n++)this.words[n]=0;var s=0,o=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=a(e,t,n)<<s,this.words[o]|=0x3ffffff&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=a(e,t,n)<<s,this.words[o]|=0x3ffffff&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;this.strip()},s.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=0x3ffffff;n*=t)i++;i--,n=n/t|0;for(var s=e.length-r,o=s%i,a=Math.min(s,s-o)+r,l=0,h=r;h<a;h+=i)l=c(e,h,h+i,t),this.imuln(n),this.words[0]+l<0x4000000?this.words[0]+=l:this._iaddn(l);if(0!==o){var u=1;for(l=c(e,h,e.length,t),h=0;h<o;h++)u*=t;this.imuln(u),this.words[0]+l<0x4000000?this.words[0]+=l:this._iaddn(l)}this.strip()},s.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},s.prototype.clone=function(){var e=new s(null);return this.copy(e),e},s.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l,h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,0x2000000,0x290d741,0x1000000,0x2e90edd,0x39aa400,0x267bf47,0x1000000,0x290d741,1e7,0x12959c3,0x222c000,0x3bd7765,7529536,0xadcea1,0x1000000,0x1704f61,0x206fc40,0x2cddcf9,64e6,4084101,5153632,6436343,7962624,9765625,0xb54ba0,0xdaf26b,0x1069c00,0x138f9ad,243e5,0x1b4d89f,0x2000000,0x25528a1,0x2b54a20,0x3216b93,0x39aa400];function f(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],s=0|t.words[0],o=n*s,a=0x3ffffff&o,c=o/0x4000000|0;r.words[0]=a;for(var l=1;l<i;l++){for(var h=c>>>26,u=0x3ffffff&c,d=Math.min(l,t.length-1),f=Math.max(0,l-e.length+1);f<=d;f++){var p=l-f|0;h+=(o=(n=0|e.words[p])*(s=0|t.words[f])+u)/0x4000000|0,u=0x3ffffff&o}r.words[l]=0|u,c=0|h}return 0!==c?r.words[l]=0|c:r.length--,r.strip()}s.prototype.toString=function(e,t){if(t=0|t||1,16===(e=e||10)||"hex"===e){for(var r="",n=0,s=0,o=0;o<this.length;o++){var a=this.words[o],c=((a<<n|s)&0xffffff).toString(16);s=a>>>24-n&0xffffff,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?h[6-c.length]+c+r:c+r}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var l=u[e],f=d[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(f).toString(e);r=(p=p.idivn(f)).isZero()?g+r:h[l-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=0x4000000*this.words[1]:3===this.length&&1===this.words[2]?e+=0x10000000000000+0x4000000*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(e,t){return i(void 0!==l),this.toArrayLike(l,e,t)},s.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},s.prototype.toArrayLike=function(e,t,r){var n,s,o=this.byteLength(),a=r||Math.max(1,o);i(o<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var c=new e(a),l=this.clone();if("le"===t){for(s=0;!l.isZero();s++)n=l.andln(255),l.iushrn(8),c[s]=n;for(;s<a;s++)c[s]=0}else{for(s=0;s<a-o;s++)c[s]=0;for(s=0;!l.isZero();s++)n=l.andln(255),l.iushrn(8),c[a-s-1]=n}return c},Math.clz32?s.prototype._countBits=function(e){return 32-Math.clz32(e)}:s.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},s.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return(8191&t)==0&&(r+=13,t>>>=13),(127&t)==0&&(r+=7,t>>>=7),(15&t)==0&&(r+=4,t>>>=4),(3&t)==0&&(r+=2,t>>>=2),(1&t)==0&&r++,r},s.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},s.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},s.prototype.ior=function(e){return i((this.negative|e.negative)==0),this.iuor(e)},s.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},s.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},s.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},s.prototype.iand=function(e){return i((this.negative|e.negative)==0),this.iuand(e)},s.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},s.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},s.prototype.iuxor=function(e){this.length>e.length?(t=this,r=e):(t=e,r=this);for(var t,r,i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this.strip()},s.prototype.ixor=function(e){return i((this.negative|e.negative)==0),this.iuxor(e)},s.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},s.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},s.prototype.inotn=function(e){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=0x3ffffff&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&0x3ffffff>>26-r),this.strip()},s.prototype.notn=function(e){return this.clone().inotn(e)},s.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<<n:this.words[r]=this.words[r]&~(1<<n),this.strip()},s.prototype.iadd=function(e){if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,i=e):(r=e,i=this);for(var t,r,i,n=0,s=0;s<i.length;s++)t=(0|r.words[s])+(0|i.words[s])+n,this.words[s]=0x3ffffff&t,n=t>>>26;for(;0!==n&&s<r.length;s++)t=(0|r.words[s])+n,this.words[s]=0x3ffffff&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},s.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},s.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t,r,i=this.iadd(e);return e.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(t=this,r=e):(t=e,r=this);for(var s=0,o=0;o<r.length;o++)s=(i=(0|t.words[o])-(0|r.words[o])+s)>>26,this.words[o]=0x3ffffff&i;for(;0!==s&&o<t.length;o++)s=(i=(0|t.words[o])+s)>>26,this.words[o]=0x3ffffff&i;if(0===s&&o<t.length&&t!==this)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=Math.max(this.length,o),t!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(e){return this.clone().isub(e)};var p=function(e,t,r){var i,n,s,o=e.words,a=t.words,c=r.words,l=0,h=0|o[0],u=8191&h,d=h>>>13,f=0|o[1],p=8191&f,g=f>>>13,m=0|o[2],y=8191&m,b=m>>>13,w=0|o[3],v=8191&w,x=w>>>13,E=0|o[4],_=8191&E,I=E>>>13,A=0|o[5],S=8191&A,C=A>>>13,N=0|o[6],O=8191&N,P=N>>>13,T=0|o[7],M=8191&T,R=T>>>13,k=0|o[8],D=8191&k,L=k>>>13,U=0|o[9],B=8191&U,j=U>>>13,$=0|a[0],z=8191&$,q=$>>>13,H=0|a[1],F=8191&H,W=H>>>13,V=0|a[2],K=8191&V,G=V>>>13,Y=0|a[3],J=8191&Y,X=Y>>>13,Q=0|a[4],Z=8191&Q,ee=Q>>>13,et=0|a[5],er=8191&et,ei=et>>>13,en=0|a[6],es=8191&en,eo=en>>>13,ea=0|a[7],ec=8191&ea,el=ea>>>13,eh=0|a[8],eu=8191&eh,ed=eh>>>13,ef=0|a[9],ep=8191&ef,eg=ef>>>13;r.negative=e.negative^t.negative,r.length=19,i=Math.imul(u,z);var em=(l+i|0)+((8191&(n=(n=Math.imul(u,q))+Math.imul(d,z)|0))<<13)|0;l=((s=Math.imul(d,q))+(n>>>13)|0)+(em>>>26)|0,em&=0x3ffffff,i=Math.imul(p,z),n=(n=Math.imul(p,q))+Math.imul(g,z)|0,s=Math.imul(g,q),i=i+Math.imul(u,F)|0;var ey=(l+i|0)+((8191&(n=(n=n+Math.imul(u,W)|0)+Math.imul(d,F)|0))<<13)|0;l=((s=s+Math.imul(d,W)|0)+(n>>>13)|0)+(ey>>>26)|0,ey&=0x3ffffff,i=Math.imul(y,z),n=(n=Math.imul(y,q))+Math.imul(b,z)|0,s=Math.imul(b,q),i=i+Math.imul(p,F)|0,n=(n=n+Math.imul(p,W)|0)+Math.imul(g,F)|0,s=s+Math.imul(g,W)|0,i=i+Math.imul(u,K)|0;var eb=(l+i|0)+((8191&(n=(n=n+Math.imul(u,G)|0)+Math.imul(d,K)|0))<<13)|0;l=((s=s+Math.imul(d,G)|0)+(n>>>13)|0)+(eb>>>26)|0,eb&=0x3ffffff,i=Math.imul(v,z),n=(n=Math.imul(v,q))+Math.imul(x,z)|0,s=Math.imul(x,q),i=i+Math.imul(y,F)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(b,F)|0,s=s+Math.imul(b,W)|0,i=i+Math.imul(p,K)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(g,K)|0,s=s+Math.imul(g,G)|0,i=i+Math.imul(u,J)|0;var ew=(l+i|0)+((8191&(n=(n=n+Math.imul(u,X)|0)+Math.imul(d,J)|0))<<13)|0;l=((s=s+Math.imul(d,X)|0)+(n>>>13)|0)+(ew>>>26)|0,ew&=0x3ffffff,i=Math.imul(_,z),n=(n=Math.imul(_,q))+Math.imul(I,z)|0,s=Math.imul(I,q),i=i+Math.imul(v,F)|0,n=(n=n+Math.imul(v,W)|0)+Math.imul(x,F)|0,s=s+Math.imul(x,W)|0,i=i+Math.imul(y,K)|0,n=(n=n+Math.imul(y,G)|0)+Math.imul(b,K)|0,s=s+Math.imul(b,G)|0,i=i+Math.imul(p,J)|0,n=(n=n+Math.imul(p,X)|0)+Math.imul(g,J)|0,s=s+Math.imul(g,X)|0,i=i+Math.imul(u,Z)|0;var ev=(l+i|0)+((8191&(n=(n=n+Math.imul(u,ee)|0)+Math.imul(d,Z)|0))<<13)|0;l=((s=s+Math.imul(d,ee)|0)+(n>>>13)|0)+(ev>>>26)|0,ev&=0x3ffffff,i=Math.imul(S,z),n=(n=Math.imul(S,q))+Math.imul(C,z)|0,s=Math.imul(C,q),i=i+Math.imul(_,F)|0,n=(n=n+Math.imul(_,W)|0)+Math.imul(I,F)|0,s=s+Math.imul(I,W)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,G)|0)+Math.imul(x,K)|0,s=s+Math.imul(x,G)|0,i=i+Math.imul(y,J)|0,n=(n=n+Math.imul(y,X)|0)+Math.imul(b,J)|0,s=s+Math.imul(b,X)|0,i=i+Math.imul(p,Z)|0,n=(n=n+Math.imul(p,ee)|0)+Math.imul(g,Z)|0,s=s+Math.imul(g,ee)|0,i=i+Math.imul(u,er)|0;var ex=(l+i|0)+((8191&(n=(n=n+Math.imul(u,ei)|0)+Math.imul(d,er)|0))<<13)|0;l=((s=s+Math.imul(d,ei)|0)+(n>>>13)|0)+(ex>>>26)|0,ex&=0x3ffffff,i=Math.imul(O,z),n=(n=Math.imul(O,q))+Math.imul(P,z)|0,s=Math.imul(P,q),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(C,F)|0,s=s+Math.imul(C,W)|0,i=i+Math.imul(_,K)|0,n=(n=n+Math.imul(_,G)|0)+Math.imul(I,K)|0,s=s+Math.imul(I,G)|0,i=i+Math.imul(v,J)|0,n=(n=n+Math.imul(v,X)|0)+Math.imul(x,J)|0,s=s+Math.imul(x,X)|0,i=i+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,ee)|0)+Math.imul(b,Z)|0,s=s+Math.imul(b,ee)|0,i=i+Math.imul(p,er)|0,n=(n=n+Math.imul(p,ei)|0)+Math.imul(g,er)|0,s=s+Math.imul(g,ei)|0,i=i+Math.imul(u,es)|0;var eE=(l+i|0)+((8191&(n=(n=n+Math.imul(u,eo)|0)+Math.imul(d,es)|0))<<13)|0;l=((s=s+Math.imul(d,eo)|0)+(n>>>13)|0)+(eE>>>26)|0,eE&=0x3ffffff,i=Math.imul(M,z),n=(n=Math.imul(M,q))+Math.imul(R,z)|0,s=Math.imul(R,q),i=i+Math.imul(O,F)|0,n=(n=n+Math.imul(O,W)|0)+Math.imul(P,F)|0,s=s+Math.imul(P,W)|0,i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,G)|0)+Math.imul(C,K)|0,s=s+Math.imul(C,G)|0,i=i+Math.imul(_,J)|0,n=(n=n+Math.imul(_,X)|0)+Math.imul(I,J)|0,s=s+Math.imul(I,X)|0,i=i+Math.imul(v,Z)|0,n=(n=n+Math.imul(v,ee)|0)+Math.imul(x,Z)|0,s=s+Math.imul(x,ee)|0,i=i+Math.imul(y,er)|0,n=(n=n+Math.imul(y,ei)|0)+Math.imul(b,er)|0,s=s+Math.imul(b,ei)|0,i=i+Math.imul(p,es)|0,n=(n=n+Math.imul(p,eo)|0)+Math.imul(g,es)|0,s=s+Math.imul(g,eo)|0,i=i+Math.imul(u,ec)|0;var e_=(l+i|0)+((8191&(n=(n=n+Math.imul(u,el)|0)+Math.imul(d,ec)|0))<<13)|0;l=((s=s+Math.imul(d,el)|0)+(n>>>13)|0)+(e_>>>26)|0,e_&=0x3ffffff,i=Math.imul(D,z),n=(n=Math.imul(D,q))+Math.imul(L,z)|0,s=Math.imul(L,q),i=i+Math.imul(M,F)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(R,F)|0,s=s+Math.imul(R,W)|0,i=i+Math.imul(O,K)|0,n=(n=n+Math.imul(O,G)|0)+Math.imul(P,K)|0,s=s+Math.imul(P,G)|0,i=i+Math.imul(S,J)|0,n=(n=n+Math.imul(S,X)|0)+Math.imul(C,J)|0,s=s+Math.imul(C,X)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,ee)|0)+Math.imul(I,Z)|0,s=s+Math.imul(I,ee)|0,i=i+Math.imul(v,er)|0,n=(n=n+Math.imul(v,ei)|0)+Math.imul(x,er)|0,s=s+Math.imul(x,ei)|0,i=i+Math.imul(y,es)|0,n=(n=n+Math.imul(y,eo)|0)+Math.imul(b,es)|0,s=s+Math.imul(b,eo)|0,i=i+Math.imul(p,ec)|0,n=(n=n+Math.imul(p,el)|0)+Math.imul(g,ec)|0,s=s+Math.imul(g,el)|0,i=i+Math.imul(u,eu)|0;var eI=(l+i|0)+((8191&(n=(n=n+Math.imul(u,ed)|0)+Math.imul(d,eu)|0))<<13)|0;l=((s=s+Math.imul(d,ed)|0)+(n>>>13)|0)+(eI>>>26)|0,eI&=0x3ffffff,i=Math.imul(B,z),n=(n=Math.imul(B,q))+Math.imul(j,z)|0,s=Math.imul(j,q),i=i+Math.imul(D,F)|0,n=(n=n+Math.imul(D,W)|0)+Math.imul(L,F)|0,s=s+Math.imul(L,W)|0,i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,G)|0)+Math.imul(R,K)|0,s=s+Math.imul(R,G)|0,i=i+Math.imul(O,J)|0,n=(n=n+Math.imul(O,X)|0)+Math.imul(P,J)|0,s=s+Math.imul(P,X)|0,i=i+Math.imul(S,Z)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(C,Z)|0,s=s+Math.imul(C,ee)|0,i=i+Math.imul(_,er)|0,n=(n=n+Math.imul(_,ei)|0)+Math.imul(I,er)|0,s=s+Math.imul(I,ei)|0,i=i+Math.imul(v,es)|0,n=(n=n+Math.imul(v,eo)|0)+Math.imul(x,es)|0,s=s+Math.imul(x,eo)|0,i=i+Math.imul(y,ec)|0,n=(n=n+Math.imul(y,el)|0)+Math.imul(b,ec)|0,s=s+Math.imul(b,el)|0,i=i+Math.imul(p,eu)|0,n=(n=n+Math.imul(p,ed)|0)+Math.imul(g,eu)|0,s=s+Math.imul(g,ed)|0,i=i+Math.imul(u,ep)|0;var eA=(l+i|0)+((8191&(n=(n=n+Math.imul(u,eg)|0)+Math.imul(d,ep)|0))<<13)|0;l=((s=s+Math.imul(d,eg)|0)+(n>>>13)|0)+(eA>>>26)|0,eA&=0x3ffffff,i=Math.imul(B,F),n=(n=Math.imul(B,W))+Math.imul(j,F)|0,s=Math.imul(j,W),i=i+Math.imul(D,K)|0,n=(n=n+Math.imul(D,G)|0)+Math.imul(L,K)|0,s=s+Math.imul(L,G)|0,i=i+Math.imul(M,J)|0,n=(n=n+Math.imul(M,X)|0)+Math.imul(R,J)|0,s=s+Math.imul(R,X)|0,i=i+Math.imul(O,Z)|0,n=(n=n+Math.imul(O,ee)|0)+Math.imul(P,Z)|0,s=s+Math.imul(P,ee)|0,i=i+Math.imul(S,er)|0,n=(n=n+Math.imul(S,ei)|0)+Math.imul(C,er)|0,s=s+Math.imul(C,ei)|0,i=i+Math.imul(_,es)|0,n=(n=n+Math.imul(_,eo)|0)+Math.imul(I,es)|0,s=s+Math.imul(I,eo)|0,i=i+Math.imul(v,ec)|0,n=(n=n+Math.imul(v,el)|0)+Math.imul(x,ec)|0,s=s+Math.imul(x,el)|0,i=i+Math.imul(y,eu)|0,n=(n=n+Math.imul(y,ed)|0)+Math.imul(b,eu)|0,s=s+Math.imul(b,ed)|0,i=i+Math.imul(p,ep)|0;var eS=(l+i|0)+((8191&(n=(n=n+Math.imul(p,eg)|0)+Math.imul(g,ep)|0))<<13)|0;l=((s=s+Math.imul(g,eg)|0)+(n>>>13)|0)+(eS>>>26)|0,eS&=0x3ffffff,i=Math.imul(B,K),n=(n=Math.imul(B,G))+Math.imul(j,K)|0,s=Math.imul(j,G),i=i+Math.imul(D,J)|0,n=(n=n+Math.imul(D,X)|0)+Math.imul(L,J)|0,s=s+Math.imul(L,X)|0,i=i+Math.imul(M,Z)|0,n=(n=n+Math.imul(M,ee)|0)+Math.imul(R,Z)|0,s=s+Math.imul(R,ee)|0,i=i+Math.imul(O,er)|0,n=(n=n+Math.imul(O,ei)|0)+Math.imul(P,er)|0,s=s+Math.imul(P,ei)|0,i=i+Math.imul(S,es)|0,n=(n=n+Math.imul(S,eo)|0)+Math.imul(C,es)|0,s=s+Math.imul(C,eo)|0,i=i+Math.imul(_,ec)|0,n=(n=n+Math.imul(_,el)|0)+Math.imul(I,ec)|0,s=s+Math.imul(I,el)|0,i=i+Math.imul(v,eu)|0,n=(n=n+Math.imul(v,ed)|0)+Math.imul(x,eu)|0,s=s+Math.imul(x,ed)|0,i=i+Math.imul(y,ep)|0;var eC=(l+i|0)+((8191&(n=(n=n+Math.imul(y,eg)|0)+Math.imul(b,ep)|0))<<13)|0;l=((s=s+Math.imul(b,eg)|0)+(n>>>13)|0)+(eC>>>26)|0,eC&=0x3ffffff,i=Math.imul(B,J),n=(n=Math.imul(B,X))+Math.imul(j,J)|0,s=Math.imul(j,X),i=i+Math.imul(D,Z)|0,n=(n=n+Math.imul(D,ee)|0)+Math.imul(L,Z)|0,s=s+Math.imul(L,ee)|0,i=i+Math.imul(M,er)|0,n=(n=n+Math.imul(M,ei)|0)+Math.imul(R,er)|0,s=s+Math.imul(R,ei)|0,i=i+Math.imul(O,es)|0,n=(n=n+Math.imul(O,eo)|0)+Math.imul(P,es)|0,s=s+Math.imul(P,eo)|0,i=i+Math.imul(S,ec)|0,n=(n=n+Math.imul(S,el)|0)+Math.imul(C,ec)|0,s=s+Math.imul(C,el)|0,i=i+Math.imul(_,eu)|0,n=(n=n+Math.imul(_,ed)|0)+Math.imul(I,eu)|0,s=s+Math.imul(I,ed)|0,i=i+Math.imul(v,ep)|0;var eN=(l+i|0)+((8191&(n=(n=n+Math.imul(v,eg)|0)+Math.imul(x,ep)|0))<<13)|0;l=((s=s+Math.imul(x,eg)|0)+(n>>>13)|0)+(eN>>>26)|0,eN&=0x3ffffff,i=Math.imul(B,Z),n=(n=Math.imul(B,ee))+Math.imul(j,Z)|0,s=Math.imul(j,ee),i=i+Math.imul(D,er)|0,n=(n=n+Math.imul(D,ei)|0)+Math.imul(L,er)|0,s=s+Math.imul(L,ei)|0,i=i+Math.imul(M,es)|0,n=(n=n+Math.imul(M,eo)|0)+Math.imul(R,es)|0,s=s+Math.imul(R,eo)|0,i=i+Math.imul(O,ec)|0,n=(n=n+Math.imul(O,el)|0)+Math.imul(P,ec)|0,s=s+Math.imul(P,el)|0,i=i+Math.imul(S,eu)|0,n=(n=n+Math.imul(S,ed)|0)+Math.imul(C,eu)|0,s=s+Math.imul(C,ed)|0,i=i+Math.imul(_,ep)|0;var eO=(l+i|0)+((8191&(n=(n=n+Math.imul(_,eg)|0)+Math.imul(I,ep)|0))<<13)|0;l=((s=s+Math.imul(I,eg)|0)+(n>>>13)|0)+(eO>>>26)|0,eO&=0x3ffffff,i=Math.imul(B,er),n=(n=Math.imul(B,ei))+Math.imul(j,er)|0,s=Math.imul(j,ei),i=i+Math.imul(D,es)|0,n=(n=n+Math.imul(D,eo)|0)+Math.imul(L,es)|0,s=s+Math.imul(L,eo)|0,i=i+Math.imul(M,ec)|0,n=(n=n+Math.imul(M,el)|0)+Math.imul(R,ec)|0,s=s+Math.imul(R,el)|0,i=i+Math.imul(O,eu)|0,n=(n=n+Math.imul(O,ed)|0)+Math.imul(P,eu)|0,s=s+Math.imul(P,ed)|0,i=i+Math.imul(S,ep)|0;var eP=(l+i|0)+((8191&(n=(n=n+Math.imul(S,eg)|0)+Math.imul(C,ep)|0))<<13)|0;l=((s=s+Math.imul(C,eg)|0)+(n>>>13)|0)+(eP>>>26)|0,eP&=0x3ffffff,i=Math.imul(B,es),n=(n=Math.imul(B,eo))+Math.imul(j,es)|0,s=Math.imul(j,eo),i=i+Math.imul(D,ec)|0,n=(n=n+Math.imul(D,el)|0)+Math.imul(L,ec)|0,s=s+Math.imul(L,el)|0,i=i+Math.imul(M,eu)|0,n=(n=n+Math.imul(M,ed)|0)+Math.imul(R,eu)|0,s=s+Math.imul(R,ed)|0,i=i+Math.imul(O,ep)|0;var eT=(l+i|0)+((8191&(n=(n=n+Math.imul(O,eg)|0)+Math.imul(P,ep)|0))<<13)|0;l=((s=s+Math.imul(P,eg)|0)+(n>>>13)|0)+(eT>>>26)|0,eT&=0x3ffffff,i=Math.imul(B,ec),n=(n=Math.imul(B,el))+Math.imul(j,ec)|0,s=Math.imul(j,el),i=i+Math.imul(D,eu)|0,n=(n=n+Math.imul(D,ed)|0)+Math.imul(L,eu)|0,s=s+Math.imul(L,ed)|0,i=i+Math.imul(M,ep)|0;var eM=(l+i|0)+((8191&(n=(n=n+Math.imul(M,eg)|0)+Math.imul(R,ep)|0))<<13)|0;l=((s=s+Math.imul(R,eg)|0)+(n>>>13)|0)+(eM>>>26)|0,eM&=0x3ffffff,i=Math.imul(B,eu),n=(n=Math.imul(B,ed))+Math.imul(j,eu)|0,s=Math.imul(j,ed),i=i+Math.imul(D,ep)|0;var eR=(l+i|0)+((8191&(n=(n=n+Math.imul(D,eg)|0)+Math.imul(L,ep)|0))<<13)|0;l=((s=s+Math.imul(L,eg)|0)+(n>>>13)|0)+(eR>>>26)|0,eR&=0x3ffffff,i=Math.imul(B,ep);var ek=(l+i|0)+((8191&(n=(n=Math.imul(B,eg))+Math.imul(j,ep)|0))<<13)|0;return l=((s=Math.imul(j,eg))+(n>>>13)|0)+(ek>>>26)|0,ek&=0x3ffffff,c[0]=em,c[1]=ey,c[2]=eb,c[3]=ew,c[4]=ev,c[5]=ex,c[6]=eE,c[7]=e_,c[8]=eI,c[9]=eA,c[10]=eS,c[11]=eC,c[12]=eN,c[13]=eO,c[14]=eP,c[15]=eT,c[16]=eM,c[17]=eR,c[18]=ek,0!==l&&(c[19]=l,r.length++),r};function g(e,t,r){return new m().mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(p=f),s.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?p(this,e,t):r<63?f(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,s=0;s<r.length-1;s++){var o=n;n=0;for(var a=0x3ffffff&i,c=Math.min(s,t.length-1),l=Math.max(0,s-e.length+1);l<=c;l++){var h=s-l,u=(0|e.words[h])*(0|t.words[l]),d=0x3ffffff&u;o=o+(u/0x4000000|0)|0,a=0x3ffffff&(d=d+a|0),n+=(o=o+(d>>>26)|0)>>>26,o&=0x3ffffff}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r.strip()}(this,e,t):g(this,e,t)},m.prototype.makeRBT=function(e){for(var t=Array(e),r=s.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},m.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},m.prototype.permute=function(e,t,r,i,n,s){for(var o=0;o<s;o++)i[o]=t[e[o]],n[o]=r[e[o]]},m.prototype.transform=function(e,t,r,i,n,s){this.permute(s,e,t,r,i,n);for(var o=1;o<n;o<<=1)for(var a=o<<1,c=Math.cos(2*Math.PI/a),l=Math.sin(2*Math.PI/a),h=0;h<n;h+=a)for(var u=c,d=l,f=0;f<o;f++){var p=r[h+f],g=i[h+f],m=r[h+f+o],y=i[h+f+o],b=u*m-d*y;y=u*y+d*m,m=b,r[h+f]=p+m,i[h+f]=g+y,r[h+f+o]=p-m,i[h+f+o]=g-y,f!==a&&(b=c*u-l*d,d=c*d+l*u,u=b)}},m.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},m.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},m.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=0x3ffffff&n,r=n<0x4000000?0:n/0x4000000|0}return e},m.prototype.convert13b=function(e,t,r,n){for(var s=0,o=0;o<t;o++)s+=0|e[o],r[2*o]=8191&s,s>>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*t;o<n;++o)r[o]=0;i(0===s),i((-8192&s)==0)},m.prototype.stub=function(e){for(var t=Array(e),r=0;r<e;r++)t[r]=0;return t},m.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),s=this.stub(i),o=Array(i),a=Array(i),c=Array(i),l=Array(i),h=Array(i),u=Array(i),d=r.words;d.length=i,this.convert13b(e.words,e.length,o,i),this.convert13b(t.words,t.length,l,i),this.transform(o,s,a,c,i,n),this.transform(l,s,h,u,i,n);for(var f=0;f<i;f++){var p=a[f]*h[f]-c[f]*u[f];c[f]=a[f]*u[f]+c[f]*h[f],a[f]=p}return this.conjugate(a,c,i),this.transform(a,c,d,s,i,n),this.conjugate(d,s,i),this.normalize13b(d,i),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},s.prototype.mul=function(e){var t=new s(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},s.prototype.mulf=function(e){var t=new s(null);return t.words=Array(this.length+e.length),g(this,e,t)},s.prototype.imul=function(e){return this.clone().mulTo(e,this)},s.prototype.imuln=function(e){i("number"==typeof e),i(e<0x4000000);for(var t=0,r=0;r<this.length;r++){var n=(0|this.words[r])*e,s=(0x3ffffff&n)+(0x3ffffff&t);t>>=26,t+=(n/0x4000000|0)+(s>>>26),this.words[r]=0x3ffffff&s}return 0!==t&&(this.words[r]=t,this.length++),this.length=0===e?1:this.length,this},s.prototype.muln=function(e){return this.clone().imuln(e)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),r=0;r<t.length;r++){var i=r/26|0,n=r%26;t[r]=(e.words[i]&1<<n)>>>n}return t}(e);if(0===t.length)return new s(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},s.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(e-r)/26,s=0x3ffffff>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t<this.length;t++){var a=this.words[t]&s,c=(0|this.words[t])-a<<r;this.words[t]=c|o,o=a>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this.strip()},s.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},s.prototype.iushrn=function(e,t,r){i("number"==typeof e&&e>=0);var n=t?(t-t%26)/26:0,s=e%26,o=Math.min((e-s)/26,this.length),a=0x3ffffff^0x3ffffff>>>s<<s;if(n-=o,n=Math.max(0,n),r){for(var c=0;c<o;c++)r.words[c]=this.words[c];r.length=o}if(0===o);else if(this.length>o)for(this.length-=o,c=0;c<this.length;c++)this.words[c]=this.words[c+o];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=n);c--){var h=0|this.words[c];this.words[c]=l<<26-s|h>>>s,l=h&a}return r&&0!==l&&(r.words[r.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(e,t,r){return i(0===this.negative),this.iushrn(e,t,r)},s.prototype.shln=function(e){return this.clone().ishln(e)},s.prototype.ushln=function(e){return this.clone().iushln(e)},s.prototype.shrn=function(e){return this.clone().ishrn(e)},s.prototype.ushrn=function(e){return this.clone().iushrn(e)},s.prototype.testn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return!(this.length<=r)&&!!(this.words[r]&1<<t)},s.prototype.imaskn=function(e){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==t&&r++,this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=0x3ffffff^0x3ffffff>>>t<<t),0===this.length&&(this.words[0]=0,this.length=1),this.strip())},s.prototype.maskn=function(e){return this.clone().imaskn(e)},s.prototype.iaddn=function(e){return(i("number"==typeof e),i(e<0x4000000),e<0)?this.isubn(-e):0!==this.negative?(1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0):(this.negative=0,this.isubn(e),this.negative=1),this):this._iaddn(e)},s.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=0x4000000;t++)this.words[t]-=0x4000000,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},s.prototype.isubn=function(e){if(i("number"==typeof e),i(e<0x4000000),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=0x4000000,this.words[t+1]-=1;return this.strip()},s.prototype.addn=function(e){return this.clone().iaddn(e)},s.prototype.subn=function(e){return this.clone().isubn(e)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(e,t,r){var n,s,o=e.length+r;this._expand(o);var a=0;for(n=0;n<e.length;n++){s=(0|this.words[n+r])+a;var c=(0|e.words[n])*t;s-=0x3ffffff&c,a=(s>>26)-(c/0x4000000|0),this.words[n+r]=0x3ffffff&s}for(;n<this.length-r;n++)a=(s=(0|this.words[n+r])+a)>>26,this.words[n+r]=0x3ffffff&s;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n<this.length;n++)a=(s=-(0|this.words[n])+a)>>26,this.words[n]=0x3ffffff&s;return this.negative=1,this.strip()},s.prototype._wordDiv=function(e,t){var r,i=this.length-e.length,n=this.clone(),o=e,a=0|o.words[o.length-1];0!=(i=26-this._countBits(a))&&(o=o.ushln(i),n.iushln(i),a=0|o.words[o.length-1]);var c=n.length-o.length;if("mod"!==t){(r=new s(null)).length=c+1,r.words=Array(r.length);for(var l=0;l<r.length;l++)r.words[l]=0}var h=n.clone()._ishlnsubmul(o,1,c);0===h.negative&&(n=h,r&&(r.words[c]=1));for(var u=c-1;u>=0;u--){var d=(0|n.words[o.length+u])*0x4000000+(0|n.words[o.length+u-1]);for(d=Math.min(d/a|0,0x3ffffff),n._ishlnsubmul(o,d,u);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,u),n.isZero()||(n.negative^=1);r&&(r.words[u]=d)}return r&&r.strip(),n.strip(),"div"!==t&&0!==i&&n.iushrn(i),{div:r||null,mod:n}},s.prototype.divmod=function(e,t,r){var n,o,a;return(i(!e.isZero()),this.isZero())?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(n=a.div.neg()),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:n,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(n=a.div.neg()),{div:n,mod:a.mod}):(this.negative&e.negative)!=0?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):e.length>this.length||0>this.cmp(e)?{div:new s(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new s(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new s(this.modn(e.words[0]))}:this._wordDiv(e,t)},s.prototype.div=function(e){return this.divmod(e,"div",!1).div},s.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},s.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},s.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,i=e.ushrn(1),n=e.andln(1),s=r.cmp(i);return s<0||1===n&&0===s?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},s.prototype.modn=function(e){i(e<=0x3ffffff);for(var t=0x4000000%e,r=0,n=this.length-1;n>=0;n--)r=(t*r+(0|this.words[n]))%e;return r},s.prototype.idivn=function(e){i(e<=0x3ffffff);for(var t=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+0x4000000*t;this.words[r]=n/e|0,t=n%e}return this.strip()},s.prototype.divn=function(e){return this.clone().idivn(e)},s.prototype.egcd=function(e){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new s(1),o=new s(0),a=new s(0),c=new s(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var h=r.clone(),u=t.clone();!t.isZero();){for(var d=0,f=1;(t.words[0]&f)==0&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(h),o.isub(u)),n.iushrn(1),o.iushrn(1);for(var p=0,g=1;(r.words[0]&g)==0&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(h),c.isub(u)),a.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(a),o.isub(c)):(r.isub(t),a.isub(n),c.isub(o))}return{a:a,b:c,gcd:r.iushln(l)}},s.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t,r=this,n=e.clone();r=0!==r.negative?r.umod(e):r.clone();for(var o=new s(1),a=new s(0),c=n.clone();r.cmpn(1)>0&&n.cmpn(1)>0;){for(var l=0,h=1;(r.words[0]&h)==0&&l<26;++l,h<<=1);if(l>0)for(r.iushrn(l);l-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);for(var u=0,d=1;(n.words[0]&d)==0&&u<26;++u,d<<=1);if(u>0)for(n.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);r.cmp(n)>=0?(r.isub(n),o.isub(a)):(n.isub(r),a.isub(o))}return 0>(t=0===r.cmpn(1)?o:a).cmpn(0)&&t.iadd(e),t},s.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var s=t;t=r,r=s}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},s.prototype.invm=function(e){return this.egcd(e).a.umod(e)},s.prototype.isEven=function(){return(1&this.words[0])==0},s.prototype.isOdd=function(){return(1&this.words[0])==1},s.prototype.andln=function(e){return this.words[0]&e},s.prototype.bincn=function(e){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var s=n,o=r;0!==s&&o<this.length;o++){var a=0|this.words[o];a+=s,s=a>>>26,a&=0x3ffffff,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),i(e<=0x3ffffff,"Number is too big");var n=0|this.words[0];t=n===e?0:n<e?-1:1}return 0!==this.negative?0|-t:t},s.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return -1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},s.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return -1;for(var t=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(t=1);break}}return t},s.prototype.gtn=function(e){return 1===this.cmpn(e)},s.prototype.gt=function(e){return 1===this.cmp(e)},s.prototype.gten=function(e){return this.cmpn(e)>=0},s.prototype.gte=function(e){return this.cmp(e)>=0},s.prototype.ltn=function(e){return -1===this.cmpn(e)},s.prototype.lt=function(e){return -1===this.cmp(e)},s.prototype.lten=function(e){return 0>=this.cmpn(e)},s.prototype.lte=function(e){return 0>=this.cmp(e)},s.prototype.eqn=function(e){return 0===this.cmpn(e)},s.prototype.eq=function(e){return 0===this.cmp(e)},s.red=function(e){return new _(e)},s.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(e){return this.red=e,this},s.prototype.forceRed=function(e){return i(!this.red,"Already a number in reduction context"),this._forceRed(e)},s.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},s.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},s.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},s.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},s.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},s.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},s.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new s(t,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){b.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){b.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){b.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=s._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}b.prototype._tmp=function(){var e=new s(null);return e.words=Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t,r=e;do this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength();while(t>this.n);var i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)},n(w,b),w.prototype.split=function(e,t){for(var r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9){e.words[0]=0,e.length=1;return}var n=e.words[9];for(i=10,t.words[t.length++]=4194303&n;i<e.length;i++){var s=0|e.words[i];e.words[i-10]=(4194303&s)<<4|n>>>22,n=s}n>>>=22,e.words[i-10]=n,0===n&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var i=0|e.words[r];t+=977*i,e.words[r]=0x3ffffff&t,t=64*i+(t/0x4000000|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(v,b),n(x,b),n(E,b),E.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=(0|e.words[r])*19+t,n=0x3ffffff&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},s._prime=function(e){var t;if(y[e])return y[e];if("k256"===e)t=new w;else if("p224"===e)t=new v;else if("p192"===e)t=new x;else if("p25519"===e)t=new E;else throw Error("Unknown prime "+e);return y[e]=t,t},_.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){i((e.negative|t.negative)==0,"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},_.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new s(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),c=a.redNeg(),l=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new s(2*h*h).toRed(this);0!==this.pow(h,l).cmp(c);)h.redIAdd(c);for(var u=this.pow(h,n),d=this.pow(e,n.addn(1).iushrn(1)),f=this.pow(e,n),p=o;0!==f.cmp(a);){for(var g=f,m=0;0!==g.cmp(a);m++)g=g.redSqr();i(m<p);var y=this.pow(u,new s(1).iushln(p-m-1));d=d.redMul(y),u=y.redSqr(),f=f.redMul(u),p=m}return d},_.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},_.prototype.pow=function(e,t){if(t.isZero())return new s(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=Array(16);r[0]=new s(1).toRed(this),r[1]=e;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],o=0,a=0,c=t.bitLength()%26;for(0===c&&(c=26),i=t.length-1;i>=0;i--){for(var l=t.words[i],h=c-1;h>=0;h--){var u=l>>h&1;if(n!==r[0]&&(n=this.sqr(n)),0===u&&0===o){a=0;continue}o<<=1,o|=u,(4==++a||0===i&&0===h)&&(n=this.mul(n,r[o]),a=0,o=0)}c=26}return n},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new I(e)},n(I,_),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):0>n.cmpn(0)&&(s=n.iadd(this.m)),s._forceRed(this)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):0>n.cmpn(0)&&(o=n.iadd(this.m)),o._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},98502:(e,t,r)=>{"use strict";r.d(t,{mN:()=>I,AH:()=>l,W3:()=>x,Ec:()=>E,iz:()=>c});let i=globalThis,n=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),o=new WeakMap;class a{constructor(e,t,r){if(this._$cssResult$=!0,r!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(n&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=o.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&o.set(t,e))}return e}toString(){return this.cssText}}let c=e=>
1400new a("string"==typeof e?e:e+"",void 0,s),l=(e,...t)=>new a(1===e.length?e[0]:t.reduce((t,r,i)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+e[i+1],e[0]),e,s),h=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return c(t)})(e):e,{is:u,defineProperty:d,getOwnPropertyDescriptor:f,getOwnPropertyNames:p,getOwnPropertySymbols:g,getPrototypeOf:m}=Object,y=globalThis,b=y.trustedTypes,w=b?b.emptyScript:"",v=y.reactiveElementPolyfillSupport,x={toAttribute(e,t){switch(t){case Boolean:e=e?w:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},E=(e,t)=>!u(e,t),_={attribute:!0,type:String,converter:x,reflect:!1,useDefault:!1,hasChanged:E};Symbol.metadata??=Symbol("metadata"),y.litPropertyMetadata??=new WeakMap;class I extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=_){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);void 0!==i&&d(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:n}=f(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:i,set(t){let s=i?.call(this);n?.call(this,t),this.requestUpdate(e,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_}static _$Ei(){if(this.hasOwnProperty("elementProperties"))return;let e=m(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty("finalized"))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty("properties")){let e=this.properties;for(let t of[...p(e),...g(e)])this.createProperty(t,e[t])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}for(let[e,t]of(this._$Eh=new Map,this.elementProperties)){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e))for(let r of new Set(e.flat(1/0).reverse()))t.unshift(h(r));else void 0!==e&&t.push(h(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map;for(let t of this.constructor.elementProperties.keys())this.hasOwnProperty(t)&&(e.set(t,this[t]),delete this[t]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(n)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=i.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(void 0!==i&&!0===r.reflect){let n=(void 0!==r.converter?.toAttribute?r.converter:x).toAttribute(t,r.type);this._$Em=e,null==n?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){let r=this.constructor,i=r._$Eh.get(e);if(void 0!==i&&this._$Em!==i){let e=r.getPropertyOptions(i),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:x;this._$Em=i;let s=n.fromAttribute(t,e.type);this[i]=s??this._$Ej?.get(i)??s,this._$Em=null}}
1400requestUpdate(e,t,r,i=!1,n){if(void 0!==e){let s=this.constructor;if(!1===i&&(n=this[e]),!(((r??=s.getPropertyOptions(e)).hasChanged??E)(n,t)||r.useDefault&&r.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,r))))return;this.C(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:n},s){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),!0!==n||void 0!==s)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),!0===i&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e){let{wrapped:e}=r,i=this[t];!0!==e||this._$AL.has(t)||void 0===i||this.C(t,void 0,r,i)}}let e=!1,t=this._$AL;try{(e=this.shouldUpdate(t))?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}}I.elementStyles=[],I.shadowRootOptions={mode:"open"},I.elementProperties=new Map,I.finalized=new Map,v?.({ReactiveElement:I}),(y.reactiveElementVersions??=[]).push("2.1.2")},98866:(e,t,r)=>{"use strict";r.d(t,{u$:()=>n,zC:()=>s});var i=r(70524);function n(e,t,r,n){let s=e[t];return(0,i.B1)(e,()=>{let i=e[t];Object.is(s,i)||r(s=i)},n)}function s(e){let t=(0,i.BX)({data:Array.from(e||[]),has(e){return this.data.some(t=>t[0]===e)},set(e,t){let r=this.data.find(t=>t[0]===e);return r?r[1]=t:this.data.push([e,t]),this},get(e){var t;return null==(t=this.data.find(t=>t[0]===e))?void 0:t[1]},delete(e){let t=this.data.findIndex(t=>t[0]===e);return -1!==t&&(this.data.splice(t,1),!0)},clear(){this.data.splice(0)},get size(){return this.data.length},toJSON(){return new Map(this.data)},forEach(e){this.data.forEach(t=>{e(t[1],t[0],this)})},keys(){return this.data.map(e=>e[0]).values()},values(){return this.data.map(e=>e[1]).values()},entries(){return new Map(this.data).entries()},get[Symbol.toStringTag](){return"Map"},[Symbol.iterator](){return this.entries()}});return Object.defineProperties(t,{data:{enumerable:!1},size:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(t),t}Symbol()},99229:(e,t,r)=>{"use strict";e.exports=function(e){var t,r,i,n,s,o,a,c,l,h,u,d,f,p,g,m,y;e.lib.Cipher||(r=(t=e.lib).Base,i=t.WordArray,n=t.BufferedBlockAlgorithm,(s=e.enc).Utf8,o=s.Base64,a=e.algo.EvpKDF,c=t.Cipher=n.extend({cfg:r.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){n.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?y:g}return function(t){return{encrypt:function(r,i,n){return e(i).encrypt(t,r,i,n)},decrypt:function(r,i,n){return e(i).decrypt(t,r,i,n)}}}}()}),t.StreamCipher=c.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),l=e.mode={},h=t.BlockCipherMode=r.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),u=l.CBC=function(){var e=h.extend();function t(e,t,r){var i,n=this._iv;n?(i=n,this._iv=void 0):i=this._prevBlock;for(var s=0;s<r;s++)e[t+s]^=i[s]}return e.Encryptor=e.extend({processBlock:function(e,r){var i=this._cipher,n=i.blockSize;t.call(this,e,r,n),i.encryptBlock(e,r),this._prevBlock=e.slice(r,r+n)}}),e.Decryptor=e.extend({processBlock:function(e,r){var i=this._cipher,n=i.blockSize,s=e.slice(r,r+n);i.decryptBlock(e,r),t.call(this,e,r,n),this._prevBlock=s}}),e}(),d=(e.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,s=n<<24|n<<16|n<<8|n,o=[],a=0;a<n;a+=4)o.push(s);var c=i.create(o,n);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},t.BlockCipher=c.extend({cfg:c.cfg.extend({mode:u,padding:d}),reset:function(){c.reset.call(this);var e,t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4}),f=t.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),p=(e.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?i.create([0x53616c74,0x65645f5f]).concat(r).concat(t):t).toString(o)},parse:function(e){var t,r=o.parse(e),n=r.words;return 0x53616c74==n[0]&&0x65645f5f==n[1]&&(t=i.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),f.create({ciphertext:r,salt:t})}},g=t.SerializableCipher=r.extend({cfg:r.extend({format:p}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),o=n.cfg;return f.create({ciphertext:s,key:r,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),m=(e.kdf={}).OpenSSL={execute:function(e,t,r,n,s){if(n||(n=i.random(8)),s)var o=a.create({keySize:t+r,hasher:s}).compute(e,n);else var o=a.create({keySize:t+r}).compute(e,n);var c=i.create(o.words.slice(t),4*r);return o.sigBytes=4*t,f.create({key:o,iv:c,salt:n})}},y=t.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:m}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var s=g.encrypt.call(this,e,t,n.key,i);
1400return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,g.decrypt.call(this,e,t,n.key,i)}}))}(r(16611),r(93524))}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.