@walletconnect/ethereum-provider 2.10.3 → 2.10.4-184f2234

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(Hr,Vt){typeof exports=="object"&&typeof module<"u"?Vt(exports):typeof define=="function"&&define.amd?define(["exports"],Vt):(Hr=typeof globalThis<"u"?globalThis:Hr||self,Vt(Hr["@walletconnect/ethereum-provider"]={}))})(this,function(Hr){"use strict";var Vt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qg(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Bn(r){var e=r.default;if(typeof e=="function"){var t=function(){return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var o=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:function(){return r[i]}})}),t}var Yt={exports:{}},fi=typeof Reflect=="object"?Reflect:null,gh=fi&&typeof fi.apply=="function"?fi.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},Hs;fi&&typeof fi.ownKeys=="function"?Hs=fi.ownKeys:Object.getOwnPropertySymbols?Hs=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Hs=function(e){return Object.getOwnPropertyNames(e)};function Hg(r){console&&console.warn&&console.warn(r)}var vh=Number.isNaN||function(e){return e!==e};function st(){st.init.call(this)}Yt.exports=st,Yt.exports.once=Vg,st.EventEmitter=st,st.prototype._events=void 0,st.prototype._eventsCount=0,st.prototype._maxListeners=void 0;var yh=10;function Bs(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(st,"defaultMaxListeners",{enumerable:!0,get:function(){return yh},set:function(r){if(typeof r!="number"||r<0||vh(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");yh=r}}),st.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},st.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||vh(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function _h(r){return r._maxListeners===void 0?st.defaultMaxListeners:r._maxListeners}st.prototype.getMaxListeners=function(){return _h(this)},st.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var o=e==="error",a=this._events;if(a!==void 0)o=o&&a.error===void 0;else if(!o)return!1;if(o){var u;if(t.length>0&&(u=t[0]),u instanceof Error)throw u;var f=new Error("Unhandled error."+(u?" ("+u.message+")":""));throw f.context=u,f}var v=a[e];if(v===void 0)return!1;if(typeof v=="function")gh(v,this,t);else for(var p=v.length,w=Dh(v,p),i=0;i<p;++i)gh(w[i],this,t);return!0};function bh(r,e,t,i){var o,a,u;if(Bs(t),a=r._events,a===void 0?(a=r._events=Object.create(null),r._eventsCount=0):(a.newListener!==void 0&&(r.emit("newListener",e,t.listener?t.listener:t),a=r._events),u=a[e]),u===void 0)u=a[e]=t,++r._eventsCount;else if(typeof u=="function"?u=a[e]=i?[t,u]:[u,t]:i?u.unshift(t):u.push(t),o=_h(r),o>0&&u.length>o&&!u.warned){u.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=r,f.type=e,f.count=u.length,Hg(f)}return r}st.prototype.addListener=function(e,t){return bh(this,e,t,!1)},st.prototype.on=st.prototype.addListener,st.prototype.prependListener=function(e,t){return bh(this,e,t,!0)};function Bg(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function mh(r,e,t){var i={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},o=Bg.bind(i);return o.listener=t,i.wrapFn=o,o}st.prototype.once=function(e,t){return Bs(t),this.on(e,mh(this,e,t)),this},st.prototype.prependOnceListener=function(e,t){return Bs(t),this.prependListener(e,mh(this,e,t)),this},st.prototype.removeListener=function(e,t){var i,o,a,u,f;if(Bs(t),o=this._events,o===void 0)return this;if(i=o[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(a=-1,u=i.length-1;u>=0;u--)if(i[u]===t||i[u].listener===t){f=i[u].listener,a=u;break}if(a<0)return this;a===0?i.shift():zg(i,a),i.length===1&&(o[e]=i[0]),o.removeListener!==void 0&&this.emit("removeListener",e,f||t)}return this},st.prototype.off=st.prototype.removeListener,st.prototype.removeAllListeners=function(e){var t,i,o;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var a=Object.keys(i),u;for(o=0;o<a.length;++o)u=a[o],u!=="removeListener"&&this.removeAllListeners(u);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this};function wh(r,e,t){var i=r._events;if(i===void 0)return[];var o=i[e];return o===void 0?[]:typeof o=="function"?t?[o.listener||o]:[o]:t?Kg(o):Dh(o,o.length)}st.prototype.listeners=function(e){return wh(this,e,!0)},st.prototype.rawListeners=function(e){return wh(this,e,!1)},st.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):Eh.call(r,e)},st.prototype.listenerCount=Eh;function Eh(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}st.prototype.eventNames=function(){return this._eventsCount>0?Hs(this._events):[]};function Dh(r,e){for(var t=new Array(e),i=0;i<e;++i)t[i]=r[i];return t}function zg(r,e){for(;e+1<r.length;e++)r[e]=r[e+1];r.pop()}function Kg(r){for(var e=new Array(r.length),t=0;t<e.length;++t)e[t]=r[t].listener||r[t];return e}function Vg(r,e){return new Promise(function(t,i){function o(u){r.removeListener(e,a),i(u)}function a(){typeof r.removeListener=="function"&&r.removeListener("error",o),t([].slice.call(arguments))}Sh(r,e,a,{once:!0}),e!=="error"&&kg(r,o,{once:!0})})}function kg(r,e,t){typeof r.on=="function"&&Sh(r,"error",e,t)}function Sh(r,e,t,i){if(typeof r.on=="function")i.once?r.once(e,t):r.on(e,t);else if(typeof r.addEventListener=="function")r.addEventListener(e,function o(a){i.once&&r.removeEventListener(e,o),t(a)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof r)}var Ea={},zs={},Ne={},xh={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function e(f,v){var p=f>>>16&65535,w=f&65535,I=v>>>16&65535,S=v&65535;return w*S+(p*S+w*I<<16>>>0)|0}r.mul=Math.imul||e;function t(f,v){return f+v|0}r.add=t;function i(f,v){return f-v|0}r.sub=i;function o(f,v){return f<<v|f>>>32-v}r.rotl=o;function a(f,v){return f<<32-v|f>>>v}r.rotr=a;function u(f){return typeof f=="number"&&isFinite(f)&&Math.floor(f)===f}r.isInteger=Number.isInteger||u,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(f){return r.isInteger(f)&&f>=-r.MAX_SAFE_INTEGER&&f<=r.MAX_SAFE_INTEGER}})(xh),Object.defineProperty(Ne,"__esModule",{value:!0});var Oh=xh;function Gg(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}Ne.readInt16BE=Gg;function Wg(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}Ne.readUint16BE=Wg;function Yg(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}Ne.readInt16LE=Yg;function Jg(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}Ne.readUint16LE=Jg;function Ih(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}Ne.writeUint16BE=Ih,Ne.writeInt16BE=Ih;function Ph(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}Ne.writeUint16LE=Ph,Ne.writeInt16LE=Ph;function Da(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}Ne.readInt32BE=Da;function Sa(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}Ne.readUint32BE=Sa;function xa(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}Ne.readInt32LE=xa;function Oa(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}Ne.readUint32LE=Oa;function Ks(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}Ne.writeUint32BE=Ks,Ne.writeInt32BE=Ks;function Vs(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}Ne.writeUint32LE=Vs,Ne.writeInt32LE=Vs;function Qg(r,e){e===void 0&&(e=0);var t=Da(r,e),i=Da(r,e+4);return t*4294967296+i-(i>>31)*4294967296}Ne.readInt64BE=Qg;function Xg(r,e){e===void 0&&(e=0);var t=Sa(r,e),i=Sa(r,e+4);return t*4294967296+i}Ne.readUint64BE=Xg;function Zg(r,e){e===void 0&&(e=0);var t=xa(r,e),i=xa(r,e+4);return i*4294967296+t-(t>>31)*4294967296}Ne.readInt64LE=Zg;function e0(r,e){e===void 0&&(e=0);var t=Oa(r,e),i=Oa(r,e+4);return i*4294967296+t}Ne.readUint64LE=e0;function Ch(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Ks(r/4294967296>>>0,e,t),Ks(r>>>0,e,t+4),e}Ne.writeUint64BE=Ch,Ne.writeInt64BE=Ch;function Ah(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Vs(r>>>0,e,t),Vs(r/4294967296>>>0,e,t+4),e}Ne.writeUint64LE=Ah,Ne.writeInt64LE=Ah;function t0(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,o=1,a=r/8+t-1;a>=t;a--)i+=e[a]*o,o*=256;return i}Ne.readUintBE=t0;function r0(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,o=1,a=t;a<t+r/8;a++)i+=e[a]*o,o*=256;return i}Ne.readUintLE=r0;function n0(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Oh.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var o=1,a=r/8+i-1;a>=i;a--)t[a]=e/o&255,o*=256;return t}Ne.writeUintBE=n0;function i0(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Oh.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var o=1,a=i;a<i+r/8;a++)t[a]=e/o&255,o*=256;return t}Ne.writeUintLE=i0;function s0(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e)}Ne.readFloat32BE=s0;function o0(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e,!0)}Ne.readFloat32LE=o0;function a0(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e)}Ne.readFloat64BE=a0;function c0(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e,!0)}Ne.readFloat64LE=c0;function u0(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,r),e}Ne.writeFloat32BE=u0;function h0(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,r,!0),e}Ne.writeFloat32LE=h0;function l0(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,r),e}Ne.writeFloat64BE=l0;function f0(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,r,!0),e}Ne.writeFloat64LE=f0;var Dr={};Object.defineProperty(Dr,"__esModule",{value:!0});function d0(r){for(var e=0;e<r.length;e++)r[e]=0;return r}Dr.wipe=d0,Object.defineProperty(zs,"__esModule",{value:!0});var Zt=Ne,Ia=Dr,p0=20;function g0(r,e,t){for(var i=1634760805,o=857760878,a=2036477234,u=1797285236,f=t[3]<<24|t[2]<<16|t[1]<<8|t[0],v=t[7]<<24|t[6]<<16|t[5]<<8|t[4],p=t[11]<<24|t[10]<<16|t[9]<<8|t[8],w=t[15]<<24|t[14]<<16|t[13]<<8|t[12],I=t[19]<<24|t[18]<<16|t[17]<<8|t[16],S=t[23]<<24|t[22]<<16|t[21]<<8|t[20],C=t[27]<<24|t[26]<<16|t[25]<<8|t[24],R=t[31]<<24|t[30]<<16|t[29]<<8|t[28],B=e[3]<<24|e[2]<<16|e[1]<<8|e[0],K=e[7]<<24|e[6]<<16|e[5]<<8|e[4],se=e[11]<<24|e[10]<<16|e[9]<<8|e[8],$=e[15]<<24|e[14]<<16|e[13]<<8|e[12],U=i,x=o,T=a,E=u,h=f,b=v,G=p,Y=w,ie=I,ce=S,de=C,m=R,P=B,ee=K,Q=se,V=$,k=0;k<p0;k+=2)U=U+h|0,P^=U,P=P>>>32-16|P<<16,ie=ie+P|0,h^=ie,h=h>>>32-12|h<<12,x=x+b|0,ee^=x,ee=ee>>>32-16|ee<<16,ce=ce+ee|0,b^=ce,b=b>>>32-12|b<<12,T=T+G|0,Q^=T,Q=Q>>>32-16|Q<<16,de=de+Q|0,G^=de,G=G>>>32-12|G<<12,E=E+Y|0,V^=E,V=V>>>32-16|V<<16,m=m+V|0,Y^=m,Y=Y>>>32-12|Y<<12,T=T+G|0,Q^=T,Q=Q>>>32-8|Q<<8,de=de+Q|0,G^=de,G=G>>>32-7|G<<7,E=E+Y|0,V^=E,V=V>>>32-8|V<<8,m=m+V|0,Y^=m,Y=Y>>>32-7|Y<<7,x=x+b|0,ee^=x,ee=ee>>>32-8|ee<<8,ce=ce+ee|0,b^=ce,b=b>>>32-7|b<<7,U=U+h|0,P^=U,P=P>>>32-8|P<<8,ie=ie+P|0,h^=ie,h=h>>>32-7|h<<7,U=U+b|0,V^=U,V=V>>>32-16|V<<16,de=de+V|0,b^=de,b=b>>>32-12|b<<12,x=x+G|0,P^=x,P=P>>>32-16|P<<16,m=m+P|0,G^=m,G=G>>>32-12|G<<12,T=T+Y|0,ee^=T,ee=ee>>>32-16|ee<<16,ie=ie+ee|0,Y^=ie,Y=Y>>>32-12|Y<<12,E=E+h|0,Q^=E,Q=Q>>>32-16|Q<<16,ce=ce+Q|0,h^=ce,h=h>>>32-12|h<<12,T=T+Y|0,ee^=T,ee=ee>>>32-8|ee<<8,ie=ie+ee|0,Y^=ie,Y=Y>>>32-7|Y<<7,E=E+h|0,Q^=E,Q=Q>>>32-8|Q<<8,ce=ce+Q|0,h^=ce,h=h>>>32-7|h<<7,x=x+G|0,P^=x,P=P>>>32-8|P<<8,m=m+P|0,G^=m,G=G>>>32-7|G<<7,U=U+b|0,V^=U,V=V>>>32-8|V<<8,de=de+V|0,b^=de,b=b>>>32-7|b<<7;Zt.writeUint32LE(U+i|0,r,0),Zt.writeUint32LE(x+o|0,r,4),Zt.writeUint32LE(T+a|0,r,8),Zt.writeUint32LE(E+u|0,r,12),Zt.writeUint32LE(h+f|0,r,16),Zt.writeUint32LE(b+v|0,r,20),Zt.writeUint32LE(G+p|0,r,24),Zt.writeUint32LE(Y+w|0,r,28),Zt.writeUint32LE(ie+I|0,r,32),Zt.writeUint32LE(ce+S|0,r,36),Zt.writeUint32LE(de+C|0,r,40),Zt.writeUint32LE(m+R|0,r,44),Zt.writeUint32LE(P+B|0,r,48),Zt.writeUint32LE(ee+K|0,r,52),Zt.writeUint32LE(Q+se|0,r,56),Zt.writeUint32LE(V+$|0,r,60)}function Th(r,e,t,i,o){if(o===void 0&&(o=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<t.length)throw new Error("ChaCha: destination is shorter than source");var a,u;if(o===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");a=new Uint8Array(16),u=a.length-e.length,a.set(e,u)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");a=e,u=o}for(var f=new Uint8Array(64),v=0;v<t.length;v+=64){g0(f,a,r);for(var p=v;p<v+64&&p<t.length;p++)i[p]=t[p]^f[p-v];y0(a,0,u)}return Ia.wipe(f),o===0&&Ia.wipe(a),i}zs.streamXOR=Th;function v0(r,e,t,i){return i===void 0&&(i=0),Ia.wipe(t),Th(r,e,t,t,i)}zs.stream=v0;function y0(r,e,t){for(var i=1;t--;)i=i+(r[e]&255)|0,r[e]=i&255,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var Rh={},On={};Object.defineProperty(On,"__esModule",{value:!0});function _0(r,e,t){return~(r-1)&e|r-1&t}On.select=_0;function b0(r,e){return(r|0)-(e|0)-1>>>31&1}On.lessOrEqual=b0;function Nh(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i<r.length;i++)t|=r[i]^e[i];return 1&t-1>>>8}On.compare=Nh;function m0(r,e){return r.length===0||e.length===0?!1:Nh(r,e)!==0}On.equal=m0,function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=On,t=Dr;r.DIGEST_LENGTH=16;var i=function(){function u(f){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var v=f[0]|f[1]<<8;this._r[0]=v&8191;var p=f[2]|f[3]<<8;this._r[1]=(v>>>13|p<<3)&8191;var w=f[4]|f[5]<<8;this._r[2]=(p>>>10|w<<6)&7939;var I=f[6]|f[7]<<8;this._r[3]=(w>>>7|I<<9)&8191;var S=f[8]|f[9]<<8;this._r[4]=(I>>>4|S<<12)&255,this._r[5]=S>>>1&8190;var C=f[10]|f[11]<<8;this._r[6]=(S>>>14|C<<2)&8191;var R=f[12]|f[13]<<8;this._r[7]=(C>>>11|R<<5)&8065;var B=f[14]|f[15]<<8;this._r[8]=(R>>>8|B<<8)&8191,this._r[9]=B>>>5&127,this._pad[0]=f[16]|f[17]<<8,this._pad[1]=f[18]|f[19]<<8,this._pad[2]=f[20]|f[21]<<8,this._pad[3]=f[22]|f[23]<<8,this._pad[4]=f[24]|f[25]<<8,this._pad[5]=f[26]|f[27]<<8,this._pad[6]=f[28]|f[29]<<8,this._pad[7]=f[30]|f[31]<<8}return u.prototype._blocks=function(f,v,p){for(var w=this._fin?0:2048,I=this._h[0],S=this._h[1],C=this._h[2],R=this._h[3],B=this._h[4],K=this._h[5],se=this._h[6],$=this._h[7],U=this._h[8],x=this._h[9],T=this._r[0],E=this._r[1],h=this._r[2],b=this._r[3],G=this._r[4],Y=this._r[5],ie=this._r[6],ce=this._r[7],de=this._r[8],m=this._r[9];p>=16;){var P=f[v+0]|f[v+1]<<8;I+=P&8191;var ee=f[v+2]|f[v+3]<<8;S+=(P>>>13|ee<<3)&8191;var Q=f[v+4]|f[v+5]<<8;C+=(ee>>>10|Q<<6)&8191;var V=f[v+6]|f[v+7]<<8;R+=(Q>>>7|V<<9)&8191;var k=f[v+8]|f[v+9]<<8;B+=(V>>>4|k<<12)&8191,K+=k>>>1&8191;var J=f[v+10]|f[v+11]<<8;se+=(k>>>14|J<<2)&8191;var re=f[v+12]|f[v+13]<<8;$+=(J>>>11|re<<5)&8191;var me=f[v+14]|f[v+15]<<8;U+=(re>>>8|me<<8)&8191,x+=me>>>5|w;var oe=0,we=oe;we+=I*T,we+=S*(5*m),we+=C*(5*de),we+=R*(5*ce),we+=B*(5*ie),oe=we>>>13,we&=8191,we+=K*(5*Y),we+=se*(5*G),we+=$*(5*b),we+=U*(5*h),we+=x*(5*E),oe+=we>>>13,we&=8191;var le=oe;le+=I*E,le+=S*T,le+=C*(5*m),le+=R*(5*de),le+=B*(5*ce),oe=le>>>13,le&=8191,le+=K*(5*ie),le+=se*(5*Y),le+=$*(5*G),le+=U*(5*b),le+=x*(5*h),oe+=le>>>13,le&=8191;var _e=oe;_e+=I*h,_e+=S*E,_e+=C*T,_e+=R*(5*m),_e+=B*(5*de),oe=_e>>>13,_e&=8191,_e+=K*(5*ce),_e+=se*(5*ie),_e+=$*(5*Y),_e+=U*(5*G),_e+=x*(5*b),oe+=_e>>>13,_e&=8191;var H=oe;H+=I*b,H+=S*h,H+=C*E,H+=R*T,H+=B*(5*m),oe=H>>>13,H&=8191,H+=K*(5*de),H+=se*(5*ce),H+=$*(5*ie),H+=U*(5*Y),H+=x*(5*G),oe+=H>>>13,H&=8191;var q=oe;q+=I*G,q+=S*b,q+=C*h,q+=R*E,q+=B*T,oe=q>>>13,q&=8191,q+=K*(5*m),q+=se*(5*de),q+=$*(5*ce),q+=U*(5*ie),q+=x*(5*Y),oe+=q>>>13,q&=8191;var F=oe;F+=I*Y,F+=S*G,F+=C*b,F+=R*h,F+=B*E,oe=F>>>13,F&=8191,F+=K*T,F+=se*(5*m),F+=$*(5*de),F+=U*(5*ce),F+=x*(5*ie),oe+=F>>>13,F&=8191;var d=oe;d+=I*ie,d+=S*Y,d+=C*G,d+=R*b,d+=B*h,oe=d>>>13,d&=8191,d+=K*E,d+=se*T,d+=$*(5*m),d+=U*(5*de),d+=x*(5*ce),oe+=d>>>13,d&=8191;var A=oe;A+=I*ce,A+=S*ie,A+=C*Y,A+=R*G,A+=B*b,oe=A>>>13,A&=8191,A+=K*h,A+=se*E,A+=$*T,A+=U*(5*m),A+=x*(5*de),oe+=A>>>13,A&=8191;var ae=oe;ae+=I*de,ae+=S*ce,ae+=C*ie,ae+=R*Y,ae+=B*G,oe=ae>>>13,ae&=8191,ae+=K*b,ae+=se*h,ae+=$*E,ae+=U*T,ae+=x*(5*m),oe+=ae>>>13,ae&=8191;var fe=oe;fe+=I*m,fe+=S*de,fe+=C*ce,fe+=R*ie,fe+=B*Y,oe=fe>>>13,fe&=8191,fe+=K*G,fe+=se*b,fe+=$*h,fe+=U*E,fe+=x*T,oe+=fe>>>13,fe&=8191,oe=(oe<<2)+oe|0,oe=oe+we|0,we=oe&8191,oe=oe>>>13,le+=oe,I=we,S=le,C=_e,R=H,B=q,K=F,se=d,$=A,U=ae,x=fe,v+=16,p-=16}this._h[0]=I,this._h[1]=S,this._h[2]=C,this._h[3]=R,this._h[4]=B,this._h[5]=K,this._h[6]=se,this._h[7]=$,this._h[8]=U,this._h[9]=x},u.prototype.finish=function(f,v){v===void 0&&(v=0);var p=new Uint16Array(10),w,I,S,C;if(this._leftover){for(C=this._leftover,this._buffer[C++]=1;C<16;C++)this._buffer[C]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(w=this._h[1]>>>13,this._h[1]&=8191,C=2;C<10;C++)this._h[C]+=w,w=this._h[C]>>>13,this._h[C]&=8191;for(this._h[0]+=w*5,w=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=w,w=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=w,p[0]=this._h[0]+5,w=p[0]>>>13,p[0]&=8191,C=1;C<10;C++)p[C]=this._h[C]+w,w=p[C]>>>13,p[C]&=8191;for(p[9]-=8192,I=(w^1)-1,C=0;C<10;C++)p[C]&=I;for(I=~I,C=0;C<10;C++)this._h[C]=this._h[C]&I|p[C];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,S=this._h[0]+this._pad[0],this._h[0]=S&65535,C=1;C<8;C++)S=(this._h[C]+this._pad[C]|0)+(S>>>16)|0,this._h[C]=S&65535;return f[v+0]=this._h[0]>>>0,f[v+1]=this._h[0]>>>8,f[v+2]=this._h[1]>>>0,f[v+3]=this._h[1]>>>8,f[v+4]=this._h[2]>>>0,f[v+5]=this._h[2]>>>8,f[v+6]=this._h[3]>>>0,f[v+7]=this._h[3]>>>8,f[v+8]=this._h[4]>>>0,f[v+9]=this._h[4]>>>8,f[v+10]=this._h[5]>>>0,f[v+11]=this._h[5]>>>8,f[v+12]=this._h[6]>>>0,f[v+13]=this._h[6]>>>8,f[v+14]=this._h[7]>>>0,f[v+15]=this._h[7]>>>8,this._finished=!0,this},u.prototype.update=function(f){var v=0,p=f.length,w;if(this._leftover){w=16-this._leftover,w>p&&(w=p);for(var I=0;I<w;I++)this._buffer[this._leftover+I]=f[v+I];if(p-=w,v+=w,this._leftover+=w,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(p>=16&&(w=p-p%16,this._blocks(f,v,w),v+=w,p-=w),p){for(var I=0;I<p;I++)this._buffer[this._leftover+I]=f[v+I];this._leftover+=p}return this},u.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var f=new Uint8Array(16);return this.finish(f),f},u.prototype.clean=function(){return t.wipe(this._buffer),t.wipe(this._r),t.wipe(this._h),t.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},u}();r.Poly1305=i;function o(u,f){var v=new i(u);v.update(f);var p=v.digest();return v.clean(),p}r.oneTimeAuth=o;function a(u,f){return u.length!==r.DIGEST_LENGTH||f.length!==r.DIGEST_LENGTH?!1:e.equal(u,f)}r.equal=a}(Rh),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=zs,t=Rh,i=Dr,o=Ne,a=On;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var u=new Uint8Array(16),f=function(){function v(p){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,p.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(p)}return v.prototype.seal=function(p,w,I,S){if(p.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var C=new Uint8Array(16);C.set(p,C.length-p.length);var R=new Uint8Array(32);e.stream(this._key,C,R,4);var B=w.length+this.tagLength,K;if(S){if(S.length!==B)throw new Error("ChaCha20Poly1305: incorrect destination length");K=S}else K=new Uint8Array(B);return e.streamXOR(this._key,C,w,K,4),this._authenticate(K.subarray(K.length-this.tagLength,K.length),R,K.subarray(0,K.length-this.tagLength),I),i.wipe(C),K},v.prototype.open=function(p,w,I,S){if(p.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(w.length<this.tagLength)return null;var C=new Uint8Array(16);C.set(p,C.length-p.length);var R=new Uint8Array(32);e.stream(this._key,C,R,4);var B=new Uint8Array(this.tagLength);if(this._authenticate(B,R,w.subarray(0,w.length-this.tagLength),I),!a.equal(B,w.subarray(w.length-this.tagLength,w.length)))return null;var K=w.length-this.tagLength,se;if(S){if(S.length!==K)throw new Error("ChaCha20Poly1305: incorrect destination length");se=S}else se=new Uint8Array(K);return e.streamXOR(this._key,C,w.subarray(0,w.length-this.tagLength),se,4),i.wipe(C),se},v.prototype.clean=function(){return i.wipe(this._key),this},v.prototype._authenticate=function(p,w,I,S){var C=new t.Poly1305(w);S&&(C.update(S),S.length%16>0&&C.update(u.subarray(S.length%16))),C.update(I),I.length%16>0&&C.update(u.subarray(I.length%16));var R=new Uint8Array(8);S&&o.writeUint64LE(S.length,R),C.update(R),o.writeUint64LE(I.length,R),C.update(R);for(var B=C.digest(),K=0;K<B.length;K++)p[K]=B[K];C.clean(),i.wipe(B),i.wipe(R)},v}();r.ChaCha20Poly1305=f}(Ea);var $h={},Ki={},Pa={};Object.defineProperty(Pa,"__esModule",{value:!0});function w0(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Pa.isSerializableHash=w0,Object.defineProperty(Ki,"__esModule",{value:!0});var Qr=Pa,E0=On,D0=Dr,Fh=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var o=0;o<i.length;o++)i[o]^=54;this._inner.update(i);for(var o=0;o<i.length;o++)i[o]^=106;this._outer.update(i),Qr.isSerializableHash(this._inner)&&Qr.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),D0.wipe(i)}return r.prototype.reset=function(){if(!Qr.isSerializableHash(this._inner)||!Qr.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.clean=function(){Qr.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Qr.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(e){return this._inner.update(e),this},r.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(!Qr.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(e){if(!Qr.isSerializableHash(this._inner)||!Qr.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.cleanSavedState=function(e){if(!Qr.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},r}();Ki.HMAC=Fh;function S0(r,e,t){var i=new Fh(r,e);i.update(t);var o=i.digest();return i.clean(),o}Ki.hmac=S0,Ki.equal=E0.equal,Object.defineProperty($h,"__esModule",{value:!0});var Lh=Ki,Uh=Dr,x0=function(){function r(e,t,i,o){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=o;var a=Lh.hmac(this._hash,i,t);this._hmac=new Lh.HMAC(e,a),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i<t.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[i]=this._buffer[this._bufpos++];return t},r.prototype.clean=function(){this._hmac.clean(),Uh.wipe(this._buffer),Uh.wipe(this._counter),this._bufpos=0},r}(),O0=$h.HKDF=x0,di={},ks={},Gs={};Object.defineProperty(Gs,"__esModule",{value:!0}),Gs.BrowserRandomSource=void 0;const jh=65536;class I0{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let i=0;i<t.length;i+=jh)this._crypto.getRandomValues(t.subarray(i,i+Math.min(t.length-i,jh)));return t}}Gs.BrowserRandomSource=I0;function P0(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ws={},C0={},A0=Object.freeze({__proto__:null,default:C0}),T0=Bn(A0);Object.defineProperty(Ws,"__esModule",{value:!0}),Ws.NodeRandomSource=void 0;const R0=Dr;class N0{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof P0<"u"){const e=T0;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(e);for(let o=0;o<i.length;o++)i[o]=t[o];return(0,R0.wipe)(t),i}}Ws.NodeRandomSource=N0,Object.defineProperty(ks,"__esModule",{value:!0}),ks.SystemRandomSource=void 0;const $0=Gs,F0=Ws;class L0{constructor(){if(this.isAvailable=!1,this.name="",this._source=new $0.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new F0.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}ks.SystemRandomSource=L0,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const e=ks,t=Ne,i=Dr;r.defaultRandomSource=new e.SystemRandomSource;function o(p,w=r.defaultRandomSource){return w.randomBytes(p)}r.randomBytes=o;function a(p=r.defaultRandomSource){const w=o(4,p),I=(0,t.readUint32LE)(w);return(0,i.wipe)(w),I}r.randomUint32=a;const u="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function f(p,w=u,I=r.defaultRandomSource){if(w.length<2)throw new Error("randomString charset is too short");if(w.length>256)throw new Error("randomString charset is too long");let S="";const C=w.length,R=256-256%C;for(;p>0;){const B=o(Math.ceil(p*256/R),I);for(let K=0;K<B.length&&p>0;K++){const se=B[K];se<R&&(S+=w.charAt(se%C),p--)}(0,i.wipe)(B)}return S}r.randomString=f;function v(p,w=u,I=r.defaultRandomSource){const S=Math.ceil(p/(Math.log(w.length)/Math.LN2));return f(S,w,I)}r.randomStringForEntropy=v}(di);var Ys={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Ne,t=Dr;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var i=function(){function f(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._temp),this.reset()},f.prototype.update=function(v,p){if(p===void 0&&(p=v.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var w=0;if(this._bytesHashed+=p,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&p>0;)this._buffer[this._bufferLength++]=v[w++],p--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(p>=this.blockSize&&(w=a(this._temp,this._state,v,w,p),p%=this.blockSize);p>0;)this._buffer[this._bufferLength++]=v[w++],p--;return this},f.prototype.finish=function(v){if(!this._finished){var p=this._bytesHashed,w=this._bufferLength,I=p/536870912|0,S=p<<3,C=p%64<56?64:128;this._buffer[w]=128;for(var R=w+1;R<C-8;R++)this._buffer[R]=0;e.writeUint32BE(I,this._buffer,C-8),e.writeUint32BE(S,this._buffer,C-4),a(this._temp,this._state,this._buffer,0,C),this._finished=!0}for(var R=0;R<this.digestLength/4;R++)e.writeUint32BE(this._state[R],v,R*4);return this},f.prototype.digest=function(){var v=new Uint8Array(this.digestLength);return this.finish(v),v},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(v){return this._state.set(v.state),this._bufferLength=v.bufferLength,v.buffer&&this._buffer.set(v.buffer),this._bytesHashed=v.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(v){t.wipe(v.state),v.buffer&&t.wipe(v.buffer),v.bufferLength=0,v.bytesHashed=0},f}();r.SHA256=i;var o=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function a(f,v,p,w,I){for(;I>=64;){for(var S=v[0],C=v[1],R=v[2],B=v[3],K=v[4],se=v[5],$=v[6],U=v[7],x=0;x<16;x++){var T=w+x*4;f[x]=e.readUint32BE(p,T)}for(var x=16;x<64;x++){var E=f[x-2],h=(E>>>17|E<<32-17)^(E>>>19|E<<32-19)^E>>>10;E=f[x-15];var b=(E>>>7|E<<32-7)^(E>>>18|E<<32-18)^E>>>3;f[x]=(h+f[x-7]|0)+(b+f[x-16]|0)}for(var x=0;x<64;x++){var h=(((K>>>6|K<<26)^(K>>>11|K<<21)^(K>>>25|K<<7))+(K&se^~K&$)|0)+(U+(o[x]+f[x]|0)|0)|0,b=((S>>>2|S<<32-2)^(S>>>13|S<<32-13)^(S>>>22|S<<32-22))+(S&C^S&R^C&R)|0;U=$,$=se,se=K,K=B+h|0,B=R,R=C,C=S,S=h+b|0}v[0]+=S,v[1]+=C,v[2]+=R,v[3]+=B,v[4]+=K,v[5]+=se,v[6]+=$,v[7]+=U,w+=64,I-=64}return w}function u(f){var v=new i;v.update(f);var p=v.digest();return v.clean(),p}r.hash=u})(Ys);var Ca={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const e=di,t=Dr;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function i(x){const T=new Float64Array(16);if(x)for(let E=0;E<x.length;E++)T[E]=x[E];return T}const o=new Uint8Array(32);o[0]=9;const a=i([56129,1]);function u(x){let T=1;for(let E=0;E<16;E++){let h=x[E]+T+65535;T=Math.floor(h/65536),x[E]=h-T*65536}x[0]+=T-1+37*(T-1)}function f(x,T,E){const h=~(E-1);for(let b=0;b<16;b++){const G=h&(x[b]^T[b]);x[b]^=G,T[b]^=G}}function v(x,T){const E=i(),h=i();for(let b=0;b<16;b++)h[b]=T[b];u(h),u(h),u(h);for(let b=0;b<2;b++){E[0]=h[0]-65517;for(let Y=1;Y<15;Y++)E[Y]=h[Y]-65535-(E[Y-1]>>16&1),E[Y-1]&=65535;E[15]=h[15]-32767-(E[14]>>16&1);const G=E[15]>>16&1;E[14]&=65535,f(h,E,1-G)}for(let b=0;b<16;b++)x[2*b]=h[b]&255,x[2*b+1]=h[b]>>8}function p(x,T){for(let E=0;E<16;E++)x[E]=T[2*E]+(T[2*E+1]<<8);x[15]&=32767}function w(x,T,E){for(let h=0;h<16;h++)x[h]=T[h]+E[h]}function I(x,T,E){for(let h=0;h<16;h++)x[h]=T[h]-E[h]}function S(x,T,E){let h,b,G=0,Y=0,ie=0,ce=0,de=0,m=0,P=0,ee=0,Q=0,V=0,k=0,J=0,re=0,me=0,oe=0,we=0,le=0,_e=0,H=0,q=0,F=0,d=0,A=0,ae=0,fe=0,xe=0,Be=0,Ve=0,Ue=0,vt=0,yt=0,Me=E[0],Oe=E[1],$e=E[2],Fe=E[3],qe=E[4],Pe=E[5],Le=E[6],Se=E[7],Ce=E[8],ze=E[9],Ie=E[10],ke=E[11],We=E[12],et=E[13],tt=E[14],Qe=E[15];h=T[0],G+=h*Me,Y+=h*Oe,ie+=h*$e,ce+=h*Fe,de+=h*qe,m+=h*Pe,P+=h*Le,ee+=h*Se,Q+=h*Ce,V+=h*ze,k+=h*Ie,J+=h*ke,re+=h*We,me+=h*et,oe+=h*tt,we+=h*Qe,h=T[1],Y+=h*Me,ie+=h*Oe,ce+=h*$e,de+=h*Fe,m+=h*qe,P+=h*Pe,ee+=h*Le,Q+=h*Se,V+=h*Ce,k+=h*ze,J+=h*Ie,re+=h*ke,me+=h*We,oe+=h*et,we+=h*tt,le+=h*Qe,h=T[2],ie+=h*Me,ce+=h*Oe,de+=h*$e,m+=h*Fe,P+=h*qe,ee+=h*Pe,Q+=h*Le,V+=h*Se,k+=h*Ce,J+=h*ze,re+=h*Ie,me+=h*ke,oe+=h*We,we+=h*et,le+=h*tt,_e+=h*Qe,h=T[3],ce+=h*Me,de+=h*Oe,m+=h*$e,P+=h*Fe,ee+=h*qe,Q+=h*Pe,V+=h*Le,k+=h*Se,J+=h*Ce,re+=h*ze,me+=h*Ie,oe+=h*ke,we+=h*We,le+=h*et,_e+=h*tt,H+=h*Qe,h=T[4],de+=h*Me,m+=h*Oe,P+=h*$e,ee+=h*Fe,Q+=h*qe,V+=h*Pe,k+=h*Le,J+=h*Se,re+=h*Ce,me+=h*ze,oe+=h*Ie,we+=h*ke,le+=h*We,_e+=h*et,H+=h*tt,q+=h*Qe,h=T[5],m+=h*Me,P+=h*Oe,ee+=h*$e,Q+=h*Fe,V+=h*qe,k+=h*Pe,J+=h*Le,re+=h*Se,me+=h*Ce,oe+=h*ze,we+=h*Ie,le+=h*ke,_e+=h*We,H+=h*et,q+=h*tt,F+=h*Qe,h=T[6],P+=h*Me,ee+=h*Oe,Q+=h*$e,V+=h*Fe,k+=h*qe,J+=h*Pe,re+=h*Le,me+=h*Se,oe+=h*Ce,we+=h*ze,le+=h*Ie,_e+=h*ke,H+=h*We,q+=h*et,F+=h*tt,d+=h*Qe,h=T[7],ee+=h*Me,Q+=h*Oe,V+=h*$e,k+=h*Fe,J+=h*qe,re+=h*Pe,me+=h*Le,oe+=h*Se,we+=h*Ce,le+=h*ze,_e+=h*Ie,H+=h*ke,q+=h*We,F+=h*et,d+=h*tt,A+=h*Qe,h=T[8],Q+=h*Me,V+=h*Oe,k+=h*$e,J+=h*Fe,re+=h*qe,me+=h*Pe,oe+=h*Le,we+=h*Se,le+=h*Ce,_e+=h*ze,H+=h*Ie,q+=h*ke,F+=h*We,d+=h*et,A+=h*tt,ae+=h*Qe,h=T[9],V+=h*Me,k+=h*Oe,J+=h*$e,re+=h*Fe,me+=h*qe,oe+=h*Pe,we+=h*Le,le+=h*Se,_e+=h*Ce,H+=h*ze,q+=h*Ie,F+=h*ke,d+=h*We,A+=h*et,ae+=h*tt,fe+=h*Qe,h=T[10],k+=h*Me,J+=h*Oe,re+=h*$e,me+=h*Fe,oe+=h*qe,we+=h*Pe,le+=h*Le,_e+=h*Se,H+=h*Ce,q+=h*ze,F+=h*Ie,d+=h*ke,A+=h*We,ae+=h*et,fe+=h*tt,xe+=h*Qe,h=T[11],J+=h*Me,re+=h*Oe,me+=h*$e,oe+=h*Fe,we+=h*qe,le+=h*Pe,_e+=h*Le,H+=h*Se,q+=h*Ce,F+=h*ze,d+=h*Ie,A+=h*ke,ae+=h*We,fe+=h*et,xe+=h*tt,Be+=h*Qe,h=T[12],re+=h*Me,me+=h*Oe,oe+=h*$e,we+=h*Fe,le+=h*qe,_e+=h*Pe,H+=h*Le,q+=h*Se,F+=h*Ce,d+=h*ze,A+=h*Ie,ae+=h*ke,fe+=h*We,xe+=h*et,Be+=h*tt,Ve+=h*Qe,h=T[13],me+=h*Me,oe+=h*Oe,we+=h*$e,le+=h*Fe,_e+=h*qe,H+=h*Pe,q+=h*Le,F+=h*Se,d+=h*Ce,A+=h*ze,ae+=h*Ie,fe+=h*ke,xe+=h*We,Be+=h*et,Ve+=h*tt,Ue+=h*Qe,h=T[14],oe+=h*Me,we+=h*Oe,le+=h*$e,_e+=h*Fe,H+=h*qe,q+=h*Pe,F+=h*Le,d+=h*Se,A+=h*Ce,ae+=h*ze,fe+=h*Ie,xe+=h*ke,Be+=h*We,Ve+=h*et,Ue+=h*tt,vt+=h*Qe,h=T[15],we+=h*Me,le+=h*Oe,_e+=h*$e,H+=h*Fe,q+=h*qe,F+=h*Pe,d+=h*Le,A+=h*Se,ae+=h*Ce,fe+=h*ze,xe+=h*Ie,Be+=h*ke,Ve+=h*We,Ue+=h*et,vt+=h*tt,yt+=h*Qe,G+=38*le,Y+=38*_e,ie+=38*H,ce+=38*q,de+=38*F,m+=38*d,P+=38*A,ee+=38*ae,Q+=38*fe,V+=38*xe,k+=38*Be,J+=38*Ve,re+=38*Ue,me+=38*vt,oe+=38*yt,b=1,h=G+b+65535,b=Math.floor(h/65536),G=h-b*65536,h=Y+b+65535,b=Math.floor(h/65536),Y=h-b*65536,h=ie+b+65535,b=Math.floor(h/65536),ie=h-b*65536,h=ce+b+65535,b=Math.floor(h/65536),ce=h-b*65536,h=de+b+65535,b=Math.floor(h/65536),de=h-b*65536,h=m+b+65535,b=Math.floor(h/65536),m=h-b*65536,h=P+b+65535,b=Math.floor(h/65536),P=h-b*65536,h=ee+b+65535,b=Math.floor(h/65536),ee=h-b*65536,h=Q+b+65535,b=Math.floor(h/65536),Q=h-b*65536,h=V+b+65535,b=Math.floor(h/65536),V=h-b*65536,h=k+b+65535,b=Math.floor(h/65536),k=h-b*65536,h=J+b+65535,b=Math.floor(h/65536),J=h-b*65536,h=re+b+65535,b=Math.floor(h/65536),re=h-b*65536,h=me+b+65535,b=Math.floor(h/65536),me=h-b*65536,h=oe+b+65535,b=Math.floor(h/65536),oe=h-b*65536,h=we+b+65535,b=Math.floor(h/65536),we=h-b*65536,G+=b-1+37*(b-1),b=1,h=G+b+65535,b=Math.floor(h/65536),G=h-b*65536,h=Y+b+65535,b=Math.floor(h/65536),Y=h-b*65536,h=ie+b+65535,b=Math.floor(h/65536),ie=h-b*65536,h=ce+b+65535,b=Math.floor(h/65536),ce=h-b*65536,h=de+b+65535,b=Math.floor(h/65536),de=h-b*65536,h=m+b+65535,b=Math.floor(h/65536),m=h-b*65536,h=P+b+65535,b=Math.floor(h/65536),P=h-b*65536,h=ee+b+65535,b=Math.floor(h/65536),ee=h-b*65536,h=Q+b+65535,b=Math.floor(h/65536),Q=h-b*65536,h=V+b+65535,b=Math.floor(h/65536),V=h-b*65536,h=k+b+65535,b=Math.floor(h/65536),k=h-b*65536,h=J+b+65535,b=Math.floor(h/65536),J=h-b*65536,h=re+b+65535,b=Math.floor(h/65536),re=h-b*65536,h=me+b+65535,b=Math.floor(h/65536),me=h-b*65536,h=oe+b+65535,b=Math.floor(h/65536),oe=h-b*65536,h=we+b+65535,b=Math.floor(h/65536),we=h-b*65536,G+=b-1+37*(b-1),x[0]=G,x[1]=Y,x[2]=ie,x[3]=ce,x[4]=de,x[5]=m,x[6]=P,x[7]=ee,x[8]=Q,x[9]=V,x[10]=k,x[11]=J,x[12]=re,x[13]=me,x[14]=oe,x[15]=we}function C(x,T){S(x,T,T)}function R(x,T){const E=i();for(let h=0;h<16;h++)E[h]=T[h];for(let h=253;h>=0;h--)C(E,E),h!==2&&h!==4&&S(E,E,T);for(let h=0;h<16;h++)x[h]=E[h]}function B(x,T){const E=new Uint8Array(32),h=new Float64Array(80),b=i(),G=i(),Y=i(),ie=i(),ce=i(),de=i();for(let Q=0;Q<31;Q++)E[Q]=x[Q];E[31]=x[31]&127|64,E[0]&=248,p(h,T);for(let Q=0;Q<16;Q++)G[Q]=h[Q];b[0]=ie[0]=1;for(let Q=254;Q>=0;--Q){const V=E[Q>>>3]>>>(Q&7)&1;f(b,G,V),f(Y,ie,V),w(ce,b,Y),I(b,b,Y),w(Y,G,ie),I(G,G,ie),C(ie,ce),C(de,b),S(b,Y,b),S(Y,G,ce),w(ce,b,Y),I(b,b,Y),C(G,b),I(Y,ie,de),S(b,Y,a),w(b,b,ie),S(Y,Y,b),S(b,ie,de),S(ie,G,h),C(G,ce),f(b,G,V),f(Y,ie,V)}for(let Q=0;Q<16;Q++)h[Q+16]=b[Q],h[Q+32]=Y[Q],h[Q+48]=G[Q],h[Q+64]=ie[Q];const m=h.subarray(32),P=h.subarray(16);R(m,m),S(P,P,m);const ee=new Uint8Array(32);return v(ee,P),ee}r.scalarMult=B;function K(x){return B(x,o)}r.scalarMultBase=K;function se(x){if(x.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const T=new Uint8Array(x);return{publicKey:K(T),secretKey:T}}r.generateKeyPairFromSeed=se;function $(x){const T=(0,e.randomBytes)(32,x),E=se(T);return(0,t.wipe)(T),E}r.generateKeyPair=$;function U(x,T,E=!1){if(x.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(T.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const h=B(x,T);if(E){let b=0;for(let G=0;G<h.length;G++)b|=h[G];if(b===0)throw new Error("X25519: invalid shared key")}return h}r.sharedKey=U})(Ca);function Aa(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function Mh(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Aa(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Ta(r,e){e||(e=r.reduce((o,a)=>o+a.length,0));const t=Mh(e);let i=0;for(const o of r)t.set(o,i),i+=o.length;return Aa(t)}function U0(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var o=0;o<r.length;o++){var a=r.charAt(o),u=a.charCodeAt(0);if(t[u]!==255)throw new TypeError(a+" is ambiguous");t[u]=o}var f=r.length,v=r.charAt(0),p=Math.log(f)/Math.log(256),w=Math.log(256)/Math.log(f);function I(R){if(R instanceof Uint8Array||(ArrayBuffer.isView(R)?R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength):Array.isArray(R)&&(R=Uint8Array.from(R))),!(R instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(R.length===0)return"";for(var B=0,K=0,se=0,$=R.length;se!==$&&R[se]===0;)se++,B++;for(var U=($-se)*w+1>>>0,x=new Uint8Array(U);se!==$;){for(var T=R[se],E=0,h=U-1;(T!==0||E<K)&&h!==-1;h--,E++)T+=256*x[h]>>>0,x[h]=T%f>>>0,T=T/f>>>0;if(T!==0)throw new Error("Non-zero carry");K=E,se++}for(var b=U-K;b!==U&&x[b]===0;)b++;for(var G=v.repeat(B);b<U;++b)G+=r.charAt(x[b]);return G}function S(R){if(typeof R!="string")throw new TypeError("Expected String");if(R.length===0)return new Uint8Array;var B=0;if(R[B]!==" "){for(var K=0,se=0;R[B]===v;)K++,B++;for(var $=(R.length-B)*p+1>>>0,U=new Uint8Array($);R[B];){var x=t[R.charCodeAt(B)];if(x===255)return;for(var T=0,E=$-1;(x!==0||T<se)&&E!==-1;E--,T++)x+=f*U[E]>>>0,U[E]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");se=T,B++}if(R[B]!==" "){for(var h=$-se;h!==$&&U[h]===0;)h++;for(var b=new Uint8Array(K+($-h)),G=K;h!==$;)b[G++]=U[h++];return b}}}function C(R){var B=S(R);if(B)return B;throw new Error(`Non-${e} character`)}return{encode:I,decodeUnsafe:S,decode:C}}var j0=U0,M0=j0;const qh=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},q0=r=>new TextEncoder().encode(r),H0=r=>new TextDecoder().decode(r);class B0{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class z0{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Hh(this,e)}}class K0{constructor(e){this.decoders=e}or(e){return Hh(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Hh=(r,e)=>new K0({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class V0{constructor(e,t,i,o){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=o,this.encoder=new B0(e,t,i),this.decoder=new z0(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Js=({name:r,prefix:e,encode:t,decode:i})=>new V0(r,e,t,i),Vi=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:o}=M0(t,e);return Js({prefix:r,name:e,encode:i,decode:a=>qh(o(a))})},k0=(r,e,t,i)=>{const o={};for(let w=0;w<e.length;++w)o[e[w]]=w;let a=r.length;for(;r[a-1]==="=";)--a;const u=new Uint8Array(a*t/8|0);let f=0,v=0,p=0;for(let w=0;w<a;++w){const I=o[r[w]];if(I===void 0)throw new SyntaxError(`Non-${i} character`);v=v<<t|I,f+=t,f>=8&&(f-=8,u[p++]=255&v>>f)}if(f>=t||255&v<<8-f)throw new SyntaxError("Unexpected end of data");return u},G0=(r,e,t)=>{const i=e[e.length-1]==="=",o=(1<<t)-1;let a="",u=0,f=0;for(let v=0;v<r.length;++v)for(f=f<<8|r[v],u+=8;u>t;)u-=t,a+=e[o&f>>u];if(u&&(a+=e[o&f<<t-u]),i)for(;a.length*t&7;)a+="=";return a},Jt=({name:r,prefix:e,bitsPerChar:t,alphabet:i})=>Js({prefix:e,name:r,encode(o){return G0(o,i,t)},decode(o){return k0(o,i,t,r)}}),W0=Js({prefix:"\0",name:"identity",encode:r=>H0(r),decode:r=>q0(r)});var Y0=Object.freeze({__proto__:null,identity:W0});const J0=Jt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Q0=Object.freeze({__proto__:null,base2:J0});const X0=Jt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Z0=Object.freeze({__proto__:null,base8:X0});const ev=Vi({prefix:"9",name:"base10",alphabet:"0123456789"});var tv=Object.freeze({__proto__:null,base10:ev});const rv=Jt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),nv=Jt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var iv=Object.freeze({__proto__:null,base16:rv,base16upper:nv});const sv=Jt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ov=Jt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),av=Jt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),cv=Jt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),uv=Jt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),hv=Jt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),lv=Jt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),fv=Jt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),dv=Jt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var pv=Object.freeze({__proto__:null,base32:sv,base32upper:ov,base32pad:av,base32padupper:cv,base32hex:uv,base32hexupper:hv,base32hexpad:lv,base32hexpadupper:fv,base32z:dv});const gv=Vi({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),vv=Vi({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var yv=Object.freeze({__proto__:null,base36:gv,base36upper:vv});const _v=Vi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bv=Vi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var mv=Object.freeze({__proto__:null,base58btc:_v,base58flickr:bv});const wv=Jt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ev=Jt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Dv=Jt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Sv=Jt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var xv=Object.freeze({__proto__:null,base64:wv,base64pad:Ev,base64url:Dv,base64urlpad:Sv});const Bh=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Ov=Bh.reduce((r,e,t)=>(r[t]=e,r),[]),Iv=Bh.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Pv(r){return r.reduce((e,t)=>(e+=Ov[t],e),"")}function Cv(r){const e=[];for(const t of r){const i=Iv[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const Av=Js({prefix:"\u{1F680}",name:"base256emoji",encode:Pv,decode:Cv});var Tv=Object.freeze({__proto__:null,base256emoji:Av}),Rv=Kh,zh=128,Nv=127,$v=~Nv,Fv=Math.pow(2,31);function Kh(r,e,t){e=e||[],t=t||0;for(var i=t;r>=Fv;)e[t++]=r&255|zh,r/=128;for(;r&$v;)e[t++]=r&255|zh,r>>>=7;return e[t]=r|0,Kh.bytes=t-i+1,e}var Lv=Ra,Uv=128,Vh=127;function Ra(r,i){var t=0,i=i||0,o=0,a=i,u,f=r.length;do{if(a>=f)throw Ra.bytes=0,new RangeError("Could not decode varint");u=r[a++],t+=o<28?(u&Vh)<<o:(u&Vh)*Math.pow(2,o),o+=7}while(u>=Uv);return Ra.bytes=a-i,t}var jv=Math.pow(2,7),Mv=Math.pow(2,14),qv=Math.pow(2,21),Hv=Math.pow(2,28),Bv=Math.pow(2,35),zv=Math.pow(2,42),Kv=Math.pow(2,49),Vv=Math.pow(2,56),kv=Math.pow(2,63),Gv=function(r){return r<jv?1:r<Mv?2:r<qv?3:r<Hv?4:r<Bv?5:r<zv?6:r<Kv?7:r<Vv?8:r<kv?9:10},Wv={encode:Rv,decode:Lv,encodingLength:Gv},kh=Wv;const Gh=(r,e,t=0)=>(kh.encode(r,e,t),e),Wh=r=>kh.encodingLength(r),Na=(r,e)=>{const t=e.byteLength,i=Wh(r),o=i+Wh(t),a=new Uint8Array(o+t);return Gh(r,a,0),Gh(t,a,i),a.set(e,o),new Yv(r,t,e,a)};class Yv{constructor(e,t,i,o){this.code=e,this.size=t,this.digest=i,this.bytes=o}}const Yh=({name:r,code:e,encode:t})=>new Jv(r,e,t);class Jv{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Na(this.code,t):t.then(i=>Na(this.code,i))}else throw Error("Unknown type, must be binary type")}}const Jh=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),Qv=Yh({name:"sha2-256",code:18,encode:Jh("SHA-256")}),Xv=Yh({name:"sha2-512",code:19,encode:Jh("SHA-512")});var Zv=Object.freeze({__proto__:null,sha256:Qv,sha512:Xv});const Qh=0,ey="identity",Xh=qh;var ty=Object.freeze({__proto__:null,identity:{code:Qh,name:ey,encode:Xh,digest:r=>Na(Qh,Xh(r))}});new TextEncoder,new TextDecoder;const Zh={...Y0,...Q0,...Z0,...tv,...iv,...pv,...yv,...mv,...xv,...Tv};({...Zv,...ty});function el(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const tl=el("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),$a=el("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=Mh(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),rl={utf8:tl,"utf-8":tl,hex:Zh.base16,latin1:$a,ascii:$a,binary:$a,...Zh};function pr(r,e="utf8"){const t=rl[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Aa(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}function nr(r,e="utf8"){const t=rl[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var nl=function(r,e,t){if(t||arguments.length===2)for(var i=0,o=e.length,a;i<o;i++)(a||!(i in e))&&(a||(a=Array.prototype.slice.call(e,0,i)),a[i]=e[i]);return r.concat(a||Array.prototype.slice.call(e))},ry=function(){function r(e,t,i){this.name=e,this.version=t,this.os=i,this.type="browser"}return r}(),ny=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return r}(),iy=function(){function r(e,t,i,o){this.name=e,this.version=t,this.os=i,this.bot=o,this.type="bot-device"}return r}(),sy=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),oy=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),ay=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,cy=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,il=3,uy=[["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",ay]],sl=[["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 hy(r){return r?ol(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new oy:typeof navigator<"u"?ol(navigator.userAgent):dy()}function ly(r){return r!==""&&uy.reduce(function(e,t){var i=t[0],o=t[1];if(e)return e;var a=o.exec(r);return!!a&&[i,a]},!1)}function ol(r){var e=ly(r);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new sy;var o=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);o?o.length<il&&(o=nl(nl([],o,!0),py(il-o.length),!0)):o=[];var a=o.join("."),u=fy(r),f=cy.exec(r);return f&&f[1]?new iy(t,a,u,f[1]):new ry(t,a,u)}function fy(r){for(var e=0,t=sl.length;e<t;e++){var i=sl[e],o=i[0],a=i[1],u=a.exec(r);if(u)return o}return null}function dy(){var r=typeof process<"u"&&process.version;return r?new ny(process.version.slice(1)):null}function py(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}var ye={};/*! *****************************************************************************
1
+ (function(qr,Vt){typeof exports=="object"&&typeof module<"u"?Vt(exports):typeof define=="function"&&define.amd?define(["exports"],Vt):(qr=typeof globalThis<"u"?globalThis:qr||self,Vt(qr["@walletconnect/ethereum-provider"]={}))})(this,function(qr){"use strict";var Vt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ug(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Hn(n){var e=n.default;if(typeof e=="function"){var t=function(){return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(i){var o=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:function(){return n[i]}})}),t}var Yt={exports:{}},li=typeof Reflect=="object"?Reflect:null,ph=li&&typeof li.apply=="function"?li.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},qs;li&&typeof li.ownKeys=="function"?qs=li.ownKeys:Object.getOwnPropertySymbols?qs=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:qs=function(e){return Object.getOwnPropertyNames(e)};function jg(n){console&&console.warn&&console.warn(n)}var gh=Number.isNaN||function(e){return e!==e};function st(){st.init.call(this)}Yt.exports=st,Yt.exports.once=Bg,st.EventEmitter=st,st.prototype._events=void 0,st.prototype._eventsCount=0,st.prototype._maxListeners=void 0;var vh=10;function Hs(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(st,"defaultMaxListeners",{enumerable:!0,get:function(){return vh},set:function(n){if(typeof n!="number"||n<0||gh(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");vh=n}}),st.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},st.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||gh(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function yh(n){return n._maxListeners===void 0?st.defaultMaxListeners:n._maxListeners}st.prototype.getMaxListeners=function(){return yh(this)},st.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var o=e==="error",c=this._events;if(c!==void 0)o=o&&c.error===void 0;else if(!o)return!1;if(o){var u;if(t.length>0&&(u=t[0]),u instanceof Error)throw u;var f=new Error("Unhandled error."+(u?" ("+u.message+")":""));throw f.context=u,f}var v=c[e];if(v===void 0)return!1;if(typeof v=="function")ph(v,this,t);else for(var p=v.length,w=Eh(v,p),i=0;i<p;++i)ph(w[i],this,t);return!0};function _h(n,e,t,i){var o,c,u;if(Hs(t),c=n._events,c===void 0?(c=n._events=Object.create(null),n._eventsCount=0):(c.newListener!==void 0&&(n.emit("newListener",e,t.listener?t.listener:t),c=n._events),u=c[e]),u===void 0)u=c[e]=t,++n._eventsCount;else if(typeof u=="function"?u=c[e]=i?[t,u]:[u,t]:i?u.unshift(t):u.push(t),o=yh(n),o>0&&u.length>o&&!u.warned){u.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=n,f.type=e,f.count=u.length,jg(f)}return n}st.prototype.addListener=function(e,t){return _h(this,e,t,!1)},st.prototype.on=st.prototype.addListener,st.prototype.prependListener=function(e,t){return _h(this,e,t,!0)};function Mg(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function bh(n,e,t){var i={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},o=Mg.bind(i);return o.listener=t,i.wrapFn=o,o}st.prototype.once=function(e,t){return Hs(t),this.on(e,bh(this,e,t)),this},st.prototype.prependOnceListener=function(e,t){return Hs(t),this.prependListener(e,bh(this,e,t)),this},st.prototype.removeListener=function(e,t){var i,o,c,u,f;if(Hs(t),o=this._events,o===void 0)return this;if(i=o[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(c=-1,u=i.length-1;u>=0;u--)if(i[u]===t||i[u].listener===t){f=i[u].listener,c=u;break}if(c<0)return this;c===0?i.shift():qg(i,c),i.length===1&&(o[e]=i[0]),o.removeListener!==void 0&&this.emit("removeListener",e,f||t)}return this},st.prototype.off=st.prototype.removeListener,st.prototype.removeAllListeners=function(e){var t,i,o;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var c=Object.keys(i),u;for(o=0;o<c.length;++o)u=c[o],u!=="removeListener"&&this.removeAllListeners(u);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this};function mh(n,e,t){var i=n._events;if(i===void 0)return[];var o=i[e];return o===void 0?[]:typeof o=="function"?t?[o.listener||o]:[o]:t?Hg(o):Eh(o,o.length)}st.prototype.listeners=function(e){return mh(this,e,!0)},st.prototype.rawListeners=function(e){return mh(this,e,!1)},st.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):wh.call(n,e)},st.prototype.listenerCount=wh;function wh(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}st.prototype.eventNames=function(){return this._eventsCount>0?qs(this._events):[]};function Eh(n,e){for(var t=new Array(e),i=0;i<e;++i)t[i]=n[i];return t}function qg(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function Hg(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}function Bg(n,e){return new Promise(function(t,i){function o(u){n.removeListener(e,c),i(u)}function c(){typeof n.removeListener=="function"&&n.removeListener("error",o),t([].slice.call(arguments))}Dh(n,e,c,{once:!0}),e!=="error"&&zg(n,o,{once:!0})})}function zg(n,e,t){typeof n.on=="function"&&Dh(n,"error",e,t)}function Dh(n,e,t,i){if(typeof n.on=="function")i.once?n.once(e,t):n.on(e,t);else if(typeof n.addEventListener=="function")n.addEventListener(e,function o(c){i.once&&n.removeEventListener(e,o),t(c)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}var wa={},Bs={},Ne={},Sh={};(function(n){Object.defineProperty(n,"__esModule",{value:!0});function e(f,v){var p=f>>>16&65535,w=f&65535,I=v>>>16&65535,S=v&65535;return w*S+(p*S+w*I<<16>>>0)|0}n.mul=Math.imul||e;function t(f,v){return f+v|0}n.add=t;function i(f,v){return f-v|0}n.sub=i;function o(f,v){return f<<v|f>>>32-v}n.rotl=o;function c(f,v){return f<<32-v|f>>>v}n.rotr=c;function u(f){return typeof f=="number"&&isFinite(f)&&Math.floor(f)===f}n.isInteger=Number.isInteger||u,n.MAX_SAFE_INTEGER=9007199254740991,n.isSafeInteger=function(f){return n.isInteger(f)&&f>=-n.MAX_SAFE_INTEGER&&f<=n.MAX_SAFE_INTEGER}})(Sh),Object.defineProperty(Ne,"__esModule",{value:!0});var xh=Sh;function Kg(n,e){return e===void 0&&(e=0),(n[e+0]<<8|n[e+1])<<16>>16}Ne.readInt16BE=Kg;function Vg(n,e){return e===void 0&&(e=0),(n[e+0]<<8|n[e+1])>>>0}Ne.readUint16BE=Vg;function kg(n,e){return e===void 0&&(e=0),(n[e+1]<<8|n[e])<<16>>16}Ne.readInt16LE=kg;function Gg(n,e){return e===void 0&&(e=0),(n[e+1]<<8|n[e])>>>0}Ne.readUint16LE=Gg;function Oh(n,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=n>>>8,e[t+1]=n>>>0,e}Ne.writeUint16BE=Oh,Ne.writeInt16BE=Oh;function Ih(n,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=n>>>0,e[t+1]=n>>>8,e}Ne.writeUint16LE=Ih,Ne.writeInt16LE=Ih;function Ea(n,e){return e===void 0&&(e=0),n[e]<<24|n[e+1]<<16|n[e+2]<<8|n[e+3]}Ne.readInt32BE=Ea;function Da(n,e){return e===void 0&&(e=0),(n[e]<<24|n[e+1]<<16|n[e+2]<<8|n[e+3])>>>0}Ne.readUint32BE=Da;function Sa(n,e){return e===void 0&&(e=0),n[e+3]<<24|n[e+2]<<16|n[e+1]<<8|n[e]}Ne.readInt32LE=Sa;function xa(n,e){return e===void 0&&(e=0),(n[e+3]<<24|n[e+2]<<16|n[e+1]<<8|n[e])>>>0}Ne.readUint32LE=xa;function zs(n,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=n>>>24,e[t+1]=n>>>16,e[t+2]=n>>>8,e[t+3]=n>>>0,e}Ne.writeUint32BE=zs,Ne.writeInt32BE=zs;function Ks(n,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=n>>>0,e[t+1]=n>>>8,e[t+2]=n>>>16,e[t+3]=n>>>24,e}Ne.writeUint32LE=Ks,Ne.writeInt32LE=Ks;function Wg(n,e){e===void 0&&(e=0);var t=Ea(n,e),i=Ea(n,e+4);return t*4294967296+i-(i>>31)*4294967296}Ne.readInt64BE=Wg;function Yg(n,e){e===void 0&&(e=0);var t=Da(n,e),i=Da(n,e+4);return t*4294967296+i}Ne.readUint64BE=Yg;function Jg(n,e){e===void 0&&(e=0);var t=Sa(n,e),i=Sa(n,e+4);return i*4294967296+t-(t>>31)*4294967296}Ne.readInt64LE=Jg;function Qg(n,e){e===void 0&&(e=0);var t=xa(n,e),i=xa(n,e+4);return i*4294967296+t}Ne.readUint64LE=Qg;function Ph(n,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),zs(n/4294967296>>>0,e,t),zs(n>>>0,e,t+4),e}Ne.writeUint64BE=Ph,Ne.writeInt64BE=Ph;function Ch(n,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Ks(n>>>0,e,t),Ks(n/4294967296>>>0,e,t+4),e}Ne.writeUint64LE=Ch,Ne.writeInt64LE=Ch;function Xg(n,e,t){if(t===void 0&&(t=0),n%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(n/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,o=1,c=n/8+t-1;c>=t;c--)i+=e[c]*o,o*=256;return i}Ne.readUintBE=Xg;function Zg(n,e,t){if(t===void 0&&(t=0),n%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(n/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,o=1,c=t;c<t+n/8;c++)i+=e[c]*o,o*=256;return i}Ne.readUintLE=Zg;function e0(n,e,t,i){if(t===void 0&&(t=new Uint8Array(n/8)),i===void 0&&(i=0),n%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!xh.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var o=1,c=n/8+i-1;c>=i;c--)t[c]=e/o&255,o*=256;return t}Ne.writeUintBE=e0;function t0(n,e,t,i){if(t===void 0&&(t=new Uint8Array(n/8)),i===void 0&&(i=0),n%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!xh.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var o=1,c=i;c<i+n/8;c++)t[c]=e/o&255,o*=256;return t}Ne.writeUintLE=t0;function r0(n,e){e===void 0&&(e=0);var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return t.getFloat32(e)}Ne.readFloat32BE=r0;function n0(n,e){e===void 0&&(e=0);var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return t.getFloat32(e,!0)}Ne.readFloat32LE=n0;function i0(n,e){e===void 0&&(e=0);var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return t.getFloat64(e)}Ne.readFloat64BE=i0;function s0(n,e){e===void 0&&(e=0);var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return t.getFloat64(e,!0)}Ne.readFloat64LE=s0;function o0(n,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,n),e}Ne.writeFloat32BE=o0;function a0(n,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(t,n,!0),e}Ne.writeFloat32LE=a0;function c0(n,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,n),e}Ne.writeFloat64BE=c0;function u0(n,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(t,n,!0),e}Ne.writeFloat64LE=u0;var Er={};Object.defineProperty(Er,"__esModule",{value:!0});function h0(n){for(var e=0;e<n.length;e++)n[e]=0;return n}Er.wipe=h0,Object.defineProperty(Bs,"__esModule",{value:!0});var Zt=Ne,Oa=Er,l0=20;function f0(n,e,t){for(var i=1634760805,o=857760878,c=2036477234,u=1797285236,f=t[3]<<24|t[2]<<16|t[1]<<8|t[0],v=t[7]<<24|t[6]<<16|t[5]<<8|t[4],p=t[11]<<24|t[10]<<16|t[9]<<8|t[8],w=t[15]<<24|t[14]<<16|t[13]<<8|t[12],I=t[19]<<24|t[18]<<16|t[17]<<8|t[16],S=t[23]<<24|t[22]<<16|t[21]<<8|t[20],C=t[27]<<24|t[26]<<16|t[25]<<8|t[24],R=t[31]<<24|t[30]<<16|t[29]<<8|t[28],B=e[3]<<24|e[2]<<16|e[1]<<8|e[0],K=e[7]<<24|e[6]<<16|e[5]<<8|e[4],se=e[11]<<24|e[10]<<16|e[9]<<8|e[8],$=e[15]<<24|e[14]<<16|e[13]<<8|e[12],U=i,x=o,T=c,E=u,h=f,b=v,G=p,Y=w,ie=I,ce=S,de=C,m=R,P=B,ee=K,Q=se,V=$,k=0;k<l0;k+=2)U=U+h|0,P^=U,P=P>>>32-16|P<<16,ie=ie+P|0,h^=ie,h=h>>>32-12|h<<12,x=x+b|0,ee^=x,ee=ee>>>32-16|ee<<16,ce=ce+ee|0,b^=ce,b=b>>>32-12|b<<12,T=T+G|0,Q^=T,Q=Q>>>32-16|Q<<16,de=de+Q|0,G^=de,G=G>>>32-12|G<<12,E=E+Y|0,V^=E,V=V>>>32-16|V<<16,m=m+V|0,Y^=m,Y=Y>>>32-12|Y<<12,T=T+G|0,Q^=T,Q=Q>>>32-8|Q<<8,de=de+Q|0,G^=de,G=G>>>32-7|G<<7,E=E+Y|0,V^=E,V=V>>>32-8|V<<8,m=m+V|0,Y^=m,Y=Y>>>32-7|Y<<7,x=x+b|0,ee^=x,ee=ee>>>32-8|ee<<8,ce=ce+ee|0,b^=ce,b=b>>>32-7|b<<7,U=U+h|0,P^=U,P=P>>>32-8|P<<8,ie=ie+P|0,h^=ie,h=h>>>32-7|h<<7,U=U+b|0,V^=U,V=V>>>32-16|V<<16,de=de+V|0,b^=de,b=b>>>32-12|b<<12,x=x+G|0,P^=x,P=P>>>32-16|P<<16,m=m+P|0,G^=m,G=G>>>32-12|G<<12,T=T+Y|0,ee^=T,ee=ee>>>32-16|ee<<16,ie=ie+ee|0,Y^=ie,Y=Y>>>32-12|Y<<12,E=E+h|0,Q^=E,Q=Q>>>32-16|Q<<16,ce=ce+Q|0,h^=ce,h=h>>>32-12|h<<12,T=T+Y|0,ee^=T,ee=ee>>>32-8|ee<<8,ie=ie+ee|0,Y^=ie,Y=Y>>>32-7|Y<<7,E=E+h|0,Q^=E,Q=Q>>>32-8|Q<<8,ce=ce+Q|0,h^=ce,h=h>>>32-7|h<<7,x=x+G|0,P^=x,P=P>>>32-8|P<<8,m=m+P|0,G^=m,G=G>>>32-7|G<<7,U=U+b|0,V^=U,V=V>>>32-8|V<<8,de=de+V|0,b^=de,b=b>>>32-7|b<<7;Zt.writeUint32LE(U+i|0,n,0),Zt.writeUint32LE(x+o|0,n,4),Zt.writeUint32LE(T+c|0,n,8),Zt.writeUint32LE(E+u|0,n,12),Zt.writeUint32LE(h+f|0,n,16),Zt.writeUint32LE(b+v|0,n,20),Zt.writeUint32LE(G+p|0,n,24),Zt.writeUint32LE(Y+w|0,n,28),Zt.writeUint32LE(ie+I|0,n,32),Zt.writeUint32LE(ce+S|0,n,36),Zt.writeUint32LE(de+C|0,n,40),Zt.writeUint32LE(m+R|0,n,44),Zt.writeUint32LE(P+B|0,n,48),Zt.writeUint32LE(ee+K|0,n,52),Zt.writeUint32LE(Q+se|0,n,56),Zt.writeUint32LE(V+$|0,n,60)}function Ah(n,e,t,i,o){if(o===void 0&&(o=0),n.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<t.length)throw new Error("ChaCha: destination is shorter than source");var c,u;if(o===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");c=new Uint8Array(16),u=c.length-e.length,c.set(e,u)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");c=e,u=o}for(var f=new Uint8Array(64),v=0;v<t.length;v+=64){f0(f,c,n);for(var p=v;p<v+64&&p<t.length;p++)i[p]=t[p]^f[p-v];p0(c,0,u)}return Oa.wipe(f),o===0&&Oa.wipe(c),i}Bs.streamXOR=Ah;function d0(n,e,t,i){return i===void 0&&(i=0),Oa.wipe(t),Ah(n,e,t,t,i)}Bs.stream=d0;function p0(n,e,t){for(var i=1;t--;)i=i+(n[e]&255)|0,n[e]=i&255,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var Th={},xn={};Object.defineProperty(xn,"__esModule",{value:!0});function g0(n,e,t){return~(n-1)&e|n-1&t}xn.select=g0;function v0(n,e){return(n|0)-(e|0)-1>>>31&1}xn.lessOrEqual=v0;function Rh(n,e){if(n.length!==e.length)return 0;for(var t=0,i=0;i<n.length;i++)t|=n[i]^e[i];return 1&t-1>>>8}xn.compare=Rh;function y0(n,e){return n.length===0||e.length===0?!1:Rh(n,e)!==0}xn.equal=y0,function(n){Object.defineProperty(n,"__esModule",{value:!0});var e=xn,t=Er;n.DIGEST_LENGTH=16;var i=function(){function u(f){this.digestLength=n.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var v=f[0]|f[1]<<8;this._r[0]=v&8191;var p=f[2]|f[3]<<8;this._r[1]=(v>>>13|p<<3)&8191;var w=f[4]|f[5]<<8;this._r[2]=(p>>>10|w<<6)&7939;var I=f[6]|f[7]<<8;this._r[3]=(w>>>7|I<<9)&8191;var S=f[8]|f[9]<<8;this._r[4]=(I>>>4|S<<12)&255,this._r[5]=S>>>1&8190;var C=f[10]|f[11]<<8;this._r[6]=(S>>>14|C<<2)&8191;var R=f[12]|f[13]<<8;this._r[7]=(C>>>11|R<<5)&8065;var B=f[14]|f[15]<<8;this._r[8]=(R>>>8|B<<8)&8191,this._r[9]=B>>>5&127,this._pad[0]=f[16]|f[17]<<8,this._pad[1]=f[18]|f[19]<<8,this._pad[2]=f[20]|f[21]<<8,this._pad[3]=f[22]|f[23]<<8,this._pad[4]=f[24]|f[25]<<8,this._pad[5]=f[26]|f[27]<<8,this._pad[6]=f[28]|f[29]<<8,this._pad[7]=f[30]|f[31]<<8}return u.prototype._blocks=function(f,v,p){for(var w=this._fin?0:2048,I=this._h[0],S=this._h[1],C=this._h[2],R=this._h[3],B=this._h[4],K=this._h[5],se=this._h[6],$=this._h[7],U=this._h[8],x=this._h[9],T=this._r[0],E=this._r[1],h=this._r[2],b=this._r[3],G=this._r[4],Y=this._r[5],ie=this._r[6],ce=this._r[7],de=this._r[8],m=this._r[9];p>=16;){var P=f[v+0]|f[v+1]<<8;I+=P&8191;var ee=f[v+2]|f[v+3]<<8;S+=(P>>>13|ee<<3)&8191;var Q=f[v+4]|f[v+5]<<8;C+=(ee>>>10|Q<<6)&8191;var V=f[v+6]|f[v+7]<<8;R+=(Q>>>7|V<<9)&8191;var k=f[v+8]|f[v+9]<<8;B+=(V>>>4|k<<12)&8191,K+=k>>>1&8191;var J=f[v+10]|f[v+11]<<8;se+=(k>>>14|J<<2)&8191;var re=f[v+12]|f[v+13]<<8;$+=(J>>>11|re<<5)&8191;var me=f[v+14]|f[v+15]<<8;U+=(re>>>8|me<<8)&8191,x+=me>>>5|w;var oe=0,we=oe;we+=I*T,we+=S*(5*m),we+=C*(5*de),we+=R*(5*ce),we+=B*(5*ie),oe=we>>>13,we&=8191,we+=K*(5*Y),we+=se*(5*G),we+=$*(5*b),we+=U*(5*h),we+=x*(5*E),oe+=we>>>13,we&=8191;var le=oe;le+=I*E,le+=S*T,le+=C*(5*m),le+=R*(5*de),le+=B*(5*ce),oe=le>>>13,le&=8191,le+=K*(5*ie),le+=se*(5*Y),le+=$*(5*G),le+=U*(5*b),le+=x*(5*h),oe+=le>>>13,le&=8191;var _e=oe;_e+=I*h,_e+=S*E,_e+=C*T,_e+=R*(5*m),_e+=B*(5*de),oe=_e>>>13,_e&=8191,_e+=K*(5*ce),_e+=se*(5*ie),_e+=$*(5*Y),_e+=U*(5*G),_e+=x*(5*b),oe+=_e>>>13,_e&=8191;var H=oe;H+=I*b,H+=S*h,H+=C*E,H+=R*T,H+=B*(5*m),oe=H>>>13,H&=8191,H+=K*(5*de),H+=se*(5*ce),H+=$*(5*ie),H+=U*(5*Y),H+=x*(5*G),oe+=H>>>13,H&=8191;var q=oe;q+=I*G,q+=S*b,q+=C*h,q+=R*E,q+=B*T,oe=q>>>13,q&=8191,q+=K*(5*m),q+=se*(5*de),q+=$*(5*ce),q+=U*(5*ie),q+=x*(5*Y),oe+=q>>>13,q&=8191;var F=oe;F+=I*Y,F+=S*G,F+=C*b,F+=R*h,F+=B*E,oe=F>>>13,F&=8191,F+=K*T,F+=se*(5*m),F+=$*(5*de),F+=U*(5*ce),F+=x*(5*ie),oe+=F>>>13,F&=8191;var d=oe;d+=I*ie,d+=S*Y,d+=C*G,d+=R*b,d+=B*h,oe=d>>>13,d&=8191,d+=K*E,d+=se*T,d+=$*(5*m),d+=U*(5*de),d+=x*(5*ce),oe+=d>>>13,d&=8191;var A=oe;A+=I*ce,A+=S*ie,A+=C*Y,A+=R*G,A+=B*b,oe=A>>>13,A&=8191,A+=K*h,A+=se*E,A+=$*T,A+=U*(5*m),A+=x*(5*de),oe+=A>>>13,A&=8191;var ae=oe;ae+=I*de,ae+=S*ce,ae+=C*ie,ae+=R*Y,ae+=B*G,oe=ae>>>13,ae&=8191,ae+=K*b,ae+=se*h,ae+=$*E,ae+=U*T,ae+=x*(5*m),oe+=ae>>>13,ae&=8191;var fe=oe;fe+=I*m,fe+=S*de,fe+=C*ce,fe+=R*ie,fe+=B*Y,oe=fe>>>13,fe&=8191,fe+=K*G,fe+=se*b,fe+=$*h,fe+=U*E,fe+=x*T,oe+=fe>>>13,fe&=8191,oe=(oe<<2)+oe|0,oe=oe+we|0,we=oe&8191,oe=oe>>>13,le+=oe,I=we,S=le,C=_e,R=H,B=q,K=F,se=d,$=A,U=ae,x=fe,v+=16,p-=16}this._h[0]=I,this._h[1]=S,this._h[2]=C,this._h[3]=R,this._h[4]=B,this._h[5]=K,this._h[6]=se,this._h[7]=$,this._h[8]=U,this._h[9]=x},u.prototype.finish=function(f,v){v===void 0&&(v=0);var p=new Uint16Array(10),w,I,S,C;if(this._leftover){for(C=this._leftover,this._buffer[C++]=1;C<16;C++)this._buffer[C]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(w=this._h[1]>>>13,this._h[1]&=8191,C=2;C<10;C++)this._h[C]+=w,w=this._h[C]>>>13,this._h[C]&=8191;for(this._h[0]+=w*5,w=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=w,w=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=w,p[0]=this._h[0]+5,w=p[0]>>>13,p[0]&=8191,C=1;C<10;C++)p[C]=this._h[C]+w,w=p[C]>>>13,p[C]&=8191;for(p[9]-=8192,I=(w^1)-1,C=0;C<10;C++)p[C]&=I;for(I=~I,C=0;C<10;C++)this._h[C]=this._h[C]&I|p[C];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,S=this._h[0]+this._pad[0],this._h[0]=S&65535,C=1;C<8;C++)S=(this._h[C]+this._pad[C]|0)+(S>>>16)|0,this._h[C]=S&65535;return f[v+0]=this._h[0]>>>0,f[v+1]=this._h[0]>>>8,f[v+2]=this._h[1]>>>0,f[v+3]=this._h[1]>>>8,f[v+4]=this._h[2]>>>0,f[v+5]=this._h[2]>>>8,f[v+6]=this._h[3]>>>0,f[v+7]=this._h[3]>>>8,f[v+8]=this._h[4]>>>0,f[v+9]=this._h[4]>>>8,f[v+10]=this._h[5]>>>0,f[v+11]=this._h[5]>>>8,f[v+12]=this._h[6]>>>0,f[v+13]=this._h[6]>>>8,f[v+14]=this._h[7]>>>0,f[v+15]=this._h[7]>>>8,this._finished=!0,this},u.prototype.update=function(f){var v=0,p=f.length,w;if(this._leftover){w=16-this._leftover,w>p&&(w=p);for(var I=0;I<w;I++)this._buffer[this._leftover+I]=f[v+I];if(p-=w,v+=w,this._leftover+=w,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(p>=16&&(w=p-p%16,this._blocks(f,v,w),v+=w,p-=w),p){for(var I=0;I<p;I++)this._buffer[this._leftover+I]=f[v+I];this._leftover+=p}return this},u.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var f=new Uint8Array(16);return this.finish(f),f},u.prototype.clean=function(){return t.wipe(this._buffer),t.wipe(this._r),t.wipe(this._h),t.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},u}();n.Poly1305=i;function o(u,f){var v=new i(u);v.update(f);var p=v.digest();return v.clean(),p}n.oneTimeAuth=o;function c(u,f){return u.length!==n.DIGEST_LENGTH||f.length!==n.DIGEST_LENGTH?!1:e.equal(u,f)}n.equal=c}(Th),function(n){Object.defineProperty(n,"__esModule",{value:!0});var e=Bs,t=Th,i=Er,o=Ne,c=xn;n.KEY_LENGTH=32,n.NONCE_LENGTH=12,n.TAG_LENGTH=16;var u=new Uint8Array(16),f=function(){function v(p){if(this.nonceLength=n.NONCE_LENGTH,this.tagLength=n.TAG_LENGTH,p.length!==n.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(p)}return v.prototype.seal=function(p,w,I,S){if(p.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var C=new Uint8Array(16);C.set(p,C.length-p.length);var R=new Uint8Array(32);e.stream(this._key,C,R,4);var B=w.length+this.tagLength,K;if(S){if(S.length!==B)throw new Error("ChaCha20Poly1305: incorrect destination length");K=S}else K=new Uint8Array(B);return e.streamXOR(this._key,C,w,K,4),this._authenticate(K.subarray(K.length-this.tagLength,K.length),R,K.subarray(0,K.length-this.tagLength),I),i.wipe(C),K},v.prototype.open=function(p,w,I,S){if(p.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(w.length<this.tagLength)return null;var C=new Uint8Array(16);C.set(p,C.length-p.length);var R=new Uint8Array(32);e.stream(this._key,C,R,4);var B=new Uint8Array(this.tagLength);if(this._authenticate(B,R,w.subarray(0,w.length-this.tagLength),I),!c.equal(B,w.subarray(w.length-this.tagLength,w.length)))return null;var K=w.length-this.tagLength,se;if(S){if(S.length!==K)throw new Error("ChaCha20Poly1305: incorrect destination length");se=S}else se=new Uint8Array(K);return e.streamXOR(this._key,C,w.subarray(0,w.length-this.tagLength),se,4),i.wipe(C),se},v.prototype.clean=function(){return i.wipe(this._key),this},v.prototype._authenticate=function(p,w,I,S){var C=new t.Poly1305(w);S&&(C.update(S),S.length%16>0&&C.update(u.subarray(S.length%16))),C.update(I),I.length%16>0&&C.update(u.subarray(I.length%16));var R=new Uint8Array(8);S&&o.writeUint64LE(S.length,R),C.update(R),o.writeUint64LE(I.length,R),C.update(R);for(var B=C.digest(),K=0;K<B.length;K++)p[K]=B[K];C.clean(),i.wipe(B),i.wipe(R)},v}();n.ChaCha20Poly1305=f}(wa);var Nh={},zi={},Ia={};Object.defineProperty(Ia,"__esModule",{value:!0});function _0(n){return typeof n.saveState<"u"&&typeof n.restoreState<"u"&&typeof n.cleanSavedState<"u"}Ia.isSerializableHash=_0,Object.defineProperty(zi,"__esModule",{value:!0});var Jr=Ia,b0=xn,m0=Er,$h=function(){function n(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var o=0;o<i.length;o++)i[o]^=54;this._inner.update(i);for(var o=0;o<i.length;o++)i[o]^=106;this._outer.update(i),Jr.isSerializableHash(this._inner)&&Jr.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),m0.wipe(i)}return n.prototype.reset=function(){if(!Jr.isSerializableHash(this._inner)||!Jr.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},n.prototype.clean=function(){Jr.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Jr.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},n.prototype.update=function(e){return this._inner.update(e),this},n.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},n.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},n.prototype.saveState=function(){if(!Jr.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},n.prototype.restoreState=function(e){if(!Jr.isSerializableHash(this._inner)||!Jr.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},n.prototype.cleanSavedState=function(e){if(!Jr.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},n}();zi.HMAC=$h;function w0(n,e,t){var i=new $h(n,e);i.update(t);var o=i.digest();return i.clean(),o}zi.hmac=w0,zi.equal=b0.equal,Object.defineProperty(Nh,"__esModule",{value:!0});var Fh=zi,Lh=Er,E0=function(){function n(e,t,i,o){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=o;var c=Fh.hmac(this._hash,i,t);this._hmac=new Fh.HMAC(e,c),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return n.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},n.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i<t.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[i]=this._buffer[this._bufpos++];return t},n.prototype.clean=function(){this._hmac.clean(),Lh.wipe(this._buffer),Lh.wipe(this._counter),this._bufpos=0},n}(),D0=Nh.HKDF=E0,fi={},Vs={},ks={};Object.defineProperty(ks,"__esModule",{value:!0}),ks.BrowserRandomSource=void 0;const Uh=65536;class S0{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let i=0;i<t.length;i+=Uh)this._crypto.getRandomValues(t.subarray(i,i+Math.min(t.length-i,Uh)));return t}}ks.BrowserRandomSource=S0;function x0(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Gs={},O0={},I0=Object.freeze({__proto__:null,default:O0}),P0=Hn(I0);Object.defineProperty(Gs,"__esModule",{value:!0}),Gs.NodeRandomSource=void 0;const C0=Er;class A0{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof x0<"u"){const e=P0;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(e);for(let o=0;o<i.length;o++)i[o]=t[o];return(0,C0.wipe)(t),i}}Gs.NodeRandomSource=A0,Object.defineProperty(Vs,"__esModule",{value:!0}),Vs.SystemRandomSource=void 0;const T0=ks,R0=Gs;class N0{constructor(){if(this.isAvailable=!1,this.name="",this._source=new T0.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new R0.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}Vs.SystemRandomSource=N0,function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.randomStringForEntropy=n.randomString=n.randomUint32=n.randomBytes=n.defaultRandomSource=void 0;const e=Vs,t=Ne,i=Er;n.defaultRandomSource=new e.SystemRandomSource;function o(p,w=n.defaultRandomSource){return w.randomBytes(p)}n.randomBytes=o;function c(p=n.defaultRandomSource){const w=o(4,p),I=(0,t.readUint32LE)(w);return(0,i.wipe)(w),I}n.randomUint32=c;const u="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function f(p,w=u,I=n.defaultRandomSource){if(w.length<2)throw new Error("randomString charset is too short");if(w.length>256)throw new Error("randomString charset is too long");let S="";const C=w.length,R=256-256%C;for(;p>0;){const B=o(Math.ceil(p*256/R),I);for(let K=0;K<B.length&&p>0;K++){const se=B[K];se<R&&(S+=w.charAt(se%C),p--)}(0,i.wipe)(B)}return S}n.randomString=f;function v(p,w=u,I=n.defaultRandomSource){const S=Math.ceil(p/(Math.log(w.length)/Math.LN2));return f(S,w,I)}n.randomStringForEntropy=v}(fi);var Ws={};(function(n){Object.defineProperty(n,"__esModule",{value:!0});var e=Ne,t=Er;n.DIGEST_LENGTH=32,n.BLOCK_SIZE=64;var i=function(){function f(){this.digestLength=n.DIGEST_LENGTH,this.blockSize=n.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._temp),this.reset()},f.prototype.update=function(v,p){if(p===void 0&&(p=v.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var w=0;if(this._bytesHashed+=p,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&p>0;)this._buffer[this._bufferLength++]=v[w++],p--;this._bufferLength===this.blockSize&&(c(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(p>=this.blockSize&&(w=c(this._temp,this._state,v,w,p),p%=this.blockSize);p>0;)this._buffer[this._bufferLength++]=v[w++],p--;return this},f.prototype.finish=function(v){if(!this._finished){var p=this._bytesHashed,w=this._bufferLength,I=p/536870912|0,S=p<<3,C=p%64<56?64:128;this._buffer[w]=128;for(var R=w+1;R<C-8;R++)this._buffer[R]=0;e.writeUint32BE(I,this._buffer,C-8),e.writeUint32BE(S,this._buffer,C-4),c(this._temp,this._state,this._buffer,0,C),this._finished=!0}for(var R=0;R<this.digestLength/4;R++)e.writeUint32BE(this._state[R],v,R*4);return this},f.prototype.digest=function(){var v=new Uint8Array(this.digestLength);return this.finish(v),v},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(v){return this._state.set(v.state),this._bufferLength=v.bufferLength,v.buffer&&this._buffer.set(v.buffer),this._bytesHashed=v.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(v){t.wipe(v.state),v.buffer&&t.wipe(v.buffer),v.bufferLength=0,v.bytesHashed=0},f}();n.SHA256=i;var o=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function c(f,v,p,w,I){for(;I>=64;){for(var S=v[0],C=v[1],R=v[2],B=v[3],K=v[4],se=v[5],$=v[6],U=v[7],x=0;x<16;x++){var T=w+x*4;f[x]=e.readUint32BE(p,T)}for(var x=16;x<64;x++){var E=f[x-2],h=(E>>>17|E<<32-17)^(E>>>19|E<<32-19)^E>>>10;E=f[x-15];var b=(E>>>7|E<<32-7)^(E>>>18|E<<32-18)^E>>>3;f[x]=(h+f[x-7]|0)+(b+f[x-16]|0)}for(var x=0;x<64;x++){var h=(((K>>>6|K<<26)^(K>>>11|K<<21)^(K>>>25|K<<7))+(K&se^~K&$)|0)+(U+(o[x]+f[x]|0)|0)|0,b=((S>>>2|S<<32-2)^(S>>>13|S<<32-13)^(S>>>22|S<<32-22))+(S&C^S&R^C&R)|0;U=$,$=se,se=K,K=B+h|0,B=R,R=C,C=S,S=h+b|0}v[0]+=S,v[1]+=C,v[2]+=R,v[3]+=B,v[4]+=K,v[5]+=se,v[6]+=$,v[7]+=U,w+=64,I-=64}return w}function u(f){var v=new i;v.update(f);var p=v.digest();return v.clean(),p}n.hash=u})(Ws);var Pa={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.sharedKey=n.generateKeyPair=n.generateKeyPairFromSeed=n.scalarMultBase=n.scalarMult=n.SHARED_KEY_LENGTH=n.SECRET_KEY_LENGTH=n.PUBLIC_KEY_LENGTH=void 0;const e=fi,t=Er;n.PUBLIC_KEY_LENGTH=32,n.SECRET_KEY_LENGTH=32,n.SHARED_KEY_LENGTH=32;function i(x){const T=new Float64Array(16);if(x)for(let E=0;E<x.length;E++)T[E]=x[E];return T}const o=new Uint8Array(32);o[0]=9;const c=i([56129,1]);function u(x){let T=1;for(let E=0;E<16;E++){let h=x[E]+T+65535;T=Math.floor(h/65536),x[E]=h-T*65536}x[0]+=T-1+37*(T-1)}function f(x,T,E){const h=~(E-1);for(let b=0;b<16;b++){const G=h&(x[b]^T[b]);x[b]^=G,T[b]^=G}}function v(x,T){const E=i(),h=i();for(let b=0;b<16;b++)h[b]=T[b];u(h),u(h),u(h);for(let b=0;b<2;b++){E[0]=h[0]-65517;for(let Y=1;Y<15;Y++)E[Y]=h[Y]-65535-(E[Y-1]>>16&1),E[Y-1]&=65535;E[15]=h[15]-32767-(E[14]>>16&1);const G=E[15]>>16&1;E[14]&=65535,f(h,E,1-G)}for(let b=0;b<16;b++)x[2*b]=h[b]&255,x[2*b+1]=h[b]>>8}function p(x,T){for(let E=0;E<16;E++)x[E]=T[2*E]+(T[2*E+1]<<8);x[15]&=32767}function w(x,T,E){for(let h=0;h<16;h++)x[h]=T[h]+E[h]}function I(x,T,E){for(let h=0;h<16;h++)x[h]=T[h]-E[h]}function S(x,T,E){let h,b,G=0,Y=0,ie=0,ce=0,de=0,m=0,P=0,ee=0,Q=0,V=0,k=0,J=0,re=0,me=0,oe=0,we=0,le=0,_e=0,H=0,q=0,F=0,d=0,A=0,ae=0,fe=0,xe=0,Be=0,Ve=0,Ue=0,vt=0,yt=0,Me=E[0],Oe=E[1],$e=E[2],Fe=E[3],qe=E[4],Pe=E[5],Le=E[6],Se=E[7],Ce=E[8],ze=E[9],Ie=E[10],ke=E[11],We=E[12],et=E[13],tt=E[14],Qe=E[15];h=T[0],G+=h*Me,Y+=h*Oe,ie+=h*$e,ce+=h*Fe,de+=h*qe,m+=h*Pe,P+=h*Le,ee+=h*Se,Q+=h*Ce,V+=h*ze,k+=h*Ie,J+=h*ke,re+=h*We,me+=h*et,oe+=h*tt,we+=h*Qe,h=T[1],Y+=h*Me,ie+=h*Oe,ce+=h*$e,de+=h*Fe,m+=h*qe,P+=h*Pe,ee+=h*Le,Q+=h*Se,V+=h*Ce,k+=h*ze,J+=h*Ie,re+=h*ke,me+=h*We,oe+=h*et,we+=h*tt,le+=h*Qe,h=T[2],ie+=h*Me,ce+=h*Oe,de+=h*$e,m+=h*Fe,P+=h*qe,ee+=h*Pe,Q+=h*Le,V+=h*Se,k+=h*Ce,J+=h*ze,re+=h*Ie,me+=h*ke,oe+=h*We,we+=h*et,le+=h*tt,_e+=h*Qe,h=T[3],ce+=h*Me,de+=h*Oe,m+=h*$e,P+=h*Fe,ee+=h*qe,Q+=h*Pe,V+=h*Le,k+=h*Se,J+=h*Ce,re+=h*ze,me+=h*Ie,oe+=h*ke,we+=h*We,le+=h*et,_e+=h*tt,H+=h*Qe,h=T[4],de+=h*Me,m+=h*Oe,P+=h*$e,ee+=h*Fe,Q+=h*qe,V+=h*Pe,k+=h*Le,J+=h*Se,re+=h*Ce,me+=h*ze,oe+=h*Ie,we+=h*ke,le+=h*We,_e+=h*et,H+=h*tt,q+=h*Qe,h=T[5],m+=h*Me,P+=h*Oe,ee+=h*$e,Q+=h*Fe,V+=h*qe,k+=h*Pe,J+=h*Le,re+=h*Se,me+=h*Ce,oe+=h*ze,we+=h*Ie,le+=h*ke,_e+=h*We,H+=h*et,q+=h*tt,F+=h*Qe,h=T[6],P+=h*Me,ee+=h*Oe,Q+=h*$e,V+=h*Fe,k+=h*qe,J+=h*Pe,re+=h*Le,me+=h*Se,oe+=h*Ce,we+=h*ze,le+=h*Ie,_e+=h*ke,H+=h*We,q+=h*et,F+=h*tt,d+=h*Qe,h=T[7],ee+=h*Me,Q+=h*Oe,V+=h*$e,k+=h*Fe,J+=h*qe,re+=h*Pe,me+=h*Le,oe+=h*Se,we+=h*Ce,le+=h*ze,_e+=h*Ie,H+=h*ke,q+=h*We,F+=h*et,d+=h*tt,A+=h*Qe,h=T[8],Q+=h*Me,V+=h*Oe,k+=h*$e,J+=h*Fe,re+=h*qe,me+=h*Pe,oe+=h*Le,we+=h*Se,le+=h*Ce,_e+=h*ze,H+=h*Ie,q+=h*ke,F+=h*We,d+=h*et,A+=h*tt,ae+=h*Qe,h=T[9],V+=h*Me,k+=h*Oe,J+=h*$e,re+=h*Fe,me+=h*qe,oe+=h*Pe,we+=h*Le,le+=h*Se,_e+=h*Ce,H+=h*ze,q+=h*Ie,F+=h*ke,d+=h*We,A+=h*et,ae+=h*tt,fe+=h*Qe,h=T[10],k+=h*Me,J+=h*Oe,re+=h*$e,me+=h*Fe,oe+=h*qe,we+=h*Pe,le+=h*Le,_e+=h*Se,H+=h*Ce,q+=h*ze,F+=h*Ie,d+=h*ke,A+=h*We,ae+=h*et,fe+=h*tt,xe+=h*Qe,h=T[11],J+=h*Me,re+=h*Oe,me+=h*$e,oe+=h*Fe,we+=h*qe,le+=h*Pe,_e+=h*Le,H+=h*Se,q+=h*Ce,F+=h*ze,d+=h*Ie,A+=h*ke,ae+=h*We,fe+=h*et,xe+=h*tt,Be+=h*Qe,h=T[12],re+=h*Me,me+=h*Oe,oe+=h*$e,we+=h*Fe,le+=h*qe,_e+=h*Pe,H+=h*Le,q+=h*Se,F+=h*Ce,d+=h*ze,A+=h*Ie,ae+=h*ke,fe+=h*We,xe+=h*et,Be+=h*tt,Ve+=h*Qe,h=T[13],me+=h*Me,oe+=h*Oe,we+=h*$e,le+=h*Fe,_e+=h*qe,H+=h*Pe,q+=h*Le,F+=h*Se,d+=h*Ce,A+=h*ze,ae+=h*Ie,fe+=h*ke,xe+=h*We,Be+=h*et,Ve+=h*tt,Ue+=h*Qe,h=T[14],oe+=h*Me,we+=h*Oe,le+=h*$e,_e+=h*Fe,H+=h*qe,q+=h*Pe,F+=h*Le,d+=h*Se,A+=h*Ce,ae+=h*ze,fe+=h*Ie,xe+=h*ke,Be+=h*We,Ve+=h*et,Ue+=h*tt,vt+=h*Qe,h=T[15],we+=h*Me,le+=h*Oe,_e+=h*$e,H+=h*Fe,q+=h*qe,F+=h*Pe,d+=h*Le,A+=h*Se,ae+=h*Ce,fe+=h*ze,xe+=h*Ie,Be+=h*ke,Ve+=h*We,Ue+=h*et,vt+=h*tt,yt+=h*Qe,G+=38*le,Y+=38*_e,ie+=38*H,ce+=38*q,de+=38*F,m+=38*d,P+=38*A,ee+=38*ae,Q+=38*fe,V+=38*xe,k+=38*Be,J+=38*Ve,re+=38*Ue,me+=38*vt,oe+=38*yt,b=1,h=G+b+65535,b=Math.floor(h/65536),G=h-b*65536,h=Y+b+65535,b=Math.floor(h/65536),Y=h-b*65536,h=ie+b+65535,b=Math.floor(h/65536),ie=h-b*65536,h=ce+b+65535,b=Math.floor(h/65536),ce=h-b*65536,h=de+b+65535,b=Math.floor(h/65536),de=h-b*65536,h=m+b+65535,b=Math.floor(h/65536),m=h-b*65536,h=P+b+65535,b=Math.floor(h/65536),P=h-b*65536,h=ee+b+65535,b=Math.floor(h/65536),ee=h-b*65536,h=Q+b+65535,b=Math.floor(h/65536),Q=h-b*65536,h=V+b+65535,b=Math.floor(h/65536),V=h-b*65536,h=k+b+65535,b=Math.floor(h/65536),k=h-b*65536,h=J+b+65535,b=Math.floor(h/65536),J=h-b*65536,h=re+b+65535,b=Math.floor(h/65536),re=h-b*65536,h=me+b+65535,b=Math.floor(h/65536),me=h-b*65536,h=oe+b+65535,b=Math.floor(h/65536),oe=h-b*65536,h=we+b+65535,b=Math.floor(h/65536),we=h-b*65536,G+=b-1+37*(b-1),b=1,h=G+b+65535,b=Math.floor(h/65536),G=h-b*65536,h=Y+b+65535,b=Math.floor(h/65536),Y=h-b*65536,h=ie+b+65535,b=Math.floor(h/65536),ie=h-b*65536,h=ce+b+65535,b=Math.floor(h/65536),ce=h-b*65536,h=de+b+65535,b=Math.floor(h/65536),de=h-b*65536,h=m+b+65535,b=Math.floor(h/65536),m=h-b*65536,h=P+b+65535,b=Math.floor(h/65536),P=h-b*65536,h=ee+b+65535,b=Math.floor(h/65536),ee=h-b*65536,h=Q+b+65535,b=Math.floor(h/65536),Q=h-b*65536,h=V+b+65535,b=Math.floor(h/65536),V=h-b*65536,h=k+b+65535,b=Math.floor(h/65536),k=h-b*65536,h=J+b+65535,b=Math.floor(h/65536),J=h-b*65536,h=re+b+65535,b=Math.floor(h/65536),re=h-b*65536,h=me+b+65535,b=Math.floor(h/65536),me=h-b*65536,h=oe+b+65535,b=Math.floor(h/65536),oe=h-b*65536,h=we+b+65535,b=Math.floor(h/65536),we=h-b*65536,G+=b-1+37*(b-1),x[0]=G,x[1]=Y,x[2]=ie,x[3]=ce,x[4]=de,x[5]=m,x[6]=P,x[7]=ee,x[8]=Q,x[9]=V,x[10]=k,x[11]=J,x[12]=re,x[13]=me,x[14]=oe,x[15]=we}function C(x,T){S(x,T,T)}function R(x,T){const E=i();for(let h=0;h<16;h++)E[h]=T[h];for(let h=253;h>=0;h--)C(E,E),h!==2&&h!==4&&S(E,E,T);for(let h=0;h<16;h++)x[h]=E[h]}function B(x,T){const E=new Uint8Array(32),h=new Float64Array(80),b=i(),G=i(),Y=i(),ie=i(),ce=i(),de=i();for(let Q=0;Q<31;Q++)E[Q]=x[Q];E[31]=x[31]&127|64,E[0]&=248,p(h,T);for(let Q=0;Q<16;Q++)G[Q]=h[Q];b[0]=ie[0]=1;for(let Q=254;Q>=0;--Q){const V=E[Q>>>3]>>>(Q&7)&1;f(b,G,V),f(Y,ie,V),w(ce,b,Y),I(b,b,Y),w(Y,G,ie),I(G,G,ie),C(ie,ce),C(de,b),S(b,Y,b),S(Y,G,ce),w(ce,b,Y),I(b,b,Y),C(G,b),I(Y,ie,de),S(b,Y,c),w(b,b,ie),S(Y,Y,b),S(b,ie,de),S(ie,G,h),C(G,ce),f(b,G,V),f(Y,ie,V)}for(let Q=0;Q<16;Q++)h[Q+16]=b[Q],h[Q+32]=Y[Q],h[Q+48]=G[Q],h[Q+64]=ie[Q];const m=h.subarray(32),P=h.subarray(16);R(m,m),S(P,P,m);const ee=new Uint8Array(32);return v(ee,P),ee}n.scalarMult=B;function K(x){return B(x,o)}n.scalarMultBase=K;function se(x){if(x.length!==n.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${n.SECRET_KEY_LENGTH} bytes`);const T=new Uint8Array(x);return{publicKey:K(T),secretKey:T}}n.generateKeyPairFromSeed=se;function $(x){const T=(0,e.randomBytes)(32,x),E=se(T);return(0,t.wipe)(T),E}n.generateKeyPair=$;function U(x,T,E=!1){if(x.length!==n.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(T.length!==n.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const h=B(x,T);if(E){let b=0;for(let G=0;G<h.length;G++)b|=h[G];if(b===0)throw new Error("X25519: invalid shared key")}return h}n.sharedKey=U})(Pa);function Ca(n){return globalThis.Buffer!=null?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):n}function jh(n=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Ca(globalThis.Buffer.allocUnsafe(n)):new Uint8Array(n)}function Aa(n,e){e||(e=n.reduce((o,c)=>o+c.length,0));const t=jh(e);let i=0;for(const o of n)t.set(o,i),i+=o.length;return Ca(t)}function $0(n,e){if(n.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var o=0;o<n.length;o++){var c=n.charAt(o),u=c.charCodeAt(0);if(t[u]!==255)throw new TypeError(c+" is ambiguous");t[u]=o}var f=n.length,v=n.charAt(0),p=Math.log(f)/Math.log(256),w=Math.log(256)/Math.log(f);function I(R){if(R instanceof Uint8Array||(ArrayBuffer.isView(R)?R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength):Array.isArray(R)&&(R=Uint8Array.from(R))),!(R instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(R.length===0)return"";for(var B=0,K=0,se=0,$=R.length;se!==$&&R[se]===0;)se++,B++;for(var U=($-se)*w+1>>>0,x=new Uint8Array(U);se!==$;){for(var T=R[se],E=0,h=U-1;(T!==0||E<K)&&h!==-1;h--,E++)T+=256*x[h]>>>0,x[h]=T%f>>>0,T=T/f>>>0;if(T!==0)throw new Error("Non-zero carry");K=E,se++}for(var b=U-K;b!==U&&x[b]===0;)b++;for(var G=v.repeat(B);b<U;++b)G+=n.charAt(x[b]);return G}function S(R){if(typeof R!="string")throw new TypeError("Expected String");if(R.length===0)return new Uint8Array;var B=0;if(R[B]!==" "){for(var K=0,se=0;R[B]===v;)K++,B++;for(var $=(R.length-B)*p+1>>>0,U=new Uint8Array($);R[B];){var x=t[R.charCodeAt(B)];if(x===255)return;for(var T=0,E=$-1;(x!==0||T<se)&&E!==-1;E--,T++)x+=f*U[E]>>>0,U[E]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");se=T,B++}if(R[B]!==" "){for(var h=$-se;h!==$&&U[h]===0;)h++;for(var b=new Uint8Array(K+($-h)),G=K;h!==$;)b[G++]=U[h++];return b}}}function C(R){var B=S(R);if(B)return B;throw new Error(`Non-${e} character`)}return{encode:I,decodeUnsafe:S,decode:C}}var F0=$0,L0=F0;const Mh=n=>{if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")},U0=n=>new TextEncoder().encode(n),j0=n=>new TextDecoder().decode(n);class M0{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class q0{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return qh(this,e)}}class H0{constructor(e){this.decoders=e}or(e){return qh(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const qh=(n,e)=>new H0({...n.decoders||{[n.prefix]:n},...e.decoders||{[e.prefix]:e}});class B0{constructor(e,t,i,o){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=o,this.encoder=new M0(e,t,i),this.decoder=new q0(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Ys=({name:n,prefix:e,encode:t,decode:i})=>new B0(n,e,t,i),Ki=({prefix:n,name:e,alphabet:t})=>{const{encode:i,decode:o}=L0(t,e);return Ys({prefix:n,name:e,encode:i,decode:c=>Mh(o(c))})},z0=(n,e,t,i)=>{const o={};for(let w=0;w<e.length;++w)o[e[w]]=w;let c=n.length;for(;n[c-1]==="=";)--c;const u=new Uint8Array(c*t/8|0);let f=0,v=0,p=0;for(let w=0;w<c;++w){const I=o[n[w]];if(I===void 0)throw new SyntaxError(`Non-${i} character`);v=v<<t|I,f+=t,f>=8&&(f-=8,u[p++]=255&v>>f)}if(f>=t||255&v<<8-f)throw new SyntaxError("Unexpected end of data");return u},K0=(n,e,t)=>{const i=e[e.length-1]==="=",o=(1<<t)-1;let c="",u=0,f=0;for(let v=0;v<n.length;++v)for(f=f<<8|n[v],u+=8;u>t;)u-=t,c+=e[o&f>>u];if(u&&(c+=e[o&f<<t-u]),i)for(;c.length*t&7;)c+="=";return c},Jt=({name:n,prefix:e,bitsPerChar:t,alphabet:i})=>Ys({prefix:e,name:n,encode(o){return K0(o,i,t)},decode(o){return z0(o,i,t,n)}}),V0=Ys({prefix:"\0",name:"identity",encode:n=>j0(n),decode:n=>U0(n)});var k0=Object.freeze({__proto__:null,identity:V0});const G0=Jt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var W0=Object.freeze({__proto__:null,base2:G0});const Y0=Jt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var J0=Object.freeze({__proto__:null,base8:Y0});const Q0=Ki({prefix:"9",name:"base10",alphabet:"0123456789"});var X0=Object.freeze({__proto__:null,base10:Q0});const Z0=Jt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ev=Jt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var tv=Object.freeze({__proto__:null,base16:Z0,base16upper:ev});const rv=Jt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),nv=Jt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),iv=Jt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),sv=Jt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ov=Jt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),av=Jt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),cv=Jt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),uv=Jt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),hv=Jt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var lv=Object.freeze({__proto__:null,base32:rv,base32upper:nv,base32pad:iv,base32padupper:sv,base32hex:ov,base32hexupper:av,base32hexpad:cv,base32hexpadupper:uv,base32z:hv});const fv=Ki({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),dv=Ki({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var pv=Object.freeze({__proto__:null,base36:fv,base36upper:dv});const gv=Ki({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),vv=Ki({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var yv=Object.freeze({__proto__:null,base58btc:gv,base58flickr:vv});const _v=Jt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),bv=Jt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),mv=Jt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),wv=Jt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ev=Object.freeze({__proto__:null,base64:_v,base64pad:bv,base64url:mv,base64urlpad:wv});const Hh=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Dv=Hh.reduce((n,e,t)=>(n[t]=e,n),[]),Sv=Hh.reduce((n,e,t)=>(n[e.codePointAt(0)]=t,n),[]);function xv(n){return n.reduce((e,t)=>(e+=Dv[t],e),"")}function Ov(n){const e=[];for(const t of n){const i=Sv[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const Iv=Ys({prefix:"\u{1F680}",name:"base256emoji",encode:xv,decode:Ov});var Pv=Object.freeze({__proto__:null,base256emoji:Iv}),Cv=zh,Bh=128,Av=127,Tv=~Av,Rv=Math.pow(2,31);function zh(n,e,t){e=e||[],t=t||0;for(var i=t;n>=Rv;)e[t++]=n&255|Bh,n/=128;for(;n&Tv;)e[t++]=n&255|Bh,n>>>=7;return e[t]=n|0,zh.bytes=t-i+1,e}var Nv=Ta,$v=128,Kh=127;function Ta(n,i){var t=0,i=i||0,o=0,c=i,u,f=n.length;do{if(c>=f)throw Ta.bytes=0,new RangeError("Could not decode varint");u=n[c++],t+=o<28?(u&Kh)<<o:(u&Kh)*Math.pow(2,o),o+=7}while(u>=$v);return Ta.bytes=c-i,t}var Fv=Math.pow(2,7),Lv=Math.pow(2,14),Uv=Math.pow(2,21),jv=Math.pow(2,28),Mv=Math.pow(2,35),qv=Math.pow(2,42),Hv=Math.pow(2,49),Bv=Math.pow(2,56),zv=Math.pow(2,63),Kv=function(n){return n<Fv?1:n<Lv?2:n<Uv?3:n<jv?4:n<Mv?5:n<qv?6:n<Hv?7:n<Bv?8:n<zv?9:10},Vv={encode:Cv,decode:Nv,encodingLength:Kv},Vh=Vv;const kh=(n,e,t=0)=>(Vh.encode(n,e,t),e),Gh=n=>Vh.encodingLength(n),Ra=(n,e)=>{const t=e.byteLength,i=Gh(n),o=i+Gh(t),c=new Uint8Array(o+t);return kh(n,c,0),kh(t,c,i),c.set(e,o),new kv(n,t,e,c)};class kv{constructor(e,t,i,o){this.code=e,this.size=t,this.digest=i,this.bytes=o}}const Wh=({name:n,code:e,encode:t})=>new Gv(n,e,t);class Gv{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Ra(this.code,t):t.then(i=>Ra(this.code,i))}else throw Error("Unknown type, must be binary type")}}const Yh=n=>async e=>new Uint8Array(await crypto.subtle.digest(n,e)),Wv=Wh({name:"sha2-256",code:18,encode:Yh("SHA-256")}),Yv=Wh({name:"sha2-512",code:19,encode:Yh("SHA-512")});var Jv=Object.freeze({__proto__:null,sha256:Wv,sha512:Yv});const Jh=0,Qv="identity",Qh=Mh;var Xv=Object.freeze({__proto__:null,identity:{code:Jh,name:Qv,encode:Qh,digest:n=>Ra(Jh,Qh(n))}});new TextEncoder,new TextDecoder;const Xh={...k0,...W0,...J0,...X0,...tv,...lv,...pv,...yv,...Ev,...Pv};({...Jv,...Xv});function Zh(n,e,t,i){return{name:n,prefix:e,encoder:{name:n,prefix:e,encode:t},decoder:{decode:i}}}const el=Zh("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),Na=Zh("ascii","a",n=>{let e="a";for(let t=0;t<n.length;t++)e+=String.fromCharCode(n[t]);return e},n=>{n=n.substring(1);const e=jh(n.length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return e}),tl={utf8:el,"utf-8":el,hex:Xh.base16,latin1:Na,ascii:Na,binary:Na,...Xh};function dr(n,e="utf8"){const t=tl[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ca(globalThis.Buffer.from(n,"utf-8")):t.decoder.decode(`${t.prefix}${n}`)}function nr(n,e="utf8"){const t=tl[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(n.buffer,n.byteOffset,n.byteLength).toString("utf8"):t.encoder.encode(n).substring(1)}var rl=function(n,e,t){if(t||arguments.length===2)for(var i=0,o=e.length,c;i<o;i++)(c||!(i in e))&&(c||(c=Array.prototype.slice.call(e,0,i)),c[i]=e[i]);return n.concat(c||Array.prototype.slice.call(e))},Zv=function(){function n(e,t,i){this.name=e,this.version=t,this.os=i,this.type="browser"}return n}(),ey=function(){function n(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return n}(),ty=function(){function n(e,t,i,o){this.name=e,this.version=t,this.os=i,this.bot=o,this.type="bot-device"}return n}(),ry=function(){function n(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return n}(),ny=function(){function n(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return n}(),iy=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,sy=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,nl=3,oy=[["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",iy]],il=[["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 ay(n){return n?sl(n):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ny:typeof navigator<"u"?sl(navigator.userAgent):hy()}function cy(n){return n!==""&&oy.reduce(function(e,t){var i=t[0],o=t[1];if(e)return e;var c=o.exec(n);return!!c&&[i,c]},!1)}function sl(n){var e=cy(n);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new ry;var o=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);o?o.length<nl&&(o=rl(rl([],o,!0),ly(nl-o.length),!0)):o=[];var c=o.join("."),u=uy(n),f=sy.exec(n);return f&&f[1]?new ty(t,c,u,f[1]):new Zv(t,c,u)}function uy(n){for(var e=0,t=il.length;e<t;e++){var i=il[e],o=i[0],c=i[1],u=c.exec(n);if(u)return o}return null}function hy(){var n=typeof process<"u"&&process.version;return n?new ey(process.version.slice(1)):null}function ly(n){for(var e=[],t=0;t<n;t++)e.push("0");return e}var ye={};/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -11,13 +11,13 @@
11
11
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
12
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
13
  PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */var Fa=function(r,e){return Fa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var o in i)i.hasOwnProperty(o)&&(t[o]=i[o])},Fa(r,e)};function gy(r,e){Fa(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var La=function(){return La=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},La.apply(this,arguments)};function vy(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(r);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(r,i[o])&&(t[i[o]]=r[i[o]]);return t}function yy(r,e,t,i){var o=arguments.length,a=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var f=r.length-1;f>=0;f--)(u=r[f])&&(a=(o<3?u(a):o>3?u(e,t,a):u(e,t))||a);return o>3&&a&&Object.defineProperty(e,t,a),a}function _y(r,e){return function(t,i){e(t,i,r)}}function by(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function my(r,e,t,i){function o(a){return a instanceof t?a:new t(function(u){u(a)})}return new(t||(t=Promise))(function(a,u){function f(w){try{p(i.next(w))}catch(I){u(I)}}function v(w){try{p(i.throw(w))}catch(I){u(I)}}function p(w){w.done?a(w.value):o(w.value).then(f,v)}p((i=i.apply(r,e||[])).next())})}function wy(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,o,a,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(p){return function(w){return v([p,w])}}function v(p){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,o&&(a=p[0]&2?o.return:p[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,p[1])).done)return a;switch(o=0,a&&(p=[p[0]&2,a.value]),p[0]){case 0:case 1:a=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!a||p[1]>a[0]&&p[1]<a[3])){t.label=p[1];break}if(p[0]===6&&t.label<a[1]){t.label=a[1],a=p;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(p);break}a[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(r,t)}catch(w){p=[6,w],o=0}finally{i=a=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function Ey(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function Dy(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function Ua(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function al(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),o,a=[],u;try{for(;(e===void 0||e-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(f){u={error:f}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(u)throw u.error}}return a}function Sy(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(al(arguments[e]));return r}function xy(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),o=0,e=0;e<t;e++)for(var a=arguments[e],u=0,f=a.length;u<f;u++,o++)i[o]=a[u];return i}function ki(r){return this instanceof ki?(this.v=r,this):new ki(r)}function Oy(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),o,a=[];return o={},u("next"),u("throw"),u("return"),o[Symbol.asyncIterator]=function(){return this},o;function u(S){i[S]&&(o[S]=function(C){return new Promise(function(R,B){a.push([S,C,R,B])>1||f(S,C)})})}function f(S,C){try{v(i[S](C))}catch(R){I(a[0][3],R)}}function v(S){S.value instanceof ki?Promise.resolve(S.value.v).then(p,w):I(a[0][2],S)}function p(S){f("next",S)}function w(S){f("throw",S)}function I(S,C){S(C),a.shift(),a.length&&f(a[0][0],a[0][1])}}function Iy(r){var e,t;return e={},i("next"),i("throw",function(o){throw o}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(o,a){e[o]=r[o]?function(u){return(t=!t)?{value:ki(r[o](u)),done:o==="return"}:a?a(u):u}:a}}function Py(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Ua=="function"?Ua(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(a){t[a]=r[a]&&function(u){return new Promise(function(f,v){u=r[a](u),o(f,v,u.done,u.value)})}}function o(a,u,f,v){Promise.resolve(v).then(function(p){a({value:p,done:f})},u)}}function Cy(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function Ay(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function Ty(r){return r&&r.__esModule?r:{default:r}}function Ry(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function Ny(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var $y=Object.freeze({__proto__:null,__extends:gy,get __assign(){return La},__rest:vy,__decorate:yy,__param:_y,__metadata:by,__awaiter:my,__generator:wy,__createBinding:Ey,__exportStar:Dy,__values:Ua,__read:al,__spread:Sy,__spreadArrays:xy,__await:ki,__asyncGenerator:Oy,__asyncDelegator:Iy,__asyncValues:Py,__makeTemplateObject:Cy,__importStar:Ay,__importDefault:Ty,__classPrivateFieldGet:Ry,__classPrivateFieldSet:Ny}),Qs=Bn($y),ja={},Gi={},cl;function Fy(){if(cl)return Gi;cl=1,Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return Gi.delay=r,Gi}var zn={},Ma={},Kn={},ul;function Ly(){return ul||(ul=1,Object.defineProperty(Kn,"__esModule",{value:!0}),Kn.ONE_THOUSAND=Kn.ONE_HUNDRED=void 0,Kn.ONE_HUNDRED=100,Kn.ONE_THOUSAND=1e3),Kn}var qa={},hl;function Uy(){return hl||(hl=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(qa)),qa}var ll;function fl(){return ll||(ll=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Qs;e.__exportStar(Ly(),r),e.__exportStar(Uy(),r)}(Ma)),Ma}var dl;function jy(){if(dl)return zn;dl=1,Object.defineProperty(zn,"__esModule",{value:!0}),zn.fromMiliseconds=zn.toMiliseconds=void 0;const r=fl();function e(i){return i*r.ONE_THOUSAND}zn.toMiliseconds=e;function t(i){return Math.floor(i/r.ONE_THOUSAND)}return zn.fromMiliseconds=t,zn}var pl;function My(){return pl||(pl=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Qs;e.__exportStar(Fy(),r),e.__exportStar(jy(),r)}(ja)),ja}var pi={},gl;function qy(){if(gl)return pi;gl=1,Object.defineProperty(pi,"__esModule",{value:!0}),pi.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const i=this.get(t);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const o=Date.now()-i.started;this.timestamps.set(t,{started:i.started,elapsed:o})}get(t){const i=this.timestamps.get(t);if(typeof i>"u")throw new Error(`No timestamp found for label: ${t}`);return i}elapsed(t){const i=this.get(t);return i.elapsed||Date.now()-i.started}}return pi.Watch=r,pi.default=r,pi}var Ha={},Wi={},vl;function Hy(){if(vl)return Wi;vl=1,Object.defineProperty(Wi,"__esModule",{value:!0}),Wi.IWatch=void 0;class r{}return Wi.IWatch=r,Wi}var yl;function By(){return yl||(yl=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),Qs.__exportStar(Hy(),r)}(Ha)),Ha}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Qs;e.__exportStar(My(),r),e.__exportStar(qy(),r),e.__exportStar(By(),r),e.__exportStar(fl(),r)})(ye);var lt={};Object.defineProperty(lt,"__esModule",{value:!0}),lt.getLocalStorage=lt.getLocalStorageOrThrow=lt.getCrypto=lt.getCryptoOrThrow=bl=lt.getLocation=lt.getLocationOrThrow=Ba=lt.getNavigator=lt.getNavigatorOrThrow=_l=lt.getDocument=lt.getDocumentOrThrow=lt.getFromWindowOrThrow=lt.getFromWindow=void 0;function Vn(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}lt.getFromWindow=Vn;function gi(r){const e=Vn(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}lt.getFromWindowOrThrow=gi;function zy(){return gi("document")}lt.getDocumentOrThrow=zy;function Ky(){return Vn("document")}var _l=lt.getDocument=Ky;function Vy(){return gi("navigator")}lt.getNavigatorOrThrow=Vy;function ky(){return Vn("navigator")}var Ba=lt.getNavigator=ky;function Gy(){return gi("location")}lt.getLocationOrThrow=Gy;function Wy(){return Vn("location")}var bl=lt.getLocation=Wy;function Yy(){return gi("crypto")}lt.getCryptoOrThrow=Yy;function Jy(){return Vn("crypto")}lt.getCrypto=Jy;function Qy(){return gi("localStorage")}lt.getLocalStorageOrThrow=Qy;function Xy(){return Vn("localStorage")}lt.getLocalStorage=Xy;var za={};Object.defineProperty(za,"__esModule",{value:!0});var ml=za.getWindowMetadata=void 0;const wl=lt;function Zy(){let r,e;try{r=wl.getDocumentOrThrow(),e=wl.getLocationOrThrow()}catch{return null}function t(){const I=r.getElementsByTagName("link"),S=[];for(let C=0;C<I.length;C++){const R=I[C],B=R.getAttribute("rel");if(B&&B.toLowerCase().indexOf("icon")>-1){const K=R.getAttribute("href");if(K)if(K.toLowerCase().indexOf("https:")===-1&&K.toLowerCase().indexOf("http:")===-1&&K.indexOf("//")!==0){let se=e.protocol+"//"+e.host;if(K.indexOf("/")===0)se+=K;else{const $=e.pathname.split("/");$.pop();const U=$.join("/");se+=U+"/"+K}S.push(se)}else if(K.indexOf("//")===0){const se=e.protocol+K;S.push(se)}else S.push(K)}}return S}function i(...I){const S=r.getElementsByTagName("meta");for(let C=0;C<S.length;C++){const R=S[C],B=["itemprop","property","name"].map(K=>R.getAttribute(K)).filter(K=>K?I.includes(K):!1);if(B.length&&B){const K=R.getAttribute("content");if(K)return K}}return""}function o(){let I=i("name","og:site_name","og:title","twitter:title");return I||(I=r.title),I}function a(){return i("description","og:description","twitter:description","keywords")}const u=o(),f=a(),v=e.origin,p=t();return{description:f,url:v,icons:p,name:u}}ml=za.getWindowMetadata=Zy;var Yi={},e_=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),El="%[a-f0-9]{2}",Dl=new RegExp("("+El+")|([^%]+?)","gi"),Sl=new RegExp("("+El+")+","gi");function Ka(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],Ka(t),Ka(i))}function t_(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(Dl)||[],t=1;t<e.length;t++)r=Ka(e,t).join(""),e=r.match(Dl)||[];return r}}function r_(r){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},t=Sl.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var i=t_(t[0]);i!==t[0]&&(e[t[0]]=i)}t=Sl.exec(r)}e["%C2"]="\uFFFD";for(var o=Object.keys(e),a=0;a<o.length;a++){var u=o[a];r=r.replace(new RegExp(u,"g"),e[u])}return r}var n_=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return r_(r)}},i_=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];const t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]},s_=function(r,e){for(var t={},i=Object.keys(r),o=Array.isArray(e),a=0;a<i.length;a++){var u=i[a],f=r[u];(o?e.indexOf(u)!==-1:e(u,f,r))&&(t[u]=f)}return t};(function(r){const e=e_,t=n_,i=i_,o=s_,a=$=>$==null,u=Symbol("encodeFragmentIdentifier");function f($){switch($.arrayFormat){case"index":return U=>(x,T)=>{const E=x.length;return T===void 0||$.skipNull&&T===null||$.skipEmptyString&&T===""?x:T===null?[...x,[w(U,$),"[",E,"]"].join("")]:[...x,[w(U,$),"[",w(E,$),"]=",w(T,$)].join("")]};case"bracket":return U=>(x,T)=>T===void 0||$.skipNull&&T===null||$.skipEmptyString&&T===""?x:T===null?[...x,[w(U,$),"[]"].join("")]:[...x,[w(U,$),"[]=",w(T,$)].join("")];case"colon-list-separator":return U=>(x,T)=>T===void 0||$.skipNull&&T===null||$.skipEmptyString&&T===""?x:T===null?[...x,[w(U,$),":list="].join("")]:[...x,[w(U,$),":list=",w(T,$)].join("")];case"comma":case"separator":case"bracket-separator":{const U=$.arrayFormat==="bracket-separator"?"[]=":"=";return x=>(T,E)=>E===void 0||$.skipNull&&E===null||$.skipEmptyString&&E===""?T:(E=E===null?"":E,T.length===0?[[w(x,$),U,w(E,$)].join("")]:[[T,w(E,$)].join($.arrayFormatSeparator)])}default:return U=>(x,T)=>T===void 0||$.skipNull&&T===null||$.skipEmptyString&&T===""?x:T===null?[...x,w(U,$)]:[...x,[w(U,$),"=",w(T,$)].join("")]}}function v($){let U;switch($.arrayFormat){case"index":return(x,T,E)=>{if(U=/\[(\d*)\]$/.exec(x),x=x.replace(/\[\d*\]$/,""),!U){E[x]=T;return}E[x]===void 0&&(E[x]={}),E[x][U[1]]=T};case"bracket":return(x,T,E)=>{if(U=/(\[\])$/.exec(x),x=x.replace(/\[\]$/,""),!U){E[x]=T;return}if(E[x]===void 0){E[x]=[T];return}E[x]=[].concat(E[x],T)};case"colon-list-separator":return(x,T,E)=>{if(U=/(:list)$/.exec(x),x=x.replace(/:list$/,""),!U){E[x]=T;return}if(E[x]===void 0){E[x]=[T];return}E[x]=[].concat(E[x],T)};case"comma":case"separator":return(x,T,E)=>{const h=typeof T=="string"&&T.includes($.arrayFormatSeparator),b=typeof T=="string"&&!h&&I(T,$).includes($.arrayFormatSeparator);T=b?I(T,$):T;const G=h||b?T.split($.arrayFormatSeparator).map(Y=>I(Y,$)):T===null?T:I(T,$);E[x]=G};case"bracket-separator":return(x,T,E)=>{const h=/(\[\])$/.test(x);if(x=x.replace(/\[\]$/,""),!h){E[x]=T&&I(T,$);return}const b=T===null?[]:T.split($.arrayFormatSeparator).map(G=>I(G,$));if(E[x]===void 0){E[x]=b;return}E[x]=[].concat(E[x],b)};default:return(x,T,E)=>{if(E[x]===void 0){E[x]=T;return}E[x]=[].concat(E[x],T)}}}function p($){if(typeof $!="string"||$.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function w($,U){return U.encode?U.strict?e($):encodeURIComponent($):$}function I($,U){return U.decode?t($):$}function S($){return Array.isArray($)?$.sort():typeof $=="object"?S(Object.keys($)).sort((U,x)=>Number(U)-Number(x)).map(U=>$[U]):$}function C($){const U=$.indexOf("#");return U!==-1&&($=$.slice(0,U)),$}function R($){let U="";const x=$.indexOf("#");return x!==-1&&(U=$.slice(x)),U}function B($){$=C($);const U=$.indexOf("?");return U===-1?"":$.slice(U+1)}function K($,U){return U.parseNumbers&&!Number.isNaN(Number($))&&typeof $=="string"&&$.trim()!==""?$=Number($):U.parseBooleans&&$!==null&&($.toLowerCase()==="true"||$.toLowerCase()==="false")&&($=$.toLowerCase()==="true"),$}function se($,U){U=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},U),p(U.arrayFormatSeparator);const x=v(U),T=Object.create(null);if(typeof $!="string"||($=$.trim().replace(/^[?#&]/,""),!$))return T;for(const E of $.split("&")){if(E==="")continue;let[h,b]=i(U.decode?E.replace(/\+/g," "):E,"=");b=b===void 0?null:["comma","separator","bracket-separator"].includes(U.arrayFormat)?b:I(b,U),x(I(h,U),b,T)}for(const E of Object.keys(T)){const h=T[E];if(typeof h=="object"&&h!==null)for(const b of Object.keys(h))h[b]=K(h[b],U);else T[E]=K(h,U)}return U.sort===!1?T:(U.sort===!0?Object.keys(T).sort():Object.keys(T).sort(U.sort)).reduce((E,h)=>{const b=T[h];return b&&typeof b=="object"&&!Array.isArray(b)?E[h]=S(b):E[h]=b,E},Object.create(null))}r.extract=B,r.parse=se,r.stringify=($,U)=>{if(!$)return"";U=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},U),p(U.arrayFormatSeparator);const x=b=>U.skipNull&&a($[b])||U.skipEmptyString&&$[b]==="",T=f(U),E={};for(const b of Object.keys($))x(b)||(E[b]=$[b]);const h=Object.keys(E);return U.sort!==!1&&h.sort(U.sort),h.map(b=>{const G=$[b];return G===void 0?"":G===null?w(b,U):Array.isArray(G)?G.length===0&&U.arrayFormat==="bracket-separator"?w(b,U)+"[]":G.reduce(T(b),[]).join("&"):w(b,U)+"="+w(G,U)}).filter(b=>b.length>0).join("&")},r.parseUrl=($,U)=>{U=Object.assign({decode:!0},U);const[x,T]=i($,"#");return Object.assign({url:x.split("?")[0]||"",query:se(B($),U)},U&&U.parseFragmentIdentifier&&T?{fragmentIdentifier:I(T,U)}:{})},r.stringifyUrl=($,U)=>{U=Object.assign({encode:!0,strict:!0,[u]:!0},U);const x=C($.url).split("?")[0]||"",T=r.extract($.url),E=r.parse(T,{sort:!1}),h=Object.assign(E,$.query);let b=r.stringify(h,U);b&&(b=`?${b}`);let G=R($.url);return $.fragmentIdentifier&&(G=`#${U[u]?w($.fragmentIdentifier,U):$.fragmentIdentifier}`),`${x}${b}${G}`},r.pick=($,U,x)=>{x=Object.assign({parseFragmentIdentifier:!0,[u]:!1},x);const{url:T,query:E,fragmentIdentifier:h}=r.parseUrl($,x);return r.stringifyUrl({url:T,query:o(E,U),fragmentIdentifier:h},x)},r.exclude=($,U,x)=>{const T=Array.isArray(U)?E=>!U.includes(E):(E,h)=>!U(E,h);return r.pick($,T,x)}})(Yi);const o_={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}},a_=":";function c_(r){const[e,t]=r.split(a_);return{namespace:e,reference:t}}function u_(r,e=[]){const t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;const o=r[i];t.push(...o.accounts)}),t}function xl(r,e){return r.includes(":")?[r]:e.chains||[]}const Ol="base10",ir="base16",Va="base64pad",ka="utf8",Il=0,kn=1,h_=0,Pl=1,Ga=12,Wa=32;function l_(){const r=Ca.generateKeyPair();return{privateKey:nr(r.secretKey,ir),publicKey:nr(r.publicKey,ir)}}function Ya(){const r=di.randomBytes(Wa);return nr(r,ir)}function f_(r,e){const t=Ca.sharedKey(pr(r,ir),pr(e,ir),!0),i=new O0(Ys.SHA256,t).expand(Wa);return nr(i,ir)}function d_(r){const e=Ys.hash(pr(r,ir));return nr(e,ir)}function vi(r){const e=Ys.hash(pr(r,ka));return nr(e,ir)}function p_(r){return pr(`${r}`,Ol)}function Ji(r){return Number(nr(r,Ol))}function g_(r){const e=p_(typeof r.type<"u"?r.type:Il);if(Ji(e)===kn&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof r.senderPublicKey<"u"?pr(r.senderPublicKey,ir):void 0,i=typeof r.iv<"u"?pr(r.iv,ir):di.randomBytes(Ga),o=new Ea.ChaCha20Poly1305(pr(r.symKey,ir)).seal(i,pr(r.message,ka));return y_({type:e,sealed:o,iv:i,senderPublicKey:t})}function v_(r){const e=new Ea.ChaCha20Poly1305(pr(r.symKey,ir)),{sealed:t,iv:i}=Xs(r.encoded),o=e.open(i,t);if(o===null)throw new Error("Failed to decrypt");return nr(o,ka)}function y_(r){if(Ji(r.type)===kn){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return nr(Ta([r.type,r.senderPublicKey,r.iv,r.sealed]),Va)}return nr(Ta([r.type,r.iv,r.sealed]),Va)}function Xs(r){const e=pr(r,Va),t=e.slice(h_,Pl),i=Pl;if(Ji(t)===kn){const f=i+Wa,v=f+Ga,p=e.slice(i,f),w=e.slice(f,v),I=e.slice(v);return{type:t,sealed:I,iv:w,senderPublicKey:p}}const o=i+Ga,a=e.slice(i,o),u=e.slice(o);return{type:t,sealed:u,iv:a}}function __(r,e){const t=Xs(r);return Cl({type:Ji(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?nr(t.senderPublicKey,ir):void 0,receiverPublicKey:e?.receiverPublicKey})}function Cl(r){const e=r?.type||Il;if(e===kn){if(typeof r?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof r?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r?.senderPublicKey,receiverPublicKey:r?.receiverPublicKey}}function Al(r){return r.type===kn&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}var b_=Object.defineProperty,Tl=Object.getOwnPropertySymbols,m_=Object.prototype.hasOwnProperty,w_=Object.prototype.propertyIsEnumerable,Rl=(r,e,t)=>e in r?b_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Nl=(r,e)=>{for(var t in e||(e={}))m_.call(e,t)&&Rl(r,t,e[t]);if(Tl)for(var t of Tl(e))w_.call(e,t)&&Rl(r,t,e[t]);return r};const E_="ReactNative",Sr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},D_="js";function Ja(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Qi(){return!_l()&&!!Ba()&&navigator.product===E_}function Xi(){return!Ja()&&!!Ba()}function Zi(){return Qi()?Sr.reactNative:Ja()?Sr.node:Xi()?Sr.browser:Sr.unknown}function S_(r,e){let t=Yi.parse(r);return t=Nl(Nl({},t),e),r=Yi.stringify(t),r}function x_(){return ml()||{name:"",description:"",url:"",icons:[""]}}function O_(){if(Zi()===Sr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:t,Version:i}=global.Platform;return[t,i].join("-")}const r=hy();if(r===null)return"unknown";const e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function I_(){var r;const e=Zi();return e===Sr.browser?[e,((r=bl())==null?void 0:r.host)||"unknown"].join(":"):e}function P_(r,e,t){const i=O_(),o=I_();return[[r,e].join("-"),[D_,t].join("-"),i,o].join("/")}function C_({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:o,projectId:a,useOnCloseEvent:u}){const f=t.split("?"),v=P_(r,e,i),p={auth:o,ua:v,projectId:a,useOnCloseEvent:u||void 0},w=S_(f[1]||"",p);return f[0]+"?"+w}function Gn(r,e){return r.filter(t=>e.includes(t)).length===r.length}function $l(r){return Object.fromEntries(r.entries())}function Fl(r){return new Map(Object.entries(r))}function yi(r=ye.FIVE_MINUTES,e){const t=ye.toMiliseconds(r||ye.FIVE_MINUTES);let i,o,a;return{resolve:u=>{a&&i&&(clearTimeout(a),i(u))},reject:u=>{a&&o&&(clearTimeout(a),o(u))},done:()=>new Promise((u,f)=>{a=setTimeout(()=>{f(new Error(e))},t),i=u,o=f})}}function es(r,e,t){return new Promise(async(i,o)=>{const a=setTimeout(()=>o(new Error(t)),e);try{const u=await r;i(u)}catch(u){o(u)}clearTimeout(a)})}function Ll(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${r}`)}function A_(r){return Ll("topic",r)}function T_(r){return Ll("id",r)}function Ul(r){const[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function Br(r,e){return ye.fromMiliseconds((e||Date.now())+ye.toMiliseconds(r))}function In(r){return Date.now()>=ye.toMiliseconds(r)}function Ft(r,e){return`${r}${e?`:${e}`:""}`}function Qa(r=[],e=[]){return[...new Set([...r,...e])]}async function R_({id:r,topic:e,wcDeepLink:t}){try{if(!t)return;const i=typeof t=="string"?JSON.parse(t):t;let o=i?.href;if(typeof o!="string")return;o.endsWith("/")&&(o=o.slice(0,-1));const a=`${o}/wc?requestId=${r}&sessionTopic=${e}`,u=Zi();u===Sr.browser?a.startsWith("https://")?window.open(a,"_blank","noreferrer noopener"):window.open(a,"_self","noreferrer noopener"):u===Sr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(a)}catch(i){console.error(i)}}const N_="irn";function Xa(r){return r?.relay||{protocol:N_}}function Zs(r){const e=o_[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var $_=Object.defineProperty,jl=Object.getOwnPropertySymbols,F_=Object.prototype.hasOwnProperty,L_=Object.prototype.propertyIsEnumerable,Ml=(r,e,t)=>e in r?$_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,U_=(r,e)=>{for(var t in e||(e={}))F_.call(e,t)&&Ml(r,t,e[t]);if(jl)for(var t of jl(e))L_.call(e,t)&&Ml(r,t,e[t]);return r};function j_(r,e="-"){const t={},i="relay"+e;return Object.keys(r).forEach(o=>{if(o.startsWith(i)){const a=o.replace(i,""),u=r[o];t[a]=u}}),t}function M_(r){r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),o=r.substring(e+1,t).split("@"),a=typeof t<"u"?r.substring(t):"",u=Yi.parse(a);return{protocol:i,topic:q_(o[0]),version:parseInt(o[1],10),symKey:u.symKey,relay:j_(u)}}function q_(r){return r.startsWith("//")?r.substring(2):r}function H_(r,e="-"){const t="relay",i={};return Object.keys(r).forEach(o=>{const a=t+e+o;r[o]&&(i[a]=r[o])}),i}function B_(r){return`${r.protocol}:${r.topic}@${r.version}?`+Yi.stringify(U_({symKey:r.symKey},H_(r.relay)))}function _i(r){const e=[];return r.forEach(t=>{const[i,o]=t.split(":");e.push(`${i}:${o}`)}),e}function z_(r){const e=[];return Object.values(r).forEach(t=>{e.push(..._i(t.accounts))}),e}function K_(r,e){const t=[];return Object.values(r).forEach(i=>{_i(i.accounts).includes(e)&&t.push(...i.methods)}),t}function V_(r,e){const t=[];return Object.values(r).forEach(i=>{_i(i.accounts).includes(e)&&t.push(...i.events)}),t}function k_(r,e){const t=to(r,e);if(t)throw new Error(t.message);const i={};for(const[o,a]of Object.entries(r))i[o]={methods:a.methods,events:a.events,chains:a.accounts.map(u=>`${u.split(":")[0]}:${u.split(":")[1]}`)};return i}function Za(r){return r.includes(":")}function ts(r){return Za(r)?r.split(":")[0]:r}const G_={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}},W_={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 he(r,e){const{message:t,code:i}=W_[r];return{message:e?`${t} ${e}`:t,code:i}}function At(r,e){const{message:t,code:i}=G_[r];return{message:e?`${t} ${e}`:t,code:i}}function Xr(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function bi(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function sr(r){return typeof r>"u"}function kt(r,e){return e&&sr(r)?!0:typeof r=="string"&&!!r.trim().length}function ec(r,e){return e&&sr(r)?!0:typeof r=="number"&&!isNaN(r)}function Y_(r,e){const{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),o=Object.keys(t);let a=!0;return Gn(o,i)?(i.forEach(u=>{const{accounts:f,methods:v,events:p}=r.namespaces[u],w=_i(f),I=t[u];(!Gn(xl(u,I),w)||!Gn(I.methods,v)||!Gn(I.events,p))&&(a=!1)}),a):!1}function eo(r){return kt(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function J_(r){if(kt(r,!1)&&r.includes(":")){const e=r.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&eo(t)}}return!1}function Q_(r){if(kt(r,!1))try{return typeof new URL(r)<"u"}catch{return!1}return!1}function X_(r){var e;return(e=r?.proposer)==null?void 0:e.publicKey}function Z_(r){return r?.topic}function e1(r,e){let t=null;return kt(r?.publicKey,!1)||(t=he("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function ql(r){let e=!0;return Xr(r)?r.length&&(e=r.every(t=>kt(t,!1))):e=!1,e}function t1(r,e,t){let i=null;return Xr(e)&&e.length?e.forEach(o=>{i||eo(o)||(i=At("UNSUPPORTED_CHAINS",`${t}, chain ${o} should be a string and conform to "namespace:chainId" format`))}):eo(r)||(i=At("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function r1(r,e,t){let i=null;return Object.entries(r).forEach(([o,a])=>{if(i)return;const u=t1(o,xl(o,a),`${e} ${t}`);u&&(i=u)}),i}function n1(r,e){let t=null;return Xr(r)?r.forEach(i=>{t||J_(i)||(t=At("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=At("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function i1(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const o=n1(i?.accounts,`${e} namespace`);o&&(t=o)}),t}function s1(r,e){let t=null;return ql(r?.methods)?ql(r?.events)||(t=At("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=At("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function Hl(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;const o=s1(i,`${e}, namespace`);o&&(t=o)}),t}function o1(r,e,t){let i=null;if(r&&bi(r)){const o=Hl(r,e);o&&(i=o);const a=r1(r,e,t);a&&(i=a)}else i=he("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function to(r,e){let t=null;if(r&&bi(r)){const i=Hl(r,e);i&&(t=i);const o=i1(r,e);o&&(t=o)}else t=he("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function Bl(r){return kt(r.protocol,!0)}function a1(r,e){let t=!1;return e&&!r?t=!0:r&&Xr(r)&&r.length&&r.forEach(i=>{t=Bl(i)}),t}function c1(r){return typeof r=="number"}function gr(r){return typeof r<"u"&&typeof r!==null}function u1(r){return!(!r||typeof r!="object"||!r.code||!ec(r.code,!1)||!r.message||!kt(r.message,!1))}function h1(r){return!(sr(r)||!kt(r.method,!1))}function l1(r){return!(sr(r)||sr(r.result)&&sr(r.error)||!ec(r.id,!1)||!kt(r.jsonrpc,!1))}function f1(r){return!(sr(r)||!kt(r.name,!1))}function zl(r,e){return!(!eo(e)||!z_(r).includes(e))}function d1(r,e,t){return kt(t,!1)?K_(r,e).includes(t):!1}function p1(r,e,t){return kt(t,!1)?V_(r,e).includes(t):!1}function Kl(r,e,t){let i=null;const o=g1(r),a=v1(e),u=Object.keys(o),f=Object.keys(a),v=Vl(Object.keys(r)),p=Vl(Object.keys(e)),w=v.filter(I=>!p.includes(I));return w.length&&(i=he("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.
14
+ ***************************************************************************** */var $a=function(n,e){return $a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var o in i)i.hasOwnProperty(o)&&(t[o]=i[o])},$a(n,e)};function fy(n,e){$a(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Fa=function(){return Fa=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++){t=arguments[i];for(var c in t)Object.prototype.hasOwnProperty.call(t,c)&&(e[c]=t[c])}return e},Fa.apply(this,arguments)};function dy(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(n);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(n,i[o])&&(t[i[o]]=n[i[o]]);return t}function py(n,e,t,i){var o=arguments.length,c=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(n,e,t,i);else for(var f=n.length-1;f>=0;f--)(u=n[f])&&(c=(o<3?u(c):o>3?u(e,t,c):u(e,t))||c);return o>3&&c&&Object.defineProperty(e,t,c),c}function gy(n,e){return function(t,i){e(t,i,n)}}function vy(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function yy(n,e,t,i){function o(c){return c instanceof t?c:new t(function(u){u(c)})}return new(t||(t=Promise))(function(c,u){function f(w){try{p(i.next(w))}catch(I){u(I)}}function v(w){try{p(i.throw(w))}catch(I){u(I)}}function p(w){w.done?c(w.value):o(w.value).then(f,v)}p((i=i.apply(n,e||[])).next())})}function _y(n,e){var t={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},i,o,c,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(p){return function(w){return v([p,w])}}function v(p){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,o&&(c=p[0]&2?o.return:p[0]?o.throw||((c=o.return)&&c.call(o),0):o.next)&&!(c=c.call(o,p[1])).done)return c;switch(o=0,c&&(p=[p[0]&2,c.value]),p[0]){case 0:case 1:c=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(c=t.trys,!(c=c.length>0&&c[c.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!c||p[1]>c[0]&&p[1]<c[3])){t.label=p[1];break}if(p[0]===6&&t.label<c[1]){t.label=c[1],c=p;break}if(c&&t.label<c[2]){t.label=c[2],t.ops.push(p);break}c[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(n,t)}catch(w){p=[6,w],o=0}finally{i=c=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function by(n,e,t,i){i===void 0&&(i=t),n[i]=e[t]}function my(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function La(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],i=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ol(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var i=t.call(n),o,c=[],u;try{for(;(e===void 0||e-- >0)&&!(o=i.next()).done;)c.push(o.value)}catch(f){u={error:f}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(u)throw u.error}}return c}function wy(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(ol(arguments[e]));return n}function Ey(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var i=Array(n),o=0,e=0;e<t;e++)for(var c=arguments[e],u=0,f=c.length;u<f;u++,o++)i[o]=c[u];return i}function Vi(n){return this instanceof Vi?(this.v=n,this):new Vi(n)}function Dy(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(n,e||[]),o,c=[];return o={},u("next"),u("throw"),u("return"),o[Symbol.asyncIterator]=function(){return this},o;function u(S){i[S]&&(o[S]=function(C){return new Promise(function(R,B){c.push([S,C,R,B])>1||f(S,C)})})}function f(S,C){try{v(i[S](C))}catch(R){I(c[0][3],R)}}function v(S){S.value instanceof Vi?Promise.resolve(S.value.v).then(p,w):I(c[0][2],S)}function p(S){f("next",S)}function w(S){f("throw",S)}function I(S,C){S(C),c.shift(),c.length&&f(c[0][0],c[0][1])}}function Sy(n){var e,t;return e={},i("next"),i("throw",function(o){throw o}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(o,c){e[o]=n[o]?function(u){return(t=!t)?{value:Vi(n[o](u)),done:o==="return"}:c?c(u):u}:c}}function xy(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof La=="function"?La(n):n[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(c){t[c]=n[c]&&function(u){return new Promise(function(f,v){u=n[c](u),o(f,v,u.done,u.value)})}}function o(c,u,f,v){Promise.resolve(v).then(function(p){c({value:p,done:f})},u)}}function Oy(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function Iy(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)Object.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e.default=n,e}function Py(n){return n&&n.__esModule?n:{default:n}}function Cy(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function Ay(n,e,t){if(!e.has(n))throw new TypeError("attempted to set private field on non-instance");return e.set(n,t),t}var Ty=Object.freeze({__proto__:null,__extends:fy,get __assign(){return Fa},__rest:dy,__decorate:py,__param:gy,__metadata:vy,__awaiter:yy,__generator:_y,__createBinding:by,__exportStar:my,__values:La,__read:ol,__spread:wy,__spreadArrays:Ey,__await:Vi,__asyncGenerator:Dy,__asyncDelegator:Sy,__asyncValues:xy,__makeTemplateObject:Oy,__importStar:Iy,__importDefault:Py,__classPrivateFieldGet:Cy,__classPrivateFieldSet:Ay}),Js=Hn(Ty),Ua={},ki={},al;function Ry(){if(al)return ki;al=1,Object.defineProperty(ki,"__esModule",{value:!0}),ki.delay=void 0;function n(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return ki.delay=n,ki}var Bn={},ja={},zn={},cl;function Ny(){return cl||(cl=1,Object.defineProperty(zn,"__esModule",{value:!0}),zn.ONE_THOUSAND=zn.ONE_HUNDRED=void 0,zn.ONE_HUNDRED=100,zn.ONE_THOUSAND=1e3),zn}var Ma={},ul;function $y(){return ul||(ul=1,function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.ONE_YEAR=n.FOUR_WEEKS=n.THREE_WEEKS=n.TWO_WEEKS=n.ONE_WEEK=n.THIRTY_DAYS=n.SEVEN_DAYS=n.FIVE_DAYS=n.THREE_DAYS=n.ONE_DAY=n.TWENTY_FOUR_HOURS=n.TWELVE_HOURS=n.SIX_HOURS=n.THREE_HOURS=n.ONE_HOUR=n.SIXTY_MINUTES=n.THIRTY_MINUTES=n.TEN_MINUTES=n.FIVE_MINUTES=n.ONE_MINUTE=n.SIXTY_SECONDS=n.THIRTY_SECONDS=n.TEN_SECONDS=n.FIVE_SECONDS=n.ONE_SECOND=void 0,n.ONE_SECOND=1,n.FIVE_SECONDS=5,n.TEN_SECONDS=10,n.THIRTY_SECONDS=30,n.SIXTY_SECONDS=60,n.ONE_MINUTE=n.SIXTY_SECONDS,n.FIVE_MINUTES=n.ONE_MINUTE*5,n.TEN_MINUTES=n.ONE_MINUTE*10,n.THIRTY_MINUTES=n.ONE_MINUTE*30,n.SIXTY_MINUTES=n.ONE_MINUTE*60,n.ONE_HOUR=n.SIXTY_MINUTES,n.THREE_HOURS=n.ONE_HOUR*3,n.SIX_HOURS=n.ONE_HOUR*6,n.TWELVE_HOURS=n.ONE_HOUR*12,n.TWENTY_FOUR_HOURS=n.ONE_HOUR*24,n.ONE_DAY=n.TWENTY_FOUR_HOURS,n.THREE_DAYS=n.ONE_DAY*3,n.FIVE_DAYS=n.ONE_DAY*5,n.SEVEN_DAYS=n.ONE_DAY*7,n.THIRTY_DAYS=n.ONE_DAY*30,n.ONE_WEEK=n.SEVEN_DAYS,n.TWO_WEEKS=n.ONE_WEEK*2,n.THREE_WEEKS=n.ONE_WEEK*3,n.FOUR_WEEKS=n.ONE_WEEK*4,n.ONE_YEAR=n.ONE_DAY*365}(Ma)),Ma}var hl;function ll(){return hl||(hl=1,function(n){Object.defineProperty(n,"__esModule",{value:!0});const e=Js;e.__exportStar(Ny(),n),e.__exportStar($y(),n)}(ja)),ja}var fl;function Fy(){if(fl)return Bn;fl=1,Object.defineProperty(Bn,"__esModule",{value:!0}),Bn.fromMiliseconds=Bn.toMiliseconds=void 0;const n=ll();function e(i){return i*n.ONE_THOUSAND}Bn.toMiliseconds=e;function t(i){return Math.floor(i/n.ONE_THOUSAND)}return Bn.fromMiliseconds=t,Bn}var dl;function Ly(){return dl||(dl=1,function(n){Object.defineProperty(n,"__esModule",{value:!0});const e=Js;e.__exportStar(Ry(),n),e.__exportStar(Fy(),n)}(Ua)),Ua}var di={},pl;function Uy(){if(pl)return di;pl=1,Object.defineProperty(di,"__esModule",{value:!0}),di.Watch=void 0;class n{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const i=this.get(t);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const o=Date.now()-i.started;this.timestamps.set(t,{started:i.started,elapsed:o})}get(t){const i=this.timestamps.get(t);if(typeof i>"u")throw new Error(`No timestamp found for label: ${t}`);return i}elapsed(t){const i=this.get(t);return i.elapsed||Date.now()-i.started}}return di.Watch=n,di.default=n,di}var qa={},Gi={},gl;function jy(){if(gl)return Gi;gl=1,Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.IWatch=void 0;class n{}return Gi.IWatch=n,Gi}var vl;function My(){return vl||(vl=1,function(n){Object.defineProperty(n,"__esModule",{value:!0}),Js.__exportStar(jy(),n)}(qa)),qa}(function(n){Object.defineProperty(n,"__esModule",{value:!0});const e=Js;e.__exportStar(Ly(),n),e.__exportStar(Uy(),n),e.__exportStar(My(),n),e.__exportStar(ll(),n)})(ye);var lt={};Object.defineProperty(lt,"__esModule",{value:!0}),lt.getLocalStorage=lt.getLocalStorageOrThrow=lt.getCrypto=lt.getCryptoOrThrow=_l=lt.getLocation=lt.getLocationOrThrow=Ha=lt.getNavigator=lt.getNavigatorOrThrow=yl=lt.getDocument=lt.getDocumentOrThrow=lt.getFromWindowOrThrow=lt.getFromWindow=void 0;function Kn(n){let e;return typeof window<"u"&&typeof window[n]<"u"&&(e=window[n]),e}lt.getFromWindow=Kn;function pi(n){const e=Kn(n);if(!e)throw new Error(`${n} is not defined in Window`);return e}lt.getFromWindowOrThrow=pi;function qy(){return pi("document")}lt.getDocumentOrThrow=qy;function Hy(){return Kn("document")}var yl=lt.getDocument=Hy;function By(){return pi("navigator")}lt.getNavigatorOrThrow=By;function zy(){return Kn("navigator")}var Ha=lt.getNavigator=zy;function Ky(){return pi("location")}lt.getLocationOrThrow=Ky;function Vy(){return Kn("location")}var _l=lt.getLocation=Vy;function ky(){return pi("crypto")}lt.getCryptoOrThrow=ky;function Gy(){return Kn("crypto")}lt.getCrypto=Gy;function Wy(){return pi("localStorage")}lt.getLocalStorageOrThrow=Wy;function Yy(){return Kn("localStorage")}lt.getLocalStorage=Yy;var Ba={};Object.defineProperty(Ba,"__esModule",{value:!0});var bl=Ba.getWindowMetadata=void 0;const ml=lt;function Jy(){let n,e;try{n=ml.getDocumentOrThrow(),e=ml.getLocationOrThrow()}catch{return null}function t(){const I=n.getElementsByTagName("link"),S=[];for(let C=0;C<I.length;C++){const R=I[C],B=R.getAttribute("rel");if(B&&B.toLowerCase().indexOf("icon")>-1){const K=R.getAttribute("href");if(K)if(K.toLowerCase().indexOf("https:")===-1&&K.toLowerCase().indexOf("http:")===-1&&K.indexOf("//")!==0){let se=e.protocol+"//"+e.host;if(K.indexOf("/")===0)se+=K;else{const $=e.pathname.split("/");$.pop();const U=$.join("/");se+=U+"/"+K}S.push(se)}else if(K.indexOf("//")===0){const se=e.protocol+K;S.push(se)}else S.push(K)}}return S}function i(...I){const S=n.getElementsByTagName("meta");for(let C=0;C<S.length;C++){const R=S[C],B=["itemprop","property","name"].map(K=>R.getAttribute(K)).filter(K=>K?I.includes(K):!1);if(B.length&&B){const K=R.getAttribute("content");if(K)return K}}return""}function o(){let I=i("name","og:site_name","og:title","twitter:title");return I||(I=n.title),I}function c(){return i("description","og:description","twitter:description","keywords")}const u=o(),f=c(),v=e.origin,p=t();return{description:f,url:v,icons:p,name:u}}bl=Ba.getWindowMetadata=Jy;var Wi={},Qy=n=>encodeURIComponent(n).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),wl="%[a-f0-9]{2}",El=new RegExp("("+wl+")|([^%]+?)","gi"),Dl=new RegExp("("+wl+")+","gi");function za(n,e){try{return[decodeURIComponent(n.join(""))]}catch{}if(n.length===1)return n;e=e||1;var t=n.slice(0,e),i=n.slice(e);return Array.prototype.concat.call([],za(t),za(i))}function Xy(n){try{return decodeURIComponent(n)}catch{for(var e=n.match(El)||[],t=1;t<e.length;t++)n=za(e,t).join(""),e=n.match(El)||[];return n}}function Zy(n){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},t=Dl.exec(n);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var i=Xy(t[0]);i!==t[0]&&(e[t[0]]=i)}t=Dl.exec(n)}e["%C2"]="\uFFFD";for(var o=Object.keys(e),c=0;c<o.length;c++){var u=o[c];n=n.replace(new RegExp(u,"g"),e[u])}return n}var e_=function(n){if(typeof n!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof n+"`");try{return n=n.replace(/\+/g," "),decodeURIComponent(n)}catch{return Zy(n)}},t_=(n,e)=>{if(!(typeof n=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[n];const t=n.indexOf(e);return t===-1?[n]:[n.slice(0,t),n.slice(t+e.length)]},r_=function(n,e){for(var t={},i=Object.keys(n),o=Array.isArray(e),c=0;c<i.length;c++){var u=i[c],f=n[u];(o?e.indexOf(u)!==-1:e(u,f,n))&&(t[u]=f)}return t};(function(n){const e=Qy,t=e_,i=t_,o=r_,c=$=>$==null,u=Symbol("encodeFragmentIdentifier");function f($){switch($.arrayFormat){case"index":return U=>(x,T)=>{const E=x.length;return T===void 0||$.skipNull&&T===null||$.skipEmptyString&&T===""?x:T===null?[...x,[w(U,$),"[",E,"]"].join("")]:[...x,[w(U,$),"[",w(E,$),"]=",w(T,$)].join("")]};case"bracket":return U=>(x,T)=>T===void 0||$.skipNull&&T===null||$.skipEmptyString&&T===""?x:T===null?[...x,[w(U,$),"[]"].join("")]:[...x,[w(U,$),"[]=",w(T,$)].join("")];case"colon-list-separator":return U=>(x,T)=>T===void 0||$.skipNull&&T===null||$.skipEmptyString&&T===""?x:T===null?[...x,[w(U,$),":list="].join("")]:[...x,[w(U,$),":list=",w(T,$)].join("")];case"comma":case"separator":case"bracket-separator":{const U=$.arrayFormat==="bracket-separator"?"[]=":"=";return x=>(T,E)=>E===void 0||$.skipNull&&E===null||$.skipEmptyString&&E===""?T:(E=E===null?"":E,T.length===0?[[w(x,$),U,w(E,$)].join("")]:[[T,w(E,$)].join($.arrayFormatSeparator)])}default:return U=>(x,T)=>T===void 0||$.skipNull&&T===null||$.skipEmptyString&&T===""?x:T===null?[...x,w(U,$)]:[...x,[w(U,$),"=",w(T,$)].join("")]}}function v($){let U;switch($.arrayFormat){case"index":return(x,T,E)=>{if(U=/\[(\d*)\]$/.exec(x),x=x.replace(/\[\d*\]$/,""),!U){E[x]=T;return}E[x]===void 0&&(E[x]={}),E[x][U[1]]=T};case"bracket":return(x,T,E)=>{if(U=/(\[\])$/.exec(x),x=x.replace(/\[\]$/,""),!U){E[x]=T;return}if(E[x]===void 0){E[x]=[T];return}E[x]=[].concat(E[x],T)};case"colon-list-separator":return(x,T,E)=>{if(U=/(:list)$/.exec(x),x=x.replace(/:list$/,""),!U){E[x]=T;return}if(E[x]===void 0){E[x]=[T];return}E[x]=[].concat(E[x],T)};case"comma":case"separator":return(x,T,E)=>{const h=typeof T=="string"&&T.includes($.arrayFormatSeparator),b=typeof T=="string"&&!h&&I(T,$).includes($.arrayFormatSeparator);T=b?I(T,$):T;const G=h||b?T.split($.arrayFormatSeparator).map(Y=>I(Y,$)):T===null?T:I(T,$);E[x]=G};case"bracket-separator":return(x,T,E)=>{const h=/(\[\])$/.test(x);if(x=x.replace(/\[\]$/,""),!h){E[x]=T&&I(T,$);return}const b=T===null?[]:T.split($.arrayFormatSeparator).map(G=>I(G,$));if(E[x]===void 0){E[x]=b;return}E[x]=[].concat(E[x],b)};default:return(x,T,E)=>{if(E[x]===void 0){E[x]=T;return}E[x]=[].concat(E[x],T)}}}function p($){if(typeof $!="string"||$.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function w($,U){return U.encode?U.strict?e($):encodeURIComponent($):$}function I($,U){return U.decode?t($):$}function S($){return Array.isArray($)?$.sort():typeof $=="object"?S(Object.keys($)).sort((U,x)=>Number(U)-Number(x)).map(U=>$[U]):$}function C($){const U=$.indexOf("#");return U!==-1&&($=$.slice(0,U)),$}function R($){let U="";const x=$.indexOf("#");return x!==-1&&(U=$.slice(x)),U}function B($){$=C($);const U=$.indexOf("?");return U===-1?"":$.slice(U+1)}function K($,U){return U.parseNumbers&&!Number.isNaN(Number($))&&typeof $=="string"&&$.trim()!==""?$=Number($):U.parseBooleans&&$!==null&&($.toLowerCase()==="true"||$.toLowerCase()==="false")&&($=$.toLowerCase()==="true"),$}function se($,U){U=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},U),p(U.arrayFormatSeparator);const x=v(U),T=Object.create(null);if(typeof $!="string"||($=$.trim().replace(/^[?#&]/,""),!$))return T;for(const E of $.split("&")){if(E==="")continue;let[h,b]=i(U.decode?E.replace(/\+/g," "):E,"=");b=b===void 0?null:["comma","separator","bracket-separator"].includes(U.arrayFormat)?b:I(b,U),x(I(h,U),b,T)}for(const E of Object.keys(T)){const h=T[E];if(typeof h=="object"&&h!==null)for(const b of Object.keys(h))h[b]=K(h[b],U);else T[E]=K(h,U)}return U.sort===!1?T:(U.sort===!0?Object.keys(T).sort():Object.keys(T).sort(U.sort)).reduce((E,h)=>{const b=T[h];return b&&typeof b=="object"&&!Array.isArray(b)?E[h]=S(b):E[h]=b,E},Object.create(null))}n.extract=B,n.parse=se,n.stringify=($,U)=>{if(!$)return"";U=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},U),p(U.arrayFormatSeparator);const x=b=>U.skipNull&&c($[b])||U.skipEmptyString&&$[b]==="",T=f(U),E={};for(const b of Object.keys($))x(b)||(E[b]=$[b]);const h=Object.keys(E);return U.sort!==!1&&h.sort(U.sort),h.map(b=>{const G=$[b];return G===void 0?"":G===null?w(b,U):Array.isArray(G)?G.length===0&&U.arrayFormat==="bracket-separator"?w(b,U)+"[]":G.reduce(T(b),[]).join("&"):w(b,U)+"="+w(G,U)}).filter(b=>b.length>0).join("&")},n.parseUrl=($,U)=>{U=Object.assign({decode:!0},U);const[x,T]=i($,"#");return Object.assign({url:x.split("?")[0]||"",query:se(B($),U)},U&&U.parseFragmentIdentifier&&T?{fragmentIdentifier:I(T,U)}:{})},n.stringifyUrl=($,U)=>{U=Object.assign({encode:!0,strict:!0,[u]:!0},U);const x=C($.url).split("?")[0]||"",T=n.extract($.url),E=n.parse(T,{sort:!1}),h=Object.assign(E,$.query);let b=n.stringify(h,U);b&&(b=`?${b}`);let G=R($.url);return $.fragmentIdentifier&&(G=`#${U[u]?w($.fragmentIdentifier,U):$.fragmentIdentifier}`),`${x}${b}${G}`},n.pick=($,U,x)=>{x=Object.assign({parseFragmentIdentifier:!0,[u]:!1},x);const{url:T,query:E,fragmentIdentifier:h}=n.parseUrl($,x);return n.stringifyUrl({url:T,query:o(E,U),fragmentIdentifier:h},x)},n.exclude=($,U,x)=>{const T=Array.isArray(U)?E=>!U.includes(E):(E,h)=>!U(E,h);return n.pick($,T,x)}})(Wi);const n_={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}},i_=":";function s_(n){const[e,t]=n.split(i_);return{namespace:e,reference:t}}function o_(n,e=[]){const t=[];return Object.keys(n).forEach(i=>{if(e.length&&!e.includes(i))return;const o=n[i];t.push(...o.accounts)}),t}function Sl(n,e){return n.includes(":")?[n]:e.chains||[]}const xl="base10",ir="base16",Ka="base64pad",Va="utf8",Ol=0,Vn=1,a_=0,Il=1,ka=12,Ga=32;function c_(){const n=Pa.generateKeyPair();return{privateKey:nr(n.secretKey,ir),publicKey:nr(n.publicKey,ir)}}function Wa(){const n=fi.randomBytes(Ga);return nr(n,ir)}function u_(n,e){const t=Pa.sharedKey(dr(n,ir),dr(e,ir),!0),i=new D0(Ws.SHA256,t).expand(Ga);return nr(i,ir)}function h_(n){const e=Ws.hash(dr(n,ir));return nr(e,ir)}function gi(n){const e=Ws.hash(dr(n,Va));return nr(e,ir)}function l_(n){return dr(`${n}`,xl)}function Yi(n){return Number(nr(n,xl))}function f_(n){const e=l_(typeof n.type<"u"?n.type:Ol);if(Yi(e)===Vn&&typeof n.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof n.senderPublicKey<"u"?dr(n.senderPublicKey,ir):void 0,i=typeof n.iv<"u"?dr(n.iv,ir):fi.randomBytes(ka),o=new wa.ChaCha20Poly1305(dr(n.symKey,ir)).seal(i,dr(n.message,Va));return p_({type:e,sealed:o,iv:i,senderPublicKey:t})}function d_(n){const e=new wa.ChaCha20Poly1305(dr(n.symKey,ir)),{sealed:t,iv:i}=Qs(n.encoded),o=e.open(i,t);if(o===null)throw new Error("Failed to decrypt");return nr(o,Va)}function p_(n){if(Yi(n.type)===Vn){if(typeof n.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return nr(Aa([n.type,n.senderPublicKey,n.iv,n.sealed]),Ka)}return nr(Aa([n.type,n.iv,n.sealed]),Ka)}function Qs(n){const e=dr(n,Ka),t=e.slice(a_,Il),i=Il;if(Yi(t)===Vn){const f=i+Ga,v=f+ka,p=e.slice(i,f),w=e.slice(f,v),I=e.slice(v);return{type:t,sealed:I,iv:w,senderPublicKey:p}}const o=i+ka,c=e.slice(i,o),u=e.slice(o);return{type:t,sealed:u,iv:c}}function g_(n,e){const t=Qs(n);return Pl({type:Yi(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?nr(t.senderPublicKey,ir):void 0,receiverPublicKey:e?.receiverPublicKey})}function Pl(n){const e=n?.type||Ol;if(e===Vn){if(typeof n?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof n?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:n?.senderPublicKey,receiverPublicKey:n?.receiverPublicKey}}function Cl(n){return n.type===Vn&&typeof n.senderPublicKey=="string"&&typeof n.receiverPublicKey=="string"}var v_=Object.defineProperty,Al=Object.getOwnPropertySymbols,y_=Object.prototype.hasOwnProperty,__=Object.prototype.propertyIsEnumerable,Tl=(n,e,t)=>e in n?v_(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Rl=(n,e)=>{for(var t in e||(e={}))y_.call(e,t)&&Tl(n,t,e[t]);if(Al)for(var t of Al(e))__.call(e,t)&&Tl(n,t,e[t]);return n};const b_="ReactNative",Dr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},m_="js";function Ya(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Ji(){return!yl()&&!!Ha()&&navigator.product===b_}function Qi(){return!Ya()&&!!Ha()}function Xi(){return Ji()?Dr.reactNative:Ya()?Dr.node:Qi()?Dr.browser:Dr.unknown}function w_(n,e){let t=Wi.parse(n);return t=Rl(Rl({},t),e),n=Wi.stringify(t),n}function E_(){return bl()||{name:"",description:"",url:"",icons:[""]}}function D_(){if(Xi()===Dr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:t,Version:i}=global.Platform;return[t,i].join("-")}const n=ay();if(n===null)return"unknown";const e=n.os?n.os.replace(" ","").toLowerCase():"unknown";return n.type==="browser"?[e,n.name,n.version].join("-"):[e,n.version].join("-")}function S_(){var n;const e=Xi();return e===Dr.browser?[e,((n=_l())==null?void 0:n.host)||"unknown"].join(":"):e}function x_(n,e,t){const i=D_(),o=S_();return[[n,e].join("-"),[m_,t].join("-"),i,o].join("/")}function O_({protocol:n,version:e,relayUrl:t,sdkVersion:i,auth:o,projectId:c,useOnCloseEvent:u}){const f=t.split("?"),v=x_(n,e,i),p={auth:o,ua:v,projectId:c,useOnCloseEvent:u||void 0},w=w_(f[1]||"",p);return f[0]+"?"+w}function kn(n,e){return n.filter(t=>e.includes(t)).length===n.length}function Nl(n){return Object.fromEntries(n.entries())}function $l(n){return new Map(Object.entries(n))}function vi(n=ye.FIVE_MINUTES,e){const t=ye.toMiliseconds(n||ye.FIVE_MINUTES);let i,o,c;return{resolve:u=>{c&&i&&(clearTimeout(c),i(u))},reject:u=>{c&&o&&(clearTimeout(c),o(u))},done:()=>new Promise((u,f)=>{c=setTimeout(()=>{f(new Error(e))},t),i=u,o=f})}}function Zi(n,e,t){return new Promise(async(i,o)=>{const c=setTimeout(()=>o(new Error(t)),e);try{const u=await n;i(u)}catch(u){o(u)}clearTimeout(c)})}function Fl(n,e){if(typeof e=="string"&&e.startsWith(`${n}:`))return e;if(n.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(n.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${n}`)}function I_(n){return Fl("topic",n)}function P_(n){return Fl("id",n)}function Ll(n){const[e,t]=n.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function Hr(n,e){return ye.fromMiliseconds((e||Date.now())+ye.toMiliseconds(n))}function On(n){return Date.now()>=ye.toMiliseconds(n)}function Ft(n,e){return`${n}${e?`:${e}`:""}`}function Ja(n=[],e=[]){return[...new Set([...n,...e])]}async function C_({id:n,topic:e,wcDeepLink:t}){try{if(!t)return;const i=typeof t=="string"?JSON.parse(t):t;let o=i?.href;if(typeof o!="string")return;o.endsWith("/")&&(o=o.slice(0,-1));const c=`${o}/wc?requestId=${n}&sessionTopic=${e}`,u=Xi();u===Dr.browser?c.startsWith("https://")?window.open(c,"_blank","noreferrer noopener"):window.open(c,"_self","noreferrer noopener"):u===Dr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(c)}catch(i){console.error(i)}}const A_="irn";function Qa(n){return n?.relay||{protocol:A_}}function Xs(n){const e=n_[n];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${n}`);return e}var T_=Object.defineProperty,Ul=Object.getOwnPropertySymbols,R_=Object.prototype.hasOwnProperty,N_=Object.prototype.propertyIsEnumerable,jl=(n,e,t)=>e in n?T_(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,$_=(n,e)=>{for(var t in e||(e={}))R_.call(e,t)&&jl(n,t,e[t]);if(Ul)for(var t of Ul(e))N_.call(e,t)&&jl(n,t,e[t]);return n};function F_(n,e="-"){const t={},i="relay"+e;return Object.keys(n).forEach(o=>{if(o.startsWith(i)){const c=o.replace(i,""),u=n[o];t[c]=u}}),t}function L_(n){n=n.includes("wc://")?n.replace("wc://",""):n,n=n.includes("wc:")?n.replace("wc:",""):n;const e=n.indexOf(":"),t=n.indexOf("?")!==-1?n.indexOf("?"):void 0,i=n.substring(0,e),o=n.substring(e+1,t).split("@"),c=typeof t<"u"?n.substring(t):"",u=Wi.parse(c);return{protocol:i,topic:U_(o[0]),version:parseInt(o[1],10),symKey:u.symKey,relay:F_(u)}}function U_(n){return n.startsWith("//")?n.substring(2):n}function j_(n,e="-"){const t="relay",i={};return Object.keys(n).forEach(o=>{const c=t+e+o;n[o]&&(i[c]=n[o])}),i}function M_(n){return`${n.protocol}:${n.topic}@${n.version}?`+Wi.stringify($_({symKey:n.symKey},j_(n.relay)))}function yi(n){const e=[];return n.forEach(t=>{const[i,o]=t.split(":");e.push(`${i}:${o}`)}),e}function q_(n){const e=[];return Object.values(n).forEach(t=>{e.push(...yi(t.accounts))}),e}function H_(n,e){const t=[];return Object.values(n).forEach(i=>{yi(i.accounts).includes(e)&&t.push(...i.methods)}),t}function B_(n,e){const t=[];return Object.values(n).forEach(i=>{yi(i.accounts).includes(e)&&t.push(...i.events)}),t}function z_(n,e){const t=eo(n,e);if(t)throw new Error(t.message);const i={};for(const[o,c]of Object.entries(n))i[o]={methods:c.methods,events:c.events,chains:c.accounts.map(u=>`${u.split(":")[0]}:${u.split(":")[1]}`)};return i}function Xa(n){return n.includes(":")}function es(n){return Xa(n)?n.split(":")[0]:n}const K_={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}},V_={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 he(n,e){const{message:t,code:i}=V_[n];return{message:e?`${t} ${e}`:t,code:i}}function At(n,e){const{message:t,code:i}=K_[n];return{message:e?`${t} ${e}`:t,code:i}}function Qr(n,e){return Array.isArray(n)?typeof e<"u"&&n.length?n.every(e):!0:!1}function _i(n){return Object.getPrototypeOf(n)===Object.prototype&&Object.keys(n).length}function sr(n){return typeof n>"u"}function kt(n,e){return e&&sr(n)?!0:typeof n=="string"&&!!n.trim().length}function Za(n,e){return e&&sr(n)?!0:typeof n=="number"&&!isNaN(n)}function k_(n,e){const{requiredNamespaces:t}=e,i=Object.keys(n.namespaces),o=Object.keys(t);let c=!0;return kn(o,i)?(i.forEach(u=>{const{accounts:f,methods:v,events:p}=n.namespaces[u],w=yi(f),I=t[u];(!kn(Sl(u,I),w)||!kn(I.methods,v)||!kn(I.events,p))&&(c=!1)}),c):!1}function Zs(n){return kt(n,!1)&&n.includes(":")?n.split(":").length===2:!1}function G_(n){if(kt(n,!1)&&n.includes(":")){const e=n.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&Zs(t)}}return!1}function W_(n){if(kt(n,!1))try{return typeof new URL(n)<"u"}catch{return!1}return!1}function Y_(n){var e;return(e=n?.proposer)==null?void 0:e.publicKey}function J_(n){return n?.topic}function Q_(n,e){let t=null;return kt(n?.publicKey,!1)||(t=he("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function Ml(n){let e=!0;return Qr(n)?n.length&&(e=n.every(t=>kt(t,!1))):e=!1,e}function X_(n,e,t){let i=null;return Qr(e)&&e.length?e.forEach(o=>{i||Zs(o)||(i=At("UNSUPPORTED_CHAINS",`${t}, chain ${o} should be a string and conform to "namespace:chainId" format`))}):Zs(n)||(i=At("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function Z_(n,e,t){let i=null;return Object.entries(n).forEach(([o,c])=>{if(i)return;const u=X_(o,Sl(o,c),`${e} ${t}`);u&&(i=u)}),i}function e1(n,e){let t=null;return Qr(n)?n.forEach(i=>{t||G_(i)||(t=At("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=At("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function t1(n,e){let t=null;return Object.values(n).forEach(i=>{if(t)return;const o=e1(i?.accounts,`${e} namespace`);o&&(t=o)}),t}function r1(n,e){let t=null;return Ml(n?.methods)?Ml(n?.events)||(t=At("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=At("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function ql(n,e){let t=null;return Object.values(n).forEach(i=>{if(t)return;const o=r1(i,`${e}, namespace`);o&&(t=o)}),t}function n1(n,e,t){let i=null;if(n&&_i(n)){const o=ql(n,e);o&&(i=o);const c=Z_(n,e,t);c&&(i=c)}else i=he("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function eo(n,e){let t=null;if(n&&_i(n)){const i=ql(n,e);i&&(t=i);const o=t1(n,e);o&&(t=o)}else t=he("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function Hl(n){return kt(n.protocol,!0)}function i1(n,e){let t=!1;return e&&!n?t=!0:n&&Qr(n)&&n.length&&n.forEach(i=>{t=Hl(i)}),t}function s1(n){return typeof n=="number"}function pr(n){return typeof n<"u"&&typeof n!==null}function o1(n){return!(!n||typeof n!="object"||!n.code||!Za(n.code,!1)||!n.message||!kt(n.message,!1))}function a1(n){return!(sr(n)||!kt(n.method,!1))}function c1(n){return!(sr(n)||sr(n.result)&&sr(n.error)||!Za(n.id,!1)||!kt(n.jsonrpc,!1))}function u1(n){return!(sr(n)||!kt(n.name,!1))}function Bl(n,e){return!(!Zs(e)||!q_(n).includes(e))}function h1(n,e,t){return kt(t,!1)?H_(n,e).includes(t):!1}function l1(n,e,t){return kt(t,!1)?B_(n,e).includes(t):!1}function zl(n,e,t){let i=null;const o=f1(n),c=d1(e),u=Object.keys(o),f=Object.keys(c),v=Kl(Object.keys(n)),p=Kl(Object.keys(e)),w=v.filter(I=>!p.includes(I));return w.length&&(i=he("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.
15
15
  Required: ${w.toString()}
16
- Received: ${Object.keys(e).toString()}`)),Gn(u,f)||(i=he("NON_CONFORMING_NAMESPACES",`${t} namespaces chains don't satisfy required namespaces.
16
+ Received: ${Object.keys(e).toString()}`)),kn(u,f)||(i=he("NON_CONFORMING_NAMESPACES",`${t} namespaces chains don't satisfy required namespaces.
17
17
  Required: ${u.toString()}
18
- Approved: ${f.toString()}`)),Object.keys(e).forEach(I=>{if(!I.includes(":")||i)return;const S=_i(e[I].accounts);S.includes(I)||(i=he("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace accounts for ${I}
18
+ Approved: ${f.toString()}`)),Object.keys(e).forEach(I=>{if(!I.includes(":")||i)return;const S=yi(e[I].accounts);S.includes(I)||(i=he("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace accounts for ${I}
19
19
  Required: ${I}
20
- Approved: ${S.toString()}`))}),u.forEach(I=>{i||(Gn(o[I].methods,a[I].methods)?Gn(o[I].events,a[I].events)||(i=he("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${I}`)):i=he("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${I}`))}),i}function g1(r){const e={};return Object.keys(r).forEach(t=>{var i;t.includes(":")?e[t]=r[t]:(i=r[t].chains)==null||i.forEach(o=>{e[o]={methods:r[t].methods,events:r[t].events}})}),e}function Vl(r){return[...new Set(r.map(e=>e.includes(":")?e.split(":")[0]:e))]}function v1(r){const e={};return Object.keys(r).forEach(t=>{if(t.includes(":"))e[t]=r[t];else{const i=_i(r[t].accounts);i?.forEach(o=>{e[o]={accounts:r[t].accounts.filter(a=>a.includes(`${o}:`)),methods:r[t].methods,events:r[t].events}})}}),e}function y1(r,e){return ec(r,!1)&&r<=e.max&&r>=e.min}function kl(){const r=Zi();return new Promise(e=>{switch(r){case Sr.browser:e(_1());break;case Sr.reactNative:e(b1());break;case Sr.node:e(m1());break;default:e(!0)}})}function _1(){return Xi()&&navigator?.onLine}async function b1(){if(Qi()&&typeof global<"u"&&global!=null&&global.NetInfo){const r=await(global==null?void 0:global.NetInfo.fetch());return r?.isConnected}return!0}function m1(){return!0}function w1(r){switch(Zi()){case Sr.browser:E1(r);break;case Sr.reactNative:D1(r);break}}function E1(r){!Qi()&&Xi()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function D1(r){Qi()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>r(e?.isConnected))}const tc={};class ro{static get(e){return tc[e]}static set(e,t){tc[e]=t}static delete(e){delete tc[e]}}var no={};/*! *****************************************************************************
20
+ Approved: ${S.toString()}`))}),u.forEach(I=>{i||(kn(o[I].methods,c[I].methods)?kn(o[I].events,c[I].events)||(i=he("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${I}`)):i=he("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${I}`))}),i}function f1(n){const e={};return Object.keys(n).forEach(t=>{var i;t.includes(":")?e[t]=n[t]:(i=n[t].chains)==null||i.forEach(o=>{e[o]={methods:n[t].methods,events:n[t].events}})}),e}function Kl(n){return[...new Set(n.map(e=>e.includes(":")?e.split(":")[0]:e))]}function d1(n){const e={};return Object.keys(n).forEach(t=>{if(t.includes(":"))e[t]=n[t];else{const i=yi(n[t].accounts);i?.forEach(o=>{e[o]={accounts:n[t].accounts.filter(c=>c.includes(`${o}:`)),methods:n[t].methods,events:n[t].events}})}}),e}function p1(n,e){return Za(n,!1)&&n<=e.max&&n>=e.min}function Vl(){const n=Xi();return new Promise(e=>{switch(n){case Dr.browser:e(g1());break;case Dr.reactNative:e(v1());break;case Dr.node:e(y1());break;default:e(!0)}})}function g1(){return Qi()&&navigator?.onLine}async function v1(){if(Ji()&&typeof global<"u"&&global!=null&&global.NetInfo){const n=await(global==null?void 0:global.NetInfo.fetch());return n?.isConnected}return!0}function y1(){return!0}function _1(n){switch(Xi()){case Dr.browser:b1(n);break;case Dr.reactNative:m1(n);break}}function b1(n){!Ji()&&Qi()&&(window.addEventListener("online",()=>n(!0)),window.addEventListener("offline",()=>n(!1)))}function m1(n){Ji()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>n(e?.isConnected))}const ec={};class to{static get(e){return ec[e]}static set(e,t){ec[e]=t}static delete(e){delete ec[e]}}var ro={};/*! *****************************************************************************
21
21
  Copyright (c) Microsoft Corporation.
22
22
 
23
23
  Permission to use, copy, modify, and/or distribute this software for any
@@ -30,7 +30,7 @@
30
30
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
31
31
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
32
32
  PERFORMANCE OF THIS SOFTWARE.
33
- ***************************************************************************** */var rc=function(r,e){return rc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var o in i)i.hasOwnProperty(o)&&(t[o]=i[o])},rc(r,e)};function S1(r,e){rc(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var nc=function(){return nc=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},nc.apply(this,arguments)};function x1(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(r);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(r,i[o])&&(t[i[o]]=r[i[o]]);return t}function O1(r,e,t,i){var o=arguments.length,a=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var f=r.length-1;f>=0;f--)(u=r[f])&&(a=(o<3?u(a):o>3?u(e,t,a):u(e,t))||a);return o>3&&a&&Object.defineProperty(e,t,a),a}function I1(r,e){return function(t,i){e(t,i,r)}}function P1(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function C1(r,e,t,i){function o(a){return a instanceof t?a:new t(function(u){u(a)})}return new(t||(t=Promise))(function(a,u){function f(w){try{p(i.next(w))}catch(I){u(I)}}function v(w){try{p(i.throw(w))}catch(I){u(I)}}function p(w){w.done?a(w.value):o(w.value).then(f,v)}p((i=i.apply(r,e||[])).next())})}function A1(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,o,a,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(p){return function(w){return v([p,w])}}function v(p){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,o&&(a=p[0]&2?o.return:p[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,p[1])).done)return a;switch(o=0,a&&(p=[p[0]&2,a.value]),p[0]){case 0:case 1:a=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!a||p[1]>a[0]&&p[1]<a[3])){t.label=p[1];break}if(p[0]===6&&t.label<a[1]){t.label=a[1],a=p;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(p);break}a[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(r,t)}catch(w){p=[6,w],o=0}finally{i=a=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function T1(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function R1(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function ic(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Gl(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),o,a=[],u;try{for(;(e===void 0||e-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(f){u={error:f}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(u)throw u.error}}return a}function N1(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(Gl(arguments[e]));return r}function $1(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),o=0,e=0;e<t;e++)for(var a=arguments[e],u=0,f=a.length;u<f;u++,o++)i[o]=a[u];return i}function rs(r){return this instanceof rs?(this.v=r,this):new rs(r)}function F1(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),o,a=[];return o={},u("next"),u("throw"),u("return"),o[Symbol.asyncIterator]=function(){return this},o;function u(S){i[S]&&(o[S]=function(C){return new Promise(function(R,B){a.push([S,C,R,B])>1||f(S,C)})})}function f(S,C){try{v(i[S](C))}catch(R){I(a[0][3],R)}}function v(S){S.value instanceof rs?Promise.resolve(S.value.v).then(p,w):I(a[0][2],S)}function p(S){f("next",S)}function w(S){f("throw",S)}function I(S,C){S(C),a.shift(),a.length&&f(a[0][0],a[0][1])}}function L1(r){var e,t;return e={},i("next"),i("throw",function(o){throw o}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(o,a){e[o]=r[o]?function(u){return(t=!t)?{value:rs(r[o](u)),done:o==="return"}:a?a(u):u}:a}}function U1(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof ic=="function"?ic(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(a){t[a]=r[a]&&function(u){return new Promise(function(f,v){u=r[a](u),o(f,v,u.done,u.value)})}}function o(a,u,f,v){Promise.resolve(v).then(function(p){a({value:p,done:f})},u)}}function j1(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function M1(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function q1(r){return r&&r.__esModule?r:{default:r}}function H1(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function B1(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var z1=Object.freeze({__proto__:null,__extends:S1,get __assign(){return nc},__rest:x1,__decorate:O1,__param:I1,__metadata:P1,__awaiter:C1,__generator:A1,__createBinding:T1,__exportStar:R1,__values:ic,__read:Gl,__spread:N1,__spreadArrays:$1,__await:rs,__asyncGenerator:F1,__asyncDelegator:L1,__asyncValues:U1,__makeTemplateObject:j1,__importStar:M1,__importDefault:q1,__classPrivateFieldGet:H1,__classPrivateFieldSet:B1}),Wl=Bn(z1),ns={};Object.defineProperty(ns,"__esModule",{value:!0});function K1(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return JSON.parse(r)}catch{return r}}ns.safeJsonParse=K1;function V1(r){return typeof r=="string"?r:JSON.stringify(r,(e,t)=>typeof t>"u"?null:t)}ns.safeJsonStringify=V1;var is={exports:{}},Yl;function k1(){return Yl||(Yl=1,function(){let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,i){this[t]=String(i)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Vt<"u"&&Vt.localStorage?is.exports=Vt.localStorage:typeof window<"u"&&window.localStorage?is.exports=window.localStorage:is.exports=new e}()),is.exports}var sc={},ss={},Jl;function G1(){if(Jl)return ss;Jl=1,Object.defineProperty(ss,"__esModule",{value:!0}),ss.IKeyValueStorage=void 0;class r{}return ss.IKeyValueStorage=r,ss}var os={},Ql;function W1(){if(Ql)return os;Ql=1,Object.defineProperty(os,"__esModule",{value:!0}),os.parseEntry=void 0;const r=ns;function e(t){var i;return[t[0],r.safeJsonParse((i=t[1])!==null&&i!==void 0?i:"")]}return os.parseEntry=e,os}var Xl;function Y1(){return Xl||(Xl=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Wl;e.__exportStar(G1(),r),e.__exportStar(W1(),r)}(sc)),sc}Object.defineProperty(no,"__esModule",{value:!0}),no.KeyValueStorage=void 0;const mi=Wl,Zl=ns,J1=mi.__importDefault(k1()),Q1=Y1();class ef{constructor(){this.localStorage=J1.default}getKeys(){return mi.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return mi.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(Q1.parseEntry)})}getItem(e){return mi.__awaiter(this,void 0,void 0,function*(){const t=this.localStorage.getItem(e);if(t!==null)return Zl.safeJsonParse(t)})}setItem(e,t){return mi.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,Zl.safeJsonStringify(t))})}removeItem(e){return mi.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}}no.KeyValueStorage=ef;var X1=no.default=ef,wi={};/*! *****************************************************************************
33
+ ***************************************************************************** */var tc=function(n,e){return tc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var o in i)i.hasOwnProperty(o)&&(t[o]=i[o])},tc(n,e)};function w1(n,e){tc(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var rc=function(){return rc=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++){t=arguments[i];for(var c in t)Object.prototype.hasOwnProperty.call(t,c)&&(e[c]=t[c])}return e},rc.apply(this,arguments)};function E1(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(n);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(n,i[o])&&(t[i[o]]=n[i[o]]);return t}function D1(n,e,t,i){var o=arguments.length,c=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(n,e,t,i);else for(var f=n.length-1;f>=0;f--)(u=n[f])&&(c=(o<3?u(c):o>3?u(e,t,c):u(e,t))||c);return o>3&&c&&Object.defineProperty(e,t,c),c}function S1(n,e){return function(t,i){e(t,i,n)}}function x1(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function O1(n,e,t,i){function o(c){return c instanceof t?c:new t(function(u){u(c)})}return new(t||(t=Promise))(function(c,u){function f(w){try{p(i.next(w))}catch(I){u(I)}}function v(w){try{p(i.throw(w))}catch(I){u(I)}}function p(w){w.done?c(w.value):o(w.value).then(f,v)}p((i=i.apply(n,e||[])).next())})}function I1(n,e){var t={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},i,o,c,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(p){return function(w){return v([p,w])}}function v(p){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,o&&(c=p[0]&2?o.return:p[0]?o.throw||((c=o.return)&&c.call(o),0):o.next)&&!(c=c.call(o,p[1])).done)return c;switch(o=0,c&&(p=[p[0]&2,c.value]),p[0]){case 0:case 1:c=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(c=t.trys,!(c=c.length>0&&c[c.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!c||p[1]>c[0]&&p[1]<c[3])){t.label=p[1];break}if(p[0]===6&&t.label<c[1]){t.label=c[1],c=p;break}if(c&&t.label<c[2]){t.label=c[2],t.ops.push(p);break}c[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(n,t)}catch(w){p=[6,w],o=0}finally{i=c=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function P1(n,e,t,i){i===void 0&&(i=t),n[i]=e[t]}function C1(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function nc(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],i=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function kl(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var i=t.call(n),o,c=[],u;try{for(;(e===void 0||e-- >0)&&!(o=i.next()).done;)c.push(o.value)}catch(f){u={error:f}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(u)throw u.error}}return c}function A1(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(kl(arguments[e]));return n}function T1(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var i=Array(n),o=0,e=0;e<t;e++)for(var c=arguments[e],u=0,f=c.length;u<f;u++,o++)i[o]=c[u];return i}function ts(n){return this instanceof ts?(this.v=n,this):new ts(n)}function R1(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(n,e||[]),o,c=[];return o={},u("next"),u("throw"),u("return"),o[Symbol.asyncIterator]=function(){return this},o;function u(S){i[S]&&(o[S]=function(C){return new Promise(function(R,B){c.push([S,C,R,B])>1||f(S,C)})})}function f(S,C){try{v(i[S](C))}catch(R){I(c[0][3],R)}}function v(S){S.value instanceof ts?Promise.resolve(S.value.v).then(p,w):I(c[0][2],S)}function p(S){f("next",S)}function w(S){f("throw",S)}function I(S,C){S(C),c.shift(),c.length&&f(c[0][0],c[0][1])}}function N1(n){var e,t;return e={},i("next"),i("throw",function(o){throw o}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(o,c){e[o]=n[o]?function(u){return(t=!t)?{value:ts(n[o](u)),done:o==="return"}:c?c(u):u}:c}}function $1(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof nc=="function"?nc(n):n[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(c){t[c]=n[c]&&function(u){return new Promise(function(f,v){u=n[c](u),o(f,v,u.done,u.value)})}}function o(c,u,f,v){Promise.resolve(v).then(function(p){c({value:p,done:f})},u)}}function F1(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function L1(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)Object.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e.default=n,e}function U1(n){return n&&n.__esModule?n:{default:n}}function j1(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function M1(n,e,t){if(!e.has(n))throw new TypeError("attempted to set private field on non-instance");return e.set(n,t),t}var q1=Object.freeze({__proto__:null,__extends:w1,get __assign(){return rc},__rest:E1,__decorate:D1,__param:S1,__metadata:x1,__awaiter:O1,__generator:I1,__createBinding:P1,__exportStar:C1,__values:nc,__read:kl,__spread:A1,__spreadArrays:T1,__await:ts,__asyncGenerator:R1,__asyncDelegator:N1,__asyncValues:$1,__makeTemplateObject:F1,__importStar:L1,__importDefault:U1,__classPrivateFieldGet:j1,__classPrivateFieldSet:M1}),Gl=Hn(q1),rs={};Object.defineProperty(rs,"__esModule",{value:!0});function H1(n){if(typeof n!="string")throw new Error(`Cannot safe json parse value of type ${typeof n}`);try{return JSON.parse(n)}catch{return n}}rs.safeJsonParse=H1;function B1(n){return typeof n=="string"?n:JSON.stringify(n,(e,t)=>typeof t>"u"?null:t)}rs.safeJsonStringify=B1;var ns={exports:{}},Wl;function z1(){return Wl||(Wl=1,function(){let n;function e(){}n=e,n.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},n.prototype.setItem=function(t,i){this[t]=String(i)},n.prototype.removeItem=function(t){delete this[t]},n.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},n.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},n.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Vt<"u"&&Vt.localStorage?ns.exports=Vt.localStorage:typeof window<"u"&&window.localStorage?ns.exports=window.localStorage:ns.exports=new e}()),ns.exports}var ic={},is={},Yl;function K1(){if(Yl)return is;Yl=1,Object.defineProperty(is,"__esModule",{value:!0}),is.IKeyValueStorage=void 0;class n{}return is.IKeyValueStorage=n,is}var ss={},Jl;function V1(){if(Jl)return ss;Jl=1,Object.defineProperty(ss,"__esModule",{value:!0}),ss.parseEntry=void 0;const n=rs;function e(t){var i;return[t[0],n.safeJsonParse((i=t[1])!==null&&i!==void 0?i:"")]}return ss.parseEntry=e,ss}var Ql;function k1(){return Ql||(Ql=1,function(n){Object.defineProperty(n,"__esModule",{value:!0});const e=Gl;e.__exportStar(K1(),n),e.__exportStar(V1(),n)}(ic)),ic}Object.defineProperty(ro,"__esModule",{value:!0}),ro.KeyValueStorage=void 0;const bi=Gl,Xl=rs,G1=bi.__importDefault(z1()),W1=k1();class Zl{constructor(){this.localStorage=G1.default}getKeys(){return bi.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return bi.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(W1.parseEntry)})}getItem(e){return bi.__awaiter(this,void 0,void 0,function*(){const t=this.localStorage.getItem(e);if(t!==null)return Xl.safeJsonParse(t)})}setItem(e,t){return bi.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,Xl.safeJsonStringify(t))})}removeItem(e){return bi.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}}ro.KeyValueStorage=Zl;var Y1=ro.default=Zl,mi={};/*! *****************************************************************************
34
34
  Copyright (c) Microsoft Corporation.
35
35
 
36
36
  Permission to use, copy, modify, and/or distribute this software for any
@@ -43,7 +43,7 @@
43
43
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
44
44
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
45
45
  PERFORMANCE OF THIS SOFTWARE.
46
- ***************************************************************************** */var oc=function(r,e){return oc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var o in i)i.hasOwnProperty(o)&&(t[o]=i[o])},oc(r,e)};function Z1(r,e){oc(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var ac=function(){return ac=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},ac.apply(this,arguments)};function eb(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(r);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(r,i[o])&&(t[i[o]]=r[i[o]]);return t}function tb(r,e,t,i){var o=arguments.length,a=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var f=r.length-1;f>=0;f--)(u=r[f])&&(a=(o<3?u(a):o>3?u(e,t,a):u(e,t))||a);return o>3&&a&&Object.defineProperty(e,t,a),a}function rb(r,e){return function(t,i){e(t,i,r)}}function nb(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function ib(r,e,t,i){function o(a){return a instanceof t?a:new t(function(u){u(a)})}return new(t||(t=Promise))(function(a,u){function f(w){try{p(i.next(w))}catch(I){u(I)}}function v(w){try{p(i.throw(w))}catch(I){u(I)}}function p(w){w.done?a(w.value):o(w.value).then(f,v)}p((i=i.apply(r,e||[])).next())})}function sb(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,o,a,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(p){return function(w){return v([p,w])}}function v(p){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,o&&(a=p[0]&2?o.return:p[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,p[1])).done)return a;switch(o=0,a&&(p=[p[0]&2,a.value]),p[0]){case 0:case 1:a=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!a||p[1]>a[0]&&p[1]<a[3])){t.label=p[1];break}if(p[0]===6&&t.label<a[1]){t.label=a[1],a=p;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(p);break}a[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(r,t)}catch(w){p=[6,w],o=0}finally{i=a=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function ob(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function ab(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function cc(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function tf(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),o,a=[],u;try{for(;(e===void 0||e-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(f){u={error:f}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(u)throw u.error}}return a}function cb(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(tf(arguments[e]));return r}function ub(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),o=0,e=0;e<t;e++)for(var a=arguments[e],u=0,f=a.length;u<f;u++,o++)i[o]=a[u];return i}function as(r){return this instanceof as?(this.v=r,this):new as(r)}function hb(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),o,a=[];return o={},u("next"),u("throw"),u("return"),o[Symbol.asyncIterator]=function(){return this},o;function u(S){i[S]&&(o[S]=function(C){return new Promise(function(R,B){a.push([S,C,R,B])>1||f(S,C)})})}function f(S,C){try{v(i[S](C))}catch(R){I(a[0][3],R)}}function v(S){S.value instanceof as?Promise.resolve(S.value.v).then(p,w):I(a[0][2],S)}function p(S){f("next",S)}function w(S){f("throw",S)}function I(S,C){S(C),a.shift(),a.length&&f(a[0][0],a[0][1])}}function lb(r){var e,t;return e={},i("next"),i("throw",function(o){throw o}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(o,a){e[o]=r[o]?function(u){return(t=!t)?{value:as(r[o](u)),done:o==="return"}:a?a(u):u}:a}}function fb(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof cc=="function"?cc(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(a){t[a]=r[a]&&function(u){return new Promise(function(f,v){u=r[a](u),o(f,v,u.done,u.value)})}}function o(a,u,f,v){Promise.resolve(v).then(function(p){a({value:p,done:f})},u)}}function db(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function pb(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function gb(r){return r&&r.__esModule?r:{default:r}}function vb(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function yb(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var _b=Object.freeze({__proto__:null,__extends:Z1,get __assign(){return ac},__rest:eb,__decorate:tb,__param:rb,__metadata:nb,__awaiter:ib,__generator:sb,__createBinding:ob,__exportStar:ab,__values:cc,__read:tf,__spread:cb,__spreadArrays:ub,__await:as,__asyncGenerator:hb,__asyncDelegator:lb,__asyncValues:fb,__makeTemplateObject:db,__importStar:pb,__importDefault:gb,__classPrivateFieldGet:vb,__classPrivateFieldSet:yb}),io=Bn(_b),cs={},uc={},us={};class Wn{}var bb=Object.freeze({__proto__:null,IEvents:Wn}),mb=Bn(bb),rf;function wb(){if(rf)return us;rf=1,Object.defineProperty(us,"__esModule",{value:!0}),us.IHeartBeat=void 0;const r=mb;class e extends r.IEvents{constructor(i){super()}}return us.IHeartBeat=e,us}var nf;function sf(){return nf||(nf=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),io.__exportStar(wb(),r)}(uc)),uc}var hc={},Yn={},of;function Eb(){if(of)return Yn;of=1,Object.defineProperty(Yn,"__esModule",{value:!0}),Yn.HEARTBEAT_EVENTS=Yn.HEARTBEAT_INTERVAL=void 0;const r=ye;return Yn.HEARTBEAT_INTERVAL=r.FIVE_SECONDS,Yn.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},Yn}var af;function cf(){return af||(af=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),io.__exportStar(Eb(),r)}(hc)),hc}var uf;function Db(){if(uf)return cs;uf=1,Object.defineProperty(cs,"__esModule",{value:!0}),cs.HeartBeat=void 0;const r=io,e=Yt.exports,t=ye,i=sf(),o=cf();class a extends i.IHeartBeat{constructor(f){super(f),this.events=new e.EventEmitter,this.interval=o.HEARTBEAT_INTERVAL,this.interval=f?.interval||o.HEARTBEAT_INTERVAL}static init(f){return r.__awaiter(this,void 0,void 0,function*(){const v=new a(f);return yield v.init(),v})}init(){return r.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(f,v){this.events.on(f,v)}once(f,v){this.events.once(f,v)}off(f,v){this.events.off(f,v)}removeListener(f,v){this.events.removeListener(f,v)}initialize(){return r.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),t.toMiliseconds(this.interval))})}pulse(){this.events.emit(o.HEARTBEAT_EVENTS.pulse)}}return cs.HeartBeat=a,cs}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=io;e.__exportStar(Db(),r),e.__exportStar(sf(),r),e.__exportStar(cf(),r)})(wi);var Je={};/*! *****************************************************************************
46
+ ***************************************************************************** */var sc=function(n,e){return sc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var o in i)i.hasOwnProperty(o)&&(t[o]=i[o])},sc(n,e)};function J1(n,e){sc(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var oc=function(){return oc=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++){t=arguments[i];for(var c in t)Object.prototype.hasOwnProperty.call(t,c)&&(e[c]=t[c])}return e},oc.apply(this,arguments)};function Q1(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(n);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(n,i[o])&&(t[i[o]]=n[i[o]]);return t}function X1(n,e,t,i){var o=arguments.length,c=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(n,e,t,i);else for(var f=n.length-1;f>=0;f--)(u=n[f])&&(c=(o<3?u(c):o>3?u(e,t,c):u(e,t))||c);return o>3&&c&&Object.defineProperty(e,t,c),c}function Z1(n,e){return function(t,i){e(t,i,n)}}function eb(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function tb(n,e,t,i){function o(c){return c instanceof t?c:new t(function(u){u(c)})}return new(t||(t=Promise))(function(c,u){function f(w){try{p(i.next(w))}catch(I){u(I)}}function v(w){try{p(i.throw(w))}catch(I){u(I)}}function p(w){w.done?c(w.value):o(w.value).then(f,v)}p((i=i.apply(n,e||[])).next())})}function rb(n,e){var t={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},i,o,c,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(p){return function(w){return v([p,w])}}function v(p){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,o&&(c=p[0]&2?o.return:p[0]?o.throw||((c=o.return)&&c.call(o),0):o.next)&&!(c=c.call(o,p[1])).done)return c;switch(o=0,c&&(p=[p[0]&2,c.value]),p[0]){case 0:case 1:c=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(c=t.trys,!(c=c.length>0&&c[c.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!c||p[1]>c[0]&&p[1]<c[3])){t.label=p[1];break}if(p[0]===6&&t.label<c[1]){t.label=c[1],c=p;break}if(c&&t.label<c[2]){t.label=c[2],t.ops.push(p);break}c[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(n,t)}catch(w){p=[6,w],o=0}finally{i=c=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function nb(n,e,t,i){i===void 0&&(i=t),n[i]=e[t]}function ib(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function ac(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],i=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ef(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var i=t.call(n),o,c=[],u;try{for(;(e===void 0||e-- >0)&&!(o=i.next()).done;)c.push(o.value)}catch(f){u={error:f}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(u)throw u.error}}return c}function sb(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(ef(arguments[e]));return n}function ob(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var i=Array(n),o=0,e=0;e<t;e++)for(var c=arguments[e],u=0,f=c.length;u<f;u++,o++)i[o]=c[u];return i}function os(n){return this instanceof os?(this.v=n,this):new os(n)}function ab(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(n,e||[]),o,c=[];return o={},u("next"),u("throw"),u("return"),o[Symbol.asyncIterator]=function(){return this},o;function u(S){i[S]&&(o[S]=function(C){return new Promise(function(R,B){c.push([S,C,R,B])>1||f(S,C)})})}function f(S,C){try{v(i[S](C))}catch(R){I(c[0][3],R)}}function v(S){S.value instanceof os?Promise.resolve(S.value.v).then(p,w):I(c[0][2],S)}function p(S){f("next",S)}function w(S){f("throw",S)}function I(S,C){S(C),c.shift(),c.length&&f(c[0][0],c[0][1])}}function cb(n){var e,t;return e={},i("next"),i("throw",function(o){throw o}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(o,c){e[o]=n[o]?function(u){return(t=!t)?{value:os(n[o](u)),done:o==="return"}:c?c(u):u}:c}}function ub(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof ac=="function"?ac(n):n[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(c){t[c]=n[c]&&function(u){return new Promise(function(f,v){u=n[c](u),o(f,v,u.done,u.value)})}}function o(c,u,f,v){Promise.resolve(v).then(function(p){c({value:p,done:f})},u)}}function hb(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function lb(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)Object.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e.default=n,e}function fb(n){return n&&n.__esModule?n:{default:n}}function db(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function pb(n,e,t){if(!e.has(n))throw new TypeError("attempted to set private field on non-instance");return e.set(n,t),t}var gb=Object.freeze({__proto__:null,__extends:J1,get __assign(){return oc},__rest:Q1,__decorate:X1,__param:Z1,__metadata:eb,__awaiter:tb,__generator:rb,__createBinding:nb,__exportStar:ib,__values:ac,__read:ef,__spread:sb,__spreadArrays:ob,__await:os,__asyncGenerator:ab,__asyncDelegator:cb,__asyncValues:ub,__makeTemplateObject:hb,__importStar:lb,__importDefault:fb,__classPrivateFieldGet:db,__classPrivateFieldSet:pb}),no=Hn(gb),as={},cc={},cs={};class Gn{}var vb=Object.freeze({__proto__:null,IEvents:Gn}),yb=Hn(vb),tf;function _b(){if(tf)return cs;tf=1,Object.defineProperty(cs,"__esModule",{value:!0}),cs.IHeartBeat=void 0;const n=yb;class e extends n.IEvents{constructor(i){super()}}return cs.IHeartBeat=e,cs}var rf;function nf(){return rf||(rf=1,function(n){Object.defineProperty(n,"__esModule",{value:!0}),no.__exportStar(_b(),n)}(cc)),cc}var uc={},Wn={},sf;function bb(){if(sf)return Wn;sf=1,Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.HEARTBEAT_EVENTS=Wn.HEARTBEAT_INTERVAL=void 0;const n=ye;return Wn.HEARTBEAT_INTERVAL=n.FIVE_SECONDS,Wn.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},Wn}var of;function af(){return of||(of=1,function(n){Object.defineProperty(n,"__esModule",{value:!0}),no.__exportStar(bb(),n)}(uc)),uc}var cf;function mb(){if(cf)return as;cf=1,Object.defineProperty(as,"__esModule",{value:!0}),as.HeartBeat=void 0;const n=no,e=Yt.exports,t=ye,i=nf(),o=af();class c extends i.IHeartBeat{constructor(f){super(f),this.events=new e.EventEmitter,this.interval=o.HEARTBEAT_INTERVAL,this.interval=f?.interval||o.HEARTBEAT_INTERVAL}static init(f){return n.__awaiter(this,void 0,void 0,function*(){const v=new c(f);return yield v.init(),v})}init(){return n.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(f,v){this.events.on(f,v)}once(f,v){this.events.once(f,v)}off(f,v){this.events.off(f,v)}removeListener(f,v){this.events.removeListener(f,v)}initialize(){return n.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),t.toMiliseconds(this.interval))})}pulse(){this.events.emit(o.HEARTBEAT_EVENTS.pulse)}}return as.HeartBeat=c,as}(function(n){Object.defineProperty(n,"__esModule",{value:!0});const e=no;e.__exportStar(mb(),n),e.__exportStar(nf(),n),e.__exportStar(af(),n)})(mi);var Je={};/*! *****************************************************************************
47
47
  Copyright (c) Microsoft Corporation.
48
48
 
49
49
  Permission to use, copy, modify, and/or distribute this software for any
@@ -56,7 +56,7 @@
56
56
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
57
57
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
58
58
  PERFORMANCE OF THIS SOFTWARE.
59
- ***************************************************************************** */var lc=function(r,e){return lc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var o in i)i.hasOwnProperty(o)&&(t[o]=i[o])},lc(r,e)};function Sb(r,e){lc(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var fc=function(){return fc=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},fc.apply(this,arguments)};function xb(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(r);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(r,i[o])&&(t[i[o]]=r[i[o]]);return t}function Ob(r,e,t,i){var o=arguments.length,a=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var f=r.length-1;f>=0;f--)(u=r[f])&&(a=(o<3?u(a):o>3?u(e,t,a):u(e,t))||a);return o>3&&a&&Object.defineProperty(e,t,a),a}function Ib(r,e){return function(t,i){e(t,i,r)}}function Pb(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function Cb(r,e,t,i){function o(a){return a instanceof t?a:new t(function(u){u(a)})}return new(t||(t=Promise))(function(a,u){function f(w){try{p(i.next(w))}catch(I){u(I)}}function v(w){try{p(i.throw(w))}catch(I){u(I)}}function p(w){w.done?a(w.value):o(w.value).then(f,v)}p((i=i.apply(r,e||[])).next())})}function Ab(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,o,a,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(p){return function(w){return v([p,w])}}function v(p){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,o&&(a=p[0]&2?o.return:p[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,p[1])).done)return a;switch(o=0,a&&(p=[p[0]&2,a.value]),p[0]){case 0:case 1:a=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!a||p[1]>a[0]&&p[1]<a[3])){t.label=p[1];break}if(p[0]===6&&t.label<a[1]){t.label=a[1],a=p;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(p);break}a[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(r,t)}catch(w){p=[6,w],o=0}finally{i=a=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function Tb(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function Rb(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function dc(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function hf(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),o,a=[],u;try{for(;(e===void 0||e-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(f){u={error:f}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(u)throw u.error}}return a}function Nb(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(hf(arguments[e]));return r}function $b(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),o=0,e=0;e<t;e++)for(var a=arguments[e],u=0,f=a.length;u<f;u++,o++)i[o]=a[u];return i}function hs(r){return this instanceof hs?(this.v=r,this):new hs(r)}function Fb(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),o,a=[];return o={},u("next"),u("throw"),u("return"),o[Symbol.asyncIterator]=function(){return this},o;function u(S){i[S]&&(o[S]=function(C){return new Promise(function(R,B){a.push([S,C,R,B])>1||f(S,C)})})}function f(S,C){try{v(i[S](C))}catch(R){I(a[0][3],R)}}function v(S){S.value instanceof hs?Promise.resolve(S.value.v).then(p,w):I(a[0][2],S)}function p(S){f("next",S)}function w(S){f("throw",S)}function I(S,C){S(C),a.shift(),a.length&&f(a[0][0],a[0][1])}}function Lb(r){var e,t;return e={},i("next"),i("throw",function(o){throw o}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(o,a){e[o]=r[o]?function(u){return(t=!t)?{value:hs(r[o](u)),done:o==="return"}:a?a(u):u}:a}}function Ub(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof dc=="function"?dc(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(a){t[a]=r[a]&&function(u){return new Promise(function(f,v){u=r[a](u),o(f,v,u.done,u.value)})}}function o(a,u,f,v){Promise.resolve(v).then(function(p){a({value:p,done:f})},u)}}function jb(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function Mb(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function qb(r){return r&&r.__esModule?r:{default:r}}function Hb(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function Bb(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var zb=Object.freeze({__proto__:null,__extends:Sb,get __assign(){return fc},__rest:xb,__decorate:Ob,__param:Ib,__metadata:Pb,__awaiter:Cb,__generator:Ab,__createBinding:Tb,__exportStar:Rb,__values:dc,__read:hf,__spread:Nb,__spreadArrays:$b,__await:hs,__asyncGenerator:Fb,__asyncDelegator:Lb,__asyncValues:Ub,__makeTemplateObject:jb,__importStar:Mb,__importDefault:qb,__classPrivateFieldGet:Hb,__classPrivateFieldSet:Bb}),Kb=Bn(zb),pc,lf;function Vb(){if(lf)return pc;lf=1;function r(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}pc=e;function e(t,i,o){var a=o&&o.stringify||r,u=1;if(typeof t=="object"&&t!==null){var f=i.length+u;if(f===1)return t;var v=new Array(f);v[0]=a(t);for(var p=1;p<f;p++)v[p]=a(i[p]);return v.join(" ")}if(typeof t!="string")return t;var w=i.length;if(w===0)return t;for(var I="",S=1-u,C=-1,R=t&&t.length||0,B=0;B<R;){if(t.charCodeAt(B)===37&&B+1<R){switch(C=C>-1?C:0,t.charCodeAt(B+1)){case 100:case 102:if(S>=w||i[S]==null)break;C<B&&(I+=t.slice(C,B)),I+=Number(i[S]),C=B+2,B++;break;case 105:if(S>=w||i[S]==null)break;C<B&&(I+=t.slice(C,B)),I+=Math.floor(Number(i[S])),C=B+2,B++;break;case 79:case 111:case 106:if(S>=w||i[S]===void 0)break;C<B&&(I+=t.slice(C,B));var K=typeof i[S];if(K==="string"){I+="'"+i[S]+"'",C=B+2,B++;break}if(K==="function"){I+=i[S].name||"<anonymous>",C=B+2,B++;break}I+=a(i[S]),C=B+2,B++;break;case 115:if(S>=w)break;C<B&&(I+=t.slice(C,B)),I+=String(i[S]),C=B+2,B++;break;case 37:C<B&&(I+=t.slice(C,B)),I+="%",C=B+2,B++,S--;break}++S}++B}return C===-1?t:(C<R&&(I+=t.slice(C)),I)}return pc}var gc,ff;function kb(){if(ff)return gc;ff=1;const r=Vb();gc=o;const e=T().console||{},t={mapHttpRequest:R,mapHttpResponse:R,wrapRequestSerializer:B,wrapResponseSerializer:B,wrapErrorSerializer:B,req:R,res:R,err:S};function i(E,h){return Array.isArray(E)?E.filter(function(G){return G!=="!stdSerializers.err"}):E===!0?Object.keys(h):!1}function o(E){E=E||{},E.browser=E.browser||{};const h=E.browser.transmit;if(h&&typeof h.send!="function")throw Error("pino: transmit option must have a send function");const b=E.browser.write||e;E.browser.write&&(E.browser.asObject=!0);const G=E.serializers||{},Y=i(E.browser.serialize,G);let ie=E.browser.serialize;Array.isArray(E.browser.serialize)&&E.browser.serialize.indexOf("!stdSerializers.err")>-1&&(ie=!1);const ce=["error","fatal","warn","info","debug","trace"];typeof b=="function"&&(b.error=b.fatal=b.warn=b.info=b.debug=b.trace=b),E.enabled===!1&&(E.level="silent");const de=E.level||"info",m=Object.create(b);m.log||(m.log=K),Object.defineProperty(m,"levelVal",{get:ee}),Object.defineProperty(m,"level",{get:Q,set:V});const P={transmit:h,serialize:Y,asObject:E.browser.asObject,levels:ce,timestamp:C(E)};m.levels=o.levels,m.level=de,m.setMaxListeners=m.getMaxListeners=m.emit=m.addListener=m.on=m.prependListener=m.once=m.prependOnceListener=m.removeListener=m.removeAllListeners=m.listeners=m.listenerCount=m.eventNames=m.write=m.flush=K,m.serializers=G,m._serialize=Y,m._stdErrSerialize=ie,m.child=k,h&&(m._logEvent=I());function ee(){return this.level==="silent"?1/0:this.levels.values[this.level]}function Q(){return this._level}function V(J){if(J!=="silent"&&!this.levels.values[J])throw Error("unknown level "+J);this._level=J,a(P,m,"error","log"),a(P,m,"fatal","error"),a(P,m,"warn","error"),a(P,m,"info","log"),a(P,m,"debug","log"),a(P,m,"trace","log")}function k(J,re){if(!J)throw new Error("missing bindings for child Pino");re=re||{},Y&&J.serializers&&(re.serializers=J.serializers);const me=re.serializers;if(Y&&me){var oe=Object.assign({},G,me),we=E.browser.serialize===!0?Object.keys(oe):Y;delete J.serializers,v([J],we,oe,this._stdErrSerialize)}function le(_e){this._childLevel=(_e._childLevel|0)+1,this.error=p(_e,J,"error"),this.fatal=p(_e,J,"fatal"),this.warn=p(_e,J,"warn"),this.info=p(_e,J,"info"),this.debug=p(_e,J,"debug"),this.trace=p(_e,J,"trace"),oe&&(this.serializers=oe,this._serialize=we),h&&(this._logEvent=I([].concat(_e._logEvent.bindings,J)))}return le.prototype=this,new le(this)}return m}o.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"}},o.stdSerializers=t,o.stdTimeFunctions=Object.assign({},{nullTime:se,epochTime:$,unixTime:U,isoTime:x});function a(E,h,b,G){const Y=Object.getPrototypeOf(h);h[b]=h.levelVal>h.levels.values[b]?K:Y[b]?Y[b]:e[b]||e[G]||K,u(E,h,b)}function u(E,h,b){!E.transmit&&h[b]===K||(h[b]=function(G){return function(){const ie=E.timestamp(),ce=new Array(arguments.length),de=Object.getPrototypeOf&&Object.getPrototypeOf(this)===e?e:this;for(var m=0;m<ce.length;m++)ce[m]=arguments[m];if(E.serialize&&!E.asObject&&v(ce,this._serialize,this.serializers,this._stdErrSerialize),E.asObject?G.call(de,f(this,b,ce,ie)):G.apply(de,ce),E.transmit){const P=E.transmit.level||h.level,ee=o.levels.values[P],Q=o.levels.values[b];if(Q<ee)return;w(this,{ts:ie,methodLevel:b,methodValue:Q,transmitLevel:P,transmitValue:o.levels.values[E.transmit.level||h.level],send:E.transmit.send,val:h.levelVal},ce)}}}(h[b]))}function f(E,h,b,G){E._serialize&&v(b,E._serialize,E.serializers,E._stdErrSerialize);const Y=b.slice();let ie=Y[0];const ce={};G&&(ce.time=G),ce.level=o.levels.values[h];let de=(E._childLevel|0)+1;if(de<1&&(de=1),ie!==null&&typeof ie=="object"){for(;de--&&typeof Y[0]=="object";)Object.assign(ce,Y.shift());ie=Y.length?r(Y.shift(),Y):void 0}else typeof ie=="string"&&(ie=r(Y.shift(),Y));return ie!==void 0&&(ce.msg=ie),ce}function v(E,h,b,G){for(const Y in E)if(G&&E[Y]instanceof Error)E[Y]=o.stdSerializers.err(E[Y]);else if(typeof E[Y]=="object"&&!Array.isArray(E[Y]))for(const ie in E[Y])h&&h.indexOf(ie)>-1&&ie in b&&(E[Y][ie]=b[ie](E[Y][ie]))}function p(E,h,b){return function(){const G=new Array(1+arguments.length);G[0]=h;for(var Y=1;Y<G.length;Y++)G[Y]=arguments[Y-1];return E[b].apply(this,G)}}function w(E,h,b){const G=h.send,Y=h.ts,ie=h.methodLevel,ce=h.methodValue,de=h.val,m=E._logEvent.bindings;v(b,E._serialize||Object.keys(E.serializers),E.serializers,E._stdErrSerialize===void 0?!0:E._stdErrSerialize),E._logEvent.ts=Y,E._logEvent.messages=b.filter(function(P){return m.indexOf(P)===-1}),E._logEvent.level.label=ie,E._logEvent.level.value=ce,G(ie,E._logEvent,de),E._logEvent=I(m)}function I(E){return{ts:0,messages:[],bindings:E||[],level:{label:"",value:0}}}function S(E){const h={type:E.constructor.name,msg:E.message,stack:E.stack};for(const b in E)h[b]===void 0&&(h[b]=E[b]);return h}function C(E){return typeof E.timestamp=="function"?E.timestamp:E.timestamp===!1?se:$}function R(){return{}}function B(E){return E}function K(){}function se(){return!1}function $(){return Date.now()}function U(){return Math.round(Date.now()/1e3)}function x(){return new Date(Date.now()).toISOString()}function T(){function E(h){return typeof h<"u"&&h}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return E(self)||E(window)||E(this)||{}}}return gc}var Jn={},df;function pf(){return df||(df=1,Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.PINO_CUSTOM_CONTEXT_KEY=Jn.PINO_LOGGER_DEFAULTS=void 0,Jn.PINO_LOGGER_DEFAULTS={level:"info"},Jn.PINO_CUSTOM_CONTEXT_KEY="custom_context"),Jn}var or={},gf;function Gb(){if(gf)return or;gf=1,Object.defineProperty(or,"__esModule",{value:!0}),or.generateChildLogger=or.formatChildLoggerContext=or.getLoggerContext=or.setBrowserLoggerContext=or.getBrowserLoggerContext=or.getDefaultLoggerOptions=void 0;const r=pf();function e(f){return Object.assign(Object.assign({},f),{level:f?.level||r.PINO_LOGGER_DEFAULTS.level})}or.getDefaultLoggerOptions=e;function t(f,v=r.PINO_CUSTOM_CONTEXT_KEY){return f[v]||""}or.getBrowserLoggerContext=t;function i(f,v,p=r.PINO_CUSTOM_CONTEXT_KEY){return f[p]=v,f}or.setBrowserLoggerContext=i;function o(f,v=r.PINO_CUSTOM_CONTEXT_KEY){let p="";return typeof f.bindings>"u"?p=t(f,v):p=f.bindings().context||"",p}or.getLoggerContext=o;function a(f,v,p=r.PINO_CUSTOM_CONTEXT_KEY){const w=o(f,p);return w.trim()?`${w}/${v}`:v}or.formatChildLoggerContext=a;function u(f,v,p=r.PINO_CUSTOM_CONTEXT_KEY){const w=a(f,v,p),I=f.child({context:w});return i(I,w,p)}return or.generateChildLogger=u,or}(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.pino=void 0;const e=Kb,t=e.__importDefault(kb());Object.defineProperty(r,"pino",{enumerable:!0,get:function(){return t.default}}),e.__exportStar(pf(),r),e.__exportStar(Gb(),r)})(Je);class Wb extends Wn{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class Yb extends Wn{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class Jb{constructor(e,t){this.logger=e,this.core=t}}class Qb extends Wn{constructor(e,t){super(),this.relayer=e,this.logger=t}}class Xb extends Wn{constructor(e){super()}}class Zb{constructor(e,t,i,o){this.core=e,this.logger=t,this.name=i}}class em extends Wn{constructor(e,t){super(),this.relayer=e,this.logger=t}}class tm extends Wn{constructor(e,t){super(),this.core=e,this.logger=t}}class rm{constructor(e,t){this.projectId=e,this.logger=t}}class nm{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class im{constructor(e){this.client=e}}const sm=r=>JSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),om=r=>{const e=/([\[:])?(\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,t=r.replace(e,'$1"$2n"$3');return JSON.parse(t,(i,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function vc(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return om(r)}catch{return r}}function ls(r){return typeof r=="string"?r:sm(r)||""}var yc={},vf={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Ne,t=Dr;r.DIGEST_LENGTH=64,r.BLOCK_SIZE=128;var i=function(){function f(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._tempHi),t.wipe(this._tempLo),this.reset()},f.prototype.update=function(v,p){if(p===void 0&&(p=v.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var w=0;if(this._bytesHashed+=p,this._bufferLength>0){for(;this._bufferLength<r.BLOCK_SIZE&&p>0;)this._buffer[this._bufferLength++]=v[w++],p--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(p>=this.blockSize&&(w=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,v,w,p),p%=this.blockSize);p>0;)this._buffer[this._bufferLength++]=v[w++],p--;return this},f.prototype.finish=function(v){if(!this._finished){var p=this._bytesHashed,w=this._bufferLength,I=p/536870912|0,S=p<<3,C=p%128<112?128:256;this._buffer[w]=128;for(var R=w+1;R<C-8;R++)this._buffer[R]=0;e.writeUint32BE(I,this._buffer,C-8),e.writeUint32BE(S,this._buffer,C-4),a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,C),this._finished=!0}for(var R=0;R<this.digestLength/8;R++)e.writeUint32BE(this._stateHi[R],v,R*8),e.writeUint32BE(this._stateLo[R],v,R*8+4);return this},f.prototype.digest=function(){var v=new Uint8Array(this.digestLength);return this.finish(v),v},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(v){return this._stateHi.set(v.stateHi),this._stateLo.set(v.stateLo),this._bufferLength=v.bufferLength,v.buffer&&this._buffer.set(v.buffer),this._bytesHashed=v.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(v){t.wipe(v.stateHi),t.wipe(v.stateLo),v.buffer&&t.wipe(v.buffer),v.bufferLength=0,v.bytesHashed=0},f}();r.SHA512=i;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function a(f,v,p,w,I,S,C){for(var R=p[0],B=p[1],K=p[2],se=p[3],$=p[4],U=p[5],x=p[6],T=p[7],E=w[0],h=w[1],b=w[2],G=w[3],Y=w[4],ie=w[5],ce=w[6],de=w[7],m,P,ee,Q,V,k,J,re;C>=128;){for(var me=0;me<16;me++){var oe=8*me+S;f[me]=e.readUint32BE(I,oe),v[me]=e.readUint32BE(I,oe+4)}for(var me=0;me<80;me++){var we=R,le=B,_e=K,H=se,q=$,F=U,d=x,A=T,ae=E,fe=h,xe=b,Be=G,Ve=Y,Ue=ie,vt=ce,yt=de;if(m=T,P=de,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=($>>>14|Y<<32-14)^($>>>18|Y<<32-18)^(Y>>>41-32|$<<32-(41-32)),P=(Y>>>14|$<<32-14)^(Y>>>18|$<<32-18)^($>>>41-32|Y<<32-(41-32)),V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,m=$&U^~$&x,P=Y&ie^~Y&ce,V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,m=o[me*2],P=o[me*2+1],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,m=f[me%16],P=v[me%16],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,ee=J&65535|re<<16,Q=V&65535|k<<16,m=ee,P=Q,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=(R>>>28|E<<32-28)^(E>>>34-32|R<<32-(34-32))^(E>>>39-32|R<<32-(39-32)),P=(E>>>28|R<<32-28)^(R>>>34-32|E<<32-(34-32))^(R>>>39-32|E<<32-(39-32)),V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,m=R&B^R&K^B&K,P=E&h^E&b^h&b,V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,A=J&65535|re<<16,yt=V&65535|k<<16,m=H,P=Be,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=ee,P=Q,V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,H=J&65535|re<<16,Be=V&65535|k<<16,B=we,K=le,se=_e,$=H,U=q,x=F,T=d,R=A,h=ae,b=fe,G=xe,Y=Be,ie=Ve,ce=Ue,de=vt,E=yt,me%16===15)for(var oe=0;oe<16;oe++)m=f[oe],P=v[oe],V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=f[(oe+9)%16],P=v[(oe+9)%16],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,ee=f[(oe+1)%16],Q=v[(oe+1)%16],m=(ee>>>1|Q<<32-1)^(ee>>>8|Q<<32-8)^ee>>>7,P=(Q>>>1|ee<<32-1)^(Q>>>8|ee<<32-8)^(Q>>>7|ee<<32-7),V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,ee=f[(oe+14)%16],Q=v[(oe+14)%16],m=(ee>>>19|Q<<32-19)^(Q>>>61-32|ee<<32-(61-32))^ee>>>6,P=(Q>>>19|ee<<32-19)^(ee>>>61-32|Q<<32-(61-32))^(Q>>>6|ee<<32-6),V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,f[oe]=J&65535|re<<16,v[oe]=V&65535|k<<16}m=R,P=E,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[0],P=w[0],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[0]=R=J&65535|re<<16,w[0]=E=V&65535|k<<16,m=B,P=h,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[1],P=w[1],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[1]=B=J&65535|re<<16,w[1]=h=V&65535|k<<16,m=K,P=b,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[2],P=w[2],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[2]=K=J&65535|re<<16,w[2]=b=V&65535|k<<16,m=se,P=G,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[3],P=w[3],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[3]=se=J&65535|re<<16,w[3]=G=V&65535|k<<16,m=$,P=Y,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[4],P=w[4],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[4]=$=J&65535|re<<16,w[4]=Y=V&65535|k<<16,m=U,P=ie,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[5],P=w[5],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[5]=U=J&65535|re<<16,w[5]=ie=V&65535|k<<16,m=x,P=ce,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[6],P=w[6],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[6]=x=J&65535|re<<16,w[6]=ce=V&65535|k<<16,m=T,P=de,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[7],P=w[7],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[7]=T=J&65535|re<<16,w[7]=de=V&65535|k<<16,S+=128,C-=128}return S}function u(f){var v=new i;v.update(f);var p=v.digest();return v.clean(),p}r.hash=u})(vf),function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertSecretKeyToX25519=r.convertPublicKeyToX25519=r.verify=r.sign=r.extractPublicKeyFromSecretKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.SEED_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=r.SIGNATURE_LENGTH=void 0;const e=di,t=vf,i=Dr;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function o(H){const q=new Float64Array(16);if(H)for(let F=0;F<H.length;F++)q[F]=H[F];return q}const a=new Uint8Array(32);a[0]=9;const u=o(),f=o([1]),v=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),p=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),I=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),S=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function C(H,q){for(let F=0;F<16;F++)H[F]=q[F]|0}function R(H){let q=1;for(let F=0;F<16;F++){let d=H[F]+q+65535;q=Math.floor(d/65536),H[F]=d-q*65536}H[0]+=q-1+37*(q-1)}function B(H,q,F){const d=~(F-1);for(let A=0;A<16;A++){const ae=d&(H[A]^q[A]);H[A]^=ae,q[A]^=ae}}function K(H,q){const F=o(),d=o();for(let A=0;A<16;A++)d[A]=q[A];R(d),R(d),R(d);for(let A=0;A<2;A++){F[0]=d[0]-65517;for(let fe=1;fe<15;fe++)F[fe]=d[fe]-65535-(F[fe-1]>>16&1),F[fe-1]&=65535;F[15]=d[15]-32767-(F[14]>>16&1);const ae=F[15]>>16&1;F[14]&=65535,B(d,F,1-ae)}for(let A=0;A<16;A++)H[2*A]=d[A]&255,H[2*A+1]=d[A]>>8}function se(H,q){let F=0;for(let d=0;d<32;d++)F|=H[d]^q[d];return(1&F-1>>>8)-1}function $(H,q){const F=new Uint8Array(32),d=new Uint8Array(32);return K(F,H),K(d,q),se(F,d)}function U(H){const q=new Uint8Array(32);return K(q,H),q[0]&1}function x(H,q){for(let F=0;F<16;F++)H[F]=q[2*F]+(q[2*F+1]<<8);H[15]&=32767}function T(H,q,F){for(let d=0;d<16;d++)H[d]=q[d]+F[d]}function E(H,q,F){for(let d=0;d<16;d++)H[d]=q[d]-F[d]}function h(H,q,F){let d,A,ae=0,fe=0,xe=0,Be=0,Ve=0,Ue=0,vt=0,yt=0,Me=0,Oe=0,$e=0,Fe=0,qe=0,Pe=0,Le=0,Se=0,Ce=0,ze=0,Ie=0,ke=0,We=0,et=0,tt=0,Qe=0,cr=0,yr=0,en=0,ur=0,pn=0,Tn=0,Xn=0,Dt=F[0],_t=F[1],St=F[2],xt=F[3],wt=F[4],bt=F[5],Lt=F[6],Ut=F[7],Ot=F[8],jt=F[9],It=F[10],Tt=F[11],Pt=F[12],ft=F[13],Mt=F[14],qt=F[15];d=q[0],ae+=d*Dt,fe+=d*_t,xe+=d*St,Be+=d*xt,Ve+=d*wt,Ue+=d*bt,vt+=d*Lt,yt+=d*Ut,Me+=d*Ot,Oe+=d*jt,$e+=d*It,Fe+=d*Tt,qe+=d*Pt,Pe+=d*ft,Le+=d*Mt,Se+=d*qt,d=q[1],fe+=d*Dt,xe+=d*_t,Be+=d*St,Ve+=d*xt,Ue+=d*wt,vt+=d*bt,yt+=d*Lt,Me+=d*Ut,Oe+=d*Ot,$e+=d*jt,Fe+=d*It,qe+=d*Tt,Pe+=d*Pt,Le+=d*ft,Se+=d*Mt,Ce+=d*qt,d=q[2],xe+=d*Dt,Be+=d*_t,Ve+=d*St,Ue+=d*xt,vt+=d*wt,yt+=d*bt,Me+=d*Lt,Oe+=d*Ut,$e+=d*Ot,Fe+=d*jt,qe+=d*It,Pe+=d*Tt,Le+=d*Pt,Se+=d*ft,Ce+=d*Mt,ze+=d*qt,d=q[3],Be+=d*Dt,Ve+=d*_t,Ue+=d*St,vt+=d*xt,yt+=d*wt,Me+=d*bt,Oe+=d*Lt,$e+=d*Ut,Fe+=d*Ot,qe+=d*jt,Pe+=d*It,Le+=d*Tt,Se+=d*Pt,Ce+=d*ft,ze+=d*Mt,Ie+=d*qt,d=q[4],Ve+=d*Dt,Ue+=d*_t,vt+=d*St,yt+=d*xt,Me+=d*wt,Oe+=d*bt,$e+=d*Lt,Fe+=d*Ut,qe+=d*Ot,Pe+=d*jt,Le+=d*It,Se+=d*Tt,Ce+=d*Pt,ze+=d*ft,Ie+=d*Mt,ke+=d*qt,d=q[5],Ue+=d*Dt,vt+=d*_t,yt+=d*St,Me+=d*xt,Oe+=d*wt,$e+=d*bt,Fe+=d*Lt,qe+=d*Ut,Pe+=d*Ot,Le+=d*jt,Se+=d*It,Ce+=d*Tt,ze+=d*Pt,Ie+=d*ft,ke+=d*Mt,We+=d*qt,d=q[6],vt+=d*Dt,yt+=d*_t,Me+=d*St,Oe+=d*xt,$e+=d*wt,Fe+=d*bt,qe+=d*Lt,Pe+=d*Ut,Le+=d*Ot,Se+=d*jt,Ce+=d*It,ze+=d*Tt,Ie+=d*Pt,ke+=d*ft,We+=d*Mt,et+=d*qt,d=q[7],yt+=d*Dt,Me+=d*_t,Oe+=d*St,$e+=d*xt,Fe+=d*wt,qe+=d*bt,Pe+=d*Lt,Le+=d*Ut,Se+=d*Ot,Ce+=d*jt,ze+=d*It,Ie+=d*Tt,ke+=d*Pt,We+=d*ft,et+=d*Mt,tt+=d*qt,d=q[8],Me+=d*Dt,Oe+=d*_t,$e+=d*St,Fe+=d*xt,qe+=d*wt,Pe+=d*bt,Le+=d*Lt,Se+=d*Ut,Ce+=d*Ot,ze+=d*jt,Ie+=d*It,ke+=d*Tt,We+=d*Pt,et+=d*ft,tt+=d*Mt,Qe+=d*qt,d=q[9],Oe+=d*Dt,$e+=d*_t,Fe+=d*St,qe+=d*xt,Pe+=d*wt,Le+=d*bt,Se+=d*Lt,Ce+=d*Ut,ze+=d*Ot,Ie+=d*jt,ke+=d*It,We+=d*Tt,et+=d*Pt,tt+=d*ft,Qe+=d*Mt,cr+=d*qt,d=q[10],$e+=d*Dt,Fe+=d*_t,qe+=d*St,Pe+=d*xt,Le+=d*wt,Se+=d*bt,Ce+=d*Lt,ze+=d*Ut,Ie+=d*Ot,ke+=d*jt,We+=d*It,et+=d*Tt,tt+=d*Pt,Qe+=d*ft,cr+=d*Mt,yr+=d*qt,d=q[11],Fe+=d*Dt,qe+=d*_t,Pe+=d*St,Le+=d*xt,Se+=d*wt,Ce+=d*bt,ze+=d*Lt,Ie+=d*Ut,ke+=d*Ot,We+=d*jt,et+=d*It,tt+=d*Tt,Qe+=d*Pt,cr+=d*ft,yr+=d*Mt,en+=d*qt,d=q[12],qe+=d*Dt,Pe+=d*_t,Le+=d*St,Se+=d*xt,Ce+=d*wt,ze+=d*bt,Ie+=d*Lt,ke+=d*Ut,We+=d*Ot,et+=d*jt,tt+=d*It,Qe+=d*Tt,cr+=d*Pt,yr+=d*ft,en+=d*Mt,ur+=d*qt,d=q[13],Pe+=d*Dt,Le+=d*_t,Se+=d*St,Ce+=d*xt,ze+=d*wt,Ie+=d*bt,ke+=d*Lt,We+=d*Ut,et+=d*Ot,tt+=d*jt,Qe+=d*It,cr+=d*Tt,yr+=d*Pt,en+=d*ft,ur+=d*Mt,pn+=d*qt,d=q[14],Le+=d*Dt,Se+=d*_t,Ce+=d*St,ze+=d*xt,Ie+=d*wt,ke+=d*bt,We+=d*Lt,et+=d*Ut,tt+=d*Ot,Qe+=d*jt,cr+=d*It,yr+=d*Tt,en+=d*Pt,ur+=d*ft,pn+=d*Mt,Tn+=d*qt,d=q[15],Se+=d*Dt,Ce+=d*_t,ze+=d*St,Ie+=d*xt,ke+=d*wt,We+=d*bt,et+=d*Lt,tt+=d*Ut,Qe+=d*Ot,cr+=d*jt,yr+=d*It,en+=d*Tt,ur+=d*Pt,pn+=d*ft,Tn+=d*Mt,Xn+=d*qt,ae+=38*Ce,fe+=38*ze,xe+=38*Ie,Be+=38*ke,Ve+=38*We,Ue+=38*et,vt+=38*tt,yt+=38*Qe,Me+=38*cr,Oe+=38*yr,$e+=38*en,Fe+=38*ur,qe+=38*pn,Pe+=38*Tn,Le+=38*Xn,A=1,d=ae+A+65535,A=Math.floor(d/65536),ae=d-A*65536,d=fe+A+65535,A=Math.floor(d/65536),fe=d-A*65536,d=xe+A+65535,A=Math.floor(d/65536),xe=d-A*65536,d=Be+A+65535,A=Math.floor(d/65536),Be=d-A*65536,d=Ve+A+65535,A=Math.floor(d/65536),Ve=d-A*65536,d=Ue+A+65535,A=Math.floor(d/65536),Ue=d-A*65536,d=vt+A+65535,A=Math.floor(d/65536),vt=d-A*65536,d=yt+A+65535,A=Math.floor(d/65536),yt=d-A*65536,d=Me+A+65535,A=Math.floor(d/65536),Me=d-A*65536,d=Oe+A+65535,A=Math.floor(d/65536),Oe=d-A*65536,d=$e+A+65535,A=Math.floor(d/65536),$e=d-A*65536,d=Fe+A+65535,A=Math.floor(d/65536),Fe=d-A*65536,d=qe+A+65535,A=Math.floor(d/65536),qe=d-A*65536,d=Pe+A+65535,A=Math.floor(d/65536),Pe=d-A*65536,d=Le+A+65535,A=Math.floor(d/65536),Le=d-A*65536,d=Se+A+65535,A=Math.floor(d/65536),Se=d-A*65536,ae+=A-1+37*(A-1),A=1,d=ae+A+65535,A=Math.floor(d/65536),ae=d-A*65536,d=fe+A+65535,A=Math.floor(d/65536),fe=d-A*65536,d=xe+A+65535,A=Math.floor(d/65536),xe=d-A*65536,d=Be+A+65535,A=Math.floor(d/65536),Be=d-A*65536,d=Ve+A+65535,A=Math.floor(d/65536),Ve=d-A*65536,d=Ue+A+65535,A=Math.floor(d/65536),Ue=d-A*65536,d=vt+A+65535,A=Math.floor(d/65536),vt=d-A*65536,d=yt+A+65535,A=Math.floor(d/65536),yt=d-A*65536,d=Me+A+65535,A=Math.floor(d/65536),Me=d-A*65536,d=Oe+A+65535,A=Math.floor(d/65536),Oe=d-A*65536,d=$e+A+65535,A=Math.floor(d/65536),$e=d-A*65536,d=Fe+A+65535,A=Math.floor(d/65536),Fe=d-A*65536,d=qe+A+65535,A=Math.floor(d/65536),qe=d-A*65536,d=Pe+A+65535,A=Math.floor(d/65536),Pe=d-A*65536,d=Le+A+65535,A=Math.floor(d/65536),Le=d-A*65536,d=Se+A+65535,A=Math.floor(d/65536),Se=d-A*65536,ae+=A-1+37*(A-1),H[0]=ae,H[1]=fe,H[2]=xe,H[3]=Be,H[4]=Ve,H[5]=Ue,H[6]=vt,H[7]=yt,H[8]=Me,H[9]=Oe,H[10]=$e,H[11]=Fe,H[12]=qe,H[13]=Pe,H[14]=Le,H[15]=Se}function b(H,q){h(H,q,q)}function G(H,q){const F=o();let d;for(d=0;d<16;d++)F[d]=q[d];for(d=253;d>=0;d--)b(F,F),d!==2&&d!==4&&h(F,F,q);for(d=0;d<16;d++)H[d]=F[d]}function Y(H,q){const F=o();let d;for(d=0;d<16;d++)F[d]=q[d];for(d=250;d>=0;d--)b(F,F),d!==1&&h(F,F,q);for(d=0;d<16;d++)H[d]=F[d]}function ie(H,q){const F=o(),d=o(),A=o(),ae=o(),fe=o(),xe=o(),Be=o(),Ve=o(),Ue=o();E(F,H[1],H[0]),E(Ue,q[1],q[0]),h(F,F,Ue),T(d,H[0],H[1]),T(Ue,q[0],q[1]),h(d,d,Ue),h(A,H[3],q[3]),h(A,A,p),h(ae,H[2],q[2]),T(ae,ae,ae),E(fe,d,F),E(xe,ae,A),T(Be,ae,A),T(Ve,d,F),h(H[0],fe,xe),h(H[1],Ve,Be),h(H[2],Be,xe),h(H[3],fe,Ve)}function ce(H,q,F){for(let d=0;d<4;d++)B(H[d],q[d],F)}function de(H,q){const F=o(),d=o(),A=o();G(A,q[2]),h(F,q[0],A),h(d,q[1],A),K(H,d),H[31]^=U(F)<<7}function m(H,q,F){C(H[0],u),C(H[1],f),C(H[2],f),C(H[3],u);for(let d=255;d>=0;--d){const A=F[d/8|0]>>(d&7)&1;ce(H,q,A),ie(q,H),ie(H,H),ce(H,q,A)}}function P(H,q){const F=[o(),o(),o(),o()];C(F[0],w),C(F[1],I),C(F[2],f),h(F[3],w,I),m(H,F,q)}function ee(H){if(H.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const q=(0,t.hash)(H);q[0]&=248,q[31]&=127,q[31]|=64;const F=new Uint8Array(32),d=[o(),o(),o(),o()];P(d,q),de(F,d);const A=new Uint8Array(64);return A.set(H),A.set(F,32),{publicKey:F,secretKey:A}}r.generateKeyPairFromSeed=ee;function Q(H){const q=(0,e.randomBytes)(32,H),F=ee(q);return(0,i.wipe)(q),F}r.generateKeyPair=Q;function V(H){if(H.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(H.subarray(32))}r.extractPublicKeyFromSecretKey=V;const k=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function J(H,q){let F,d,A,ae;for(d=63;d>=32;--d){for(F=0,A=d-32,ae=d-12;A<ae;++A)q[A]+=F-16*q[d]*k[A-(d-32)],F=Math.floor((q[A]+128)/256),q[A]-=F*256;q[A]+=F,q[d]=0}for(F=0,A=0;A<32;A++)q[A]+=F-(q[31]>>4)*k[A],F=q[A]>>8,q[A]&=255;for(A=0;A<32;A++)q[A]-=F*k[A];for(d=0;d<32;d++)q[d+1]+=q[d]>>8,H[d]=q[d]&255}function re(H){const q=new Float64Array(64);for(let F=0;F<64;F++)q[F]=H[F];for(let F=0;F<64;F++)H[F]=0;J(H,q)}function me(H,q){const F=new Float64Array(64),d=[o(),o(),o(),o()],A=(0,t.hash)(H.subarray(0,32));A[0]&=248,A[31]&=127,A[31]|=64;const ae=new Uint8Array(64);ae.set(A.subarray(32),32);const fe=new t.SHA512;fe.update(ae.subarray(32)),fe.update(q);const xe=fe.digest();fe.clean(),re(xe),P(d,xe),de(ae,d),fe.reset(),fe.update(ae.subarray(0,32)),fe.update(H.subarray(32)),fe.update(q);const Be=fe.digest();re(Be);for(let Ve=0;Ve<32;Ve++)F[Ve]=xe[Ve];for(let Ve=0;Ve<32;Ve++)for(let Ue=0;Ue<32;Ue++)F[Ve+Ue]+=Be[Ve]*A[Ue];return J(ae.subarray(32),F),ae}r.sign=me;function oe(H,q){const F=o(),d=o(),A=o(),ae=o(),fe=o(),xe=o(),Be=o();return C(H[2],f),x(H[1],q),b(A,H[1]),h(ae,A,v),E(A,A,H[2]),T(ae,H[2],ae),b(fe,ae),b(xe,fe),h(Be,xe,fe),h(F,Be,A),h(F,F,ae),Y(F,F),h(F,F,A),h(F,F,ae),h(F,F,ae),h(H[0],F,ae),b(d,H[0]),h(d,d,ae),$(d,A)&&h(H[0],H[0],S),b(d,H[0]),h(d,d,ae),$(d,A)?-1:(U(H[0])===q[31]>>7&&E(H[0],u,H[0]),h(H[3],H[0],H[1]),0)}function we(H,q,F){const d=new Uint8Array(32),A=[o(),o(),o(),o()],ae=[o(),o(),o(),o()];if(F.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if(oe(ae,H))return!1;const fe=new t.SHA512;fe.update(F.subarray(0,32)),fe.update(H),fe.update(q);const xe=fe.digest();return re(xe),m(A,ae,xe),P(ae,F.subarray(32)),ie(A,ae),de(d,A),!se(F,d)}r.verify=we;function le(H){let q=[o(),o(),o(),o()];if(oe(q,H))throw new Error("Ed25519: invalid public key");let F=o(),d=o(),A=q[1];T(F,f,A),E(d,f,A),G(d,d),h(F,F,d);let ae=new Uint8Array(32);return K(ae,F),ae}r.convertPublicKeyToX25519=le;function _e(H){const q=(0,t.hash)(H.subarray(0,32));q[0]&=248,q[31]&=127,q[31]|=64;const F=new Uint8Array(q.subarray(0,32));return(0,i.wipe)(q),F}r.convertSecretKeyToX25519=_e}(yc);const am="EdDSA",cm="JWT",yf=".",_f="base64url",um="utf8",hm="utf8",lm=":",fm="did",dm="key",bf="base58btc",pm="z",gm="K36",vm=32;function so(r){return nr(pr(ls(r),um),_f)}function mf(r){const e=pr(gm,bf),t=pm+nr(Ta([e,r]),bf);return[fm,dm,t].join(lm)}function ym(r){return nr(r,_f)}function _m(r){return pr([so(r.header),so(r.payload)].join(yf),hm)}function bm(r){return[so(r.header),so(r.payload),ym(r.signature)].join(yf)}function wf(r=di.randomBytes(vm)){return yc.generateKeyPairFromSeed(r)}async function mm(r,e,t,i,o=ye.fromMiliseconds(Date.now())){const a={alg:am,typ:cm},u=mf(i.publicKey),f=o+t,v={iss:u,sub:r,aud:e,iat:o,exp:f},p=_m({header:a,payload:v}),w=yc.sign(i.secretKey,p);return bm({header:a,payload:v,signature:w})}const wm="PARSE_ERROR",Em="INVALID_REQUEST",Dm="METHOD_NOT_FOUND",Sm="INVALID_PARAMS",Ef="INTERNAL_ERROR",_c="SERVER_ERROR",xm=[-32700,-32600,-32601,-32602,-32603],fs={[wm]:{code:-32700,message:"Parse error"},[Em]:{code:-32600,message:"Invalid Request"},[Dm]:{code:-32601,message:"Method not found"},[Sm]:{code:-32602,message:"Invalid params"},[Ef]:{code:-32603,message:"Internal error"},[_c]:{code:-32e3,message:"Server error"}},Df=_c;function Om(r){return xm.includes(r)}function Sf(r){return Object.keys(fs).includes(r)?fs[r]:fs[Df]}function Im(r){const e=Object.values(fs).find(t=>t.code===r);return e||fs[Df]}function xf(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var Of={};/*! *****************************************************************************
59
+ ***************************************************************************** */var hc=function(n,e){return hc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var o in i)i.hasOwnProperty(o)&&(t[o]=i[o])},hc(n,e)};function wb(n,e){hc(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var lc=function(){return lc=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++){t=arguments[i];for(var c in t)Object.prototype.hasOwnProperty.call(t,c)&&(e[c]=t[c])}return e},lc.apply(this,arguments)};function Eb(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(n);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(n,i[o])&&(t[i[o]]=n[i[o]]);return t}function Db(n,e,t,i){var o=arguments.length,c=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(n,e,t,i);else for(var f=n.length-1;f>=0;f--)(u=n[f])&&(c=(o<3?u(c):o>3?u(e,t,c):u(e,t))||c);return o>3&&c&&Object.defineProperty(e,t,c),c}function Sb(n,e){return function(t,i){e(t,i,n)}}function xb(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function Ob(n,e,t,i){function o(c){return c instanceof t?c:new t(function(u){u(c)})}return new(t||(t=Promise))(function(c,u){function f(w){try{p(i.next(w))}catch(I){u(I)}}function v(w){try{p(i.throw(w))}catch(I){u(I)}}function p(w){w.done?c(w.value):o(w.value).then(f,v)}p((i=i.apply(n,e||[])).next())})}function Ib(n,e){var t={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},i,o,c,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(p){return function(w){return v([p,w])}}function v(p){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,o&&(c=p[0]&2?o.return:p[0]?o.throw||((c=o.return)&&c.call(o),0):o.next)&&!(c=c.call(o,p[1])).done)return c;switch(o=0,c&&(p=[p[0]&2,c.value]),p[0]){case 0:case 1:c=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(c=t.trys,!(c=c.length>0&&c[c.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!c||p[1]>c[0]&&p[1]<c[3])){t.label=p[1];break}if(p[0]===6&&t.label<c[1]){t.label=c[1],c=p;break}if(c&&t.label<c[2]){t.label=c[2],t.ops.push(p);break}c[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(n,t)}catch(w){p=[6,w],o=0}finally{i=c=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function Pb(n,e,t,i){i===void 0&&(i=t),n[i]=e[t]}function Cb(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function fc(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],i=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function uf(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var i=t.call(n),o,c=[],u;try{for(;(e===void 0||e-- >0)&&!(o=i.next()).done;)c.push(o.value)}catch(f){u={error:f}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(u)throw u.error}}return c}function Ab(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(uf(arguments[e]));return n}function Tb(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var i=Array(n),o=0,e=0;e<t;e++)for(var c=arguments[e],u=0,f=c.length;u<f;u++,o++)i[o]=c[u];return i}function us(n){return this instanceof us?(this.v=n,this):new us(n)}function Rb(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(n,e||[]),o,c=[];return o={},u("next"),u("throw"),u("return"),o[Symbol.asyncIterator]=function(){return this},o;function u(S){i[S]&&(o[S]=function(C){return new Promise(function(R,B){c.push([S,C,R,B])>1||f(S,C)})})}function f(S,C){try{v(i[S](C))}catch(R){I(c[0][3],R)}}function v(S){S.value instanceof us?Promise.resolve(S.value.v).then(p,w):I(c[0][2],S)}function p(S){f("next",S)}function w(S){f("throw",S)}function I(S,C){S(C),c.shift(),c.length&&f(c[0][0],c[0][1])}}function Nb(n){var e,t;return e={},i("next"),i("throw",function(o){throw o}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(o,c){e[o]=n[o]?function(u){return(t=!t)?{value:us(n[o](u)),done:o==="return"}:c?c(u):u}:c}}function $b(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof fc=="function"?fc(n):n[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(c){t[c]=n[c]&&function(u){return new Promise(function(f,v){u=n[c](u),o(f,v,u.done,u.value)})}}function o(c,u,f,v){Promise.resolve(v).then(function(p){c({value:p,done:f})},u)}}function Fb(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function Lb(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)Object.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e.default=n,e}function Ub(n){return n&&n.__esModule?n:{default:n}}function jb(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function Mb(n,e,t){if(!e.has(n))throw new TypeError("attempted to set private field on non-instance");return e.set(n,t),t}var qb=Object.freeze({__proto__:null,__extends:wb,get __assign(){return lc},__rest:Eb,__decorate:Db,__param:Sb,__metadata:xb,__awaiter:Ob,__generator:Ib,__createBinding:Pb,__exportStar:Cb,__values:fc,__read:uf,__spread:Ab,__spreadArrays:Tb,__await:us,__asyncGenerator:Rb,__asyncDelegator:Nb,__asyncValues:$b,__makeTemplateObject:Fb,__importStar:Lb,__importDefault:Ub,__classPrivateFieldGet:jb,__classPrivateFieldSet:Mb}),Hb=Hn(qb),dc,hf;function Bb(){if(hf)return dc;hf=1;function n(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}dc=e;function e(t,i,o){var c=o&&o.stringify||n,u=1;if(typeof t=="object"&&t!==null){var f=i.length+u;if(f===1)return t;var v=new Array(f);v[0]=c(t);for(var p=1;p<f;p++)v[p]=c(i[p]);return v.join(" ")}if(typeof t!="string")return t;var w=i.length;if(w===0)return t;for(var I="",S=1-u,C=-1,R=t&&t.length||0,B=0;B<R;){if(t.charCodeAt(B)===37&&B+1<R){switch(C=C>-1?C:0,t.charCodeAt(B+1)){case 100:case 102:if(S>=w||i[S]==null)break;C<B&&(I+=t.slice(C,B)),I+=Number(i[S]),C=B+2,B++;break;case 105:if(S>=w||i[S]==null)break;C<B&&(I+=t.slice(C,B)),I+=Math.floor(Number(i[S])),C=B+2,B++;break;case 79:case 111:case 106:if(S>=w||i[S]===void 0)break;C<B&&(I+=t.slice(C,B));var K=typeof i[S];if(K==="string"){I+="'"+i[S]+"'",C=B+2,B++;break}if(K==="function"){I+=i[S].name||"<anonymous>",C=B+2,B++;break}I+=c(i[S]),C=B+2,B++;break;case 115:if(S>=w)break;C<B&&(I+=t.slice(C,B)),I+=String(i[S]),C=B+2,B++;break;case 37:C<B&&(I+=t.slice(C,B)),I+="%",C=B+2,B++,S--;break}++S}++B}return C===-1?t:(C<R&&(I+=t.slice(C)),I)}return dc}var pc,lf;function zb(){if(lf)return pc;lf=1;const n=Bb();pc=o;const e=T().console||{},t={mapHttpRequest:R,mapHttpResponse:R,wrapRequestSerializer:B,wrapResponseSerializer:B,wrapErrorSerializer:B,req:R,res:R,err:S};function i(E,h){return Array.isArray(E)?E.filter(function(G){return G!=="!stdSerializers.err"}):E===!0?Object.keys(h):!1}function o(E){E=E||{},E.browser=E.browser||{};const h=E.browser.transmit;if(h&&typeof h.send!="function")throw Error("pino: transmit option must have a send function");const b=E.browser.write||e;E.browser.write&&(E.browser.asObject=!0);const G=E.serializers||{},Y=i(E.browser.serialize,G);let ie=E.browser.serialize;Array.isArray(E.browser.serialize)&&E.browser.serialize.indexOf("!stdSerializers.err")>-1&&(ie=!1);const ce=["error","fatal","warn","info","debug","trace"];typeof b=="function"&&(b.error=b.fatal=b.warn=b.info=b.debug=b.trace=b),E.enabled===!1&&(E.level="silent");const de=E.level||"info",m=Object.create(b);m.log||(m.log=K),Object.defineProperty(m,"levelVal",{get:ee}),Object.defineProperty(m,"level",{get:Q,set:V});const P={transmit:h,serialize:Y,asObject:E.browser.asObject,levels:ce,timestamp:C(E)};m.levels=o.levels,m.level=de,m.setMaxListeners=m.getMaxListeners=m.emit=m.addListener=m.on=m.prependListener=m.once=m.prependOnceListener=m.removeListener=m.removeAllListeners=m.listeners=m.listenerCount=m.eventNames=m.write=m.flush=K,m.serializers=G,m._serialize=Y,m._stdErrSerialize=ie,m.child=k,h&&(m._logEvent=I());function ee(){return this.level==="silent"?1/0:this.levels.values[this.level]}function Q(){return this._level}function V(J){if(J!=="silent"&&!this.levels.values[J])throw Error("unknown level "+J);this._level=J,c(P,m,"error","log"),c(P,m,"fatal","error"),c(P,m,"warn","error"),c(P,m,"info","log"),c(P,m,"debug","log"),c(P,m,"trace","log")}function k(J,re){if(!J)throw new Error("missing bindings for child Pino");re=re||{},Y&&J.serializers&&(re.serializers=J.serializers);const me=re.serializers;if(Y&&me){var oe=Object.assign({},G,me),we=E.browser.serialize===!0?Object.keys(oe):Y;delete J.serializers,v([J],we,oe,this._stdErrSerialize)}function le(_e){this._childLevel=(_e._childLevel|0)+1,this.error=p(_e,J,"error"),this.fatal=p(_e,J,"fatal"),this.warn=p(_e,J,"warn"),this.info=p(_e,J,"info"),this.debug=p(_e,J,"debug"),this.trace=p(_e,J,"trace"),oe&&(this.serializers=oe,this._serialize=we),h&&(this._logEvent=I([].concat(_e._logEvent.bindings,J)))}return le.prototype=this,new le(this)}return m}o.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"}},o.stdSerializers=t,o.stdTimeFunctions=Object.assign({},{nullTime:se,epochTime:$,unixTime:U,isoTime:x});function c(E,h,b,G){const Y=Object.getPrototypeOf(h);h[b]=h.levelVal>h.levels.values[b]?K:Y[b]?Y[b]:e[b]||e[G]||K,u(E,h,b)}function u(E,h,b){!E.transmit&&h[b]===K||(h[b]=function(G){return function(){const ie=E.timestamp(),ce=new Array(arguments.length),de=Object.getPrototypeOf&&Object.getPrototypeOf(this)===e?e:this;for(var m=0;m<ce.length;m++)ce[m]=arguments[m];if(E.serialize&&!E.asObject&&v(ce,this._serialize,this.serializers,this._stdErrSerialize),E.asObject?G.call(de,f(this,b,ce,ie)):G.apply(de,ce),E.transmit){const P=E.transmit.level||h.level,ee=o.levels.values[P],Q=o.levels.values[b];if(Q<ee)return;w(this,{ts:ie,methodLevel:b,methodValue:Q,transmitLevel:P,transmitValue:o.levels.values[E.transmit.level||h.level],send:E.transmit.send,val:h.levelVal},ce)}}}(h[b]))}function f(E,h,b,G){E._serialize&&v(b,E._serialize,E.serializers,E._stdErrSerialize);const Y=b.slice();let ie=Y[0];const ce={};G&&(ce.time=G),ce.level=o.levels.values[h];let de=(E._childLevel|0)+1;if(de<1&&(de=1),ie!==null&&typeof ie=="object"){for(;de--&&typeof Y[0]=="object";)Object.assign(ce,Y.shift());ie=Y.length?n(Y.shift(),Y):void 0}else typeof ie=="string"&&(ie=n(Y.shift(),Y));return ie!==void 0&&(ce.msg=ie),ce}function v(E,h,b,G){for(const Y in E)if(G&&E[Y]instanceof Error)E[Y]=o.stdSerializers.err(E[Y]);else if(typeof E[Y]=="object"&&!Array.isArray(E[Y]))for(const ie in E[Y])h&&h.indexOf(ie)>-1&&ie in b&&(E[Y][ie]=b[ie](E[Y][ie]))}function p(E,h,b){return function(){const G=new Array(1+arguments.length);G[0]=h;for(var Y=1;Y<G.length;Y++)G[Y]=arguments[Y-1];return E[b].apply(this,G)}}function w(E,h,b){const G=h.send,Y=h.ts,ie=h.methodLevel,ce=h.methodValue,de=h.val,m=E._logEvent.bindings;v(b,E._serialize||Object.keys(E.serializers),E.serializers,E._stdErrSerialize===void 0?!0:E._stdErrSerialize),E._logEvent.ts=Y,E._logEvent.messages=b.filter(function(P){return m.indexOf(P)===-1}),E._logEvent.level.label=ie,E._logEvent.level.value=ce,G(ie,E._logEvent,de),E._logEvent=I(m)}function I(E){return{ts:0,messages:[],bindings:E||[],level:{label:"",value:0}}}function S(E){const h={type:E.constructor.name,msg:E.message,stack:E.stack};for(const b in E)h[b]===void 0&&(h[b]=E[b]);return h}function C(E){return typeof E.timestamp=="function"?E.timestamp:E.timestamp===!1?se:$}function R(){return{}}function B(E){return E}function K(){}function se(){return!1}function $(){return Date.now()}function U(){return Math.round(Date.now()/1e3)}function x(){return new Date(Date.now()).toISOString()}function T(){function E(h){return typeof h<"u"&&h}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return E(self)||E(window)||E(this)||{}}}return pc}var Yn={},ff;function df(){return ff||(ff=1,Object.defineProperty(Yn,"__esModule",{value:!0}),Yn.PINO_CUSTOM_CONTEXT_KEY=Yn.PINO_LOGGER_DEFAULTS=void 0,Yn.PINO_LOGGER_DEFAULTS={level:"info"},Yn.PINO_CUSTOM_CONTEXT_KEY="custom_context"),Yn}var or={},pf;function Kb(){if(pf)return or;pf=1,Object.defineProperty(or,"__esModule",{value:!0}),or.generateChildLogger=or.formatChildLoggerContext=or.getLoggerContext=or.setBrowserLoggerContext=or.getBrowserLoggerContext=or.getDefaultLoggerOptions=void 0;const n=df();function e(f){return Object.assign(Object.assign({},f),{level:f?.level||n.PINO_LOGGER_DEFAULTS.level})}or.getDefaultLoggerOptions=e;function t(f,v=n.PINO_CUSTOM_CONTEXT_KEY){return f[v]||""}or.getBrowserLoggerContext=t;function i(f,v,p=n.PINO_CUSTOM_CONTEXT_KEY){return f[p]=v,f}or.setBrowserLoggerContext=i;function o(f,v=n.PINO_CUSTOM_CONTEXT_KEY){let p="";return typeof f.bindings>"u"?p=t(f,v):p=f.bindings().context||"",p}or.getLoggerContext=o;function c(f,v,p=n.PINO_CUSTOM_CONTEXT_KEY){const w=o(f,p);return w.trim()?`${w}/${v}`:v}or.formatChildLoggerContext=c;function u(f,v,p=n.PINO_CUSTOM_CONTEXT_KEY){const w=c(f,v,p),I=f.child({context:w});return i(I,w,p)}return or.generateChildLogger=u,or}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.pino=void 0;const e=Hb,t=e.__importDefault(zb());Object.defineProperty(n,"pino",{enumerable:!0,get:function(){return t.default}}),e.__exportStar(df(),n),e.__exportStar(Kb(),n)})(Je);class Vb extends Gn{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class kb extends Gn{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class Gb{constructor(e,t){this.logger=e,this.core=t}}class Wb extends Gn{constructor(e,t){super(),this.relayer=e,this.logger=t}}class Yb extends Gn{constructor(e){super()}}class Jb{constructor(e,t,i,o){this.core=e,this.logger=t,this.name=i}}class Qb extends Gn{constructor(e,t){super(),this.relayer=e,this.logger=t}}class Xb extends Gn{constructor(e,t){super(),this.core=e,this.logger=t}}class Zb{constructor(e,t){this.projectId=e,this.logger=t}}class em{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class tm{constructor(e){this.client=e}}const rm=n=>JSON.stringify(n,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),nm=n=>{const e=/([\[:])?(\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,t=n.replace(e,'$1"$2n"$3');return JSON.parse(t,(i,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function gc(n){if(typeof n!="string")throw new Error(`Cannot safe json parse value of type ${typeof n}`);try{return nm(n)}catch{return n}}function hs(n){return typeof n=="string"?n:rm(n)||""}var vc={},gf={};(function(n){Object.defineProperty(n,"__esModule",{value:!0});var e=Ne,t=Er;n.DIGEST_LENGTH=64,n.BLOCK_SIZE=128;var i=function(){function f(){this.digestLength=n.DIGEST_LENGTH,this.blockSize=n.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._tempHi),t.wipe(this._tempLo),this.reset()},f.prototype.update=function(v,p){if(p===void 0&&(p=v.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var w=0;if(this._bytesHashed+=p,this._bufferLength>0){for(;this._bufferLength<n.BLOCK_SIZE&&p>0;)this._buffer[this._bufferLength++]=v[w++],p--;this._bufferLength===this.blockSize&&(c(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(p>=this.blockSize&&(w=c(this._tempHi,this._tempLo,this._stateHi,this._stateLo,v,w,p),p%=this.blockSize);p>0;)this._buffer[this._bufferLength++]=v[w++],p--;return this},f.prototype.finish=function(v){if(!this._finished){var p=this._bytesHashed,w=this._bufferLength,I=p/536870912|0,S=p<<3,C=p%128<112?128:256;this._buffer[w]=128;for(var R=w+1;R<C-8;R++)this._buffer[R]=0;e.writeUint32BE(I,this._buffer,C-8),e.writeUint32BE(S,this._buffer,C-4),c(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,C),this._finished=!0}for(var R=0;R<this.digestLength/8;R++)e.writeUint32BE(this._stateHi[R],v,R*8),e.writeUint32BE(this._stateLo[R],v,R*8+4);return this},f.prototype.digest=function(){var v=new Uint8Array(this.digestLength);return this.finish(v),v},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(v){return this._stateHi.set(v.stateHi),this._stateLo.set(v.stateLo),this._bufferLength=v.bufferLength,v.buffer&&this._buffer.set(v.buffer),this._bytesHashed=v.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(v){t.wipe(v.stateHi),t.wipe(v.stateLo),v.buffer&&t.wipe(v.buffer),v.bufferLength=0,v.bytesHashed=0},f}();n.SHA512=i;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function c(f,v,p,w,I,S,C){for(var R=p[0],B=p[1],K=p[2],se=p[3],$=p[4],U=p[5],x=p[6],T=p[7],E=w[0],h=w[1],b=w[2],G=w[3],Y=w[4],ie=w[5],ce=w[6],de=w[7],m,P,ee,Q,V,k,J,re;C>=128;){for(var me=0;me<16;me++){var oe=8*me+S;f[me]=e.readUint32BE(I,oe),v[me]=e.readUint32BE(I,oe+4)}for(var me=0;me<80;me++){var we=R,le=B,_e=K,H=se,q=$,F=U,d=x,A=T,ae=E,fe=h,xe=b,Be=G,Ve=Y,Ue=ie,vt=ce,yt=de;if(m=T,P=de,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=($>>>14|Y<<32-14)^($>>>18|Y<<32-18)^(Y>>>41-32|$<<32-(41-32)),P=(Y>>>14|$<<32-14)^(Y>>>18|$<<32-18)^($>>>41-32|Y<<32-(41-32)),V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,m=$&U^~$&x,P=Y&ie^~Y&ce,V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,m=o[me*2],P=o[me*2+1],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,m=f[me%16],P=v[me%16],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,ee=J&65535|re<<16,Q=V&65535|k<<16,m=ee,P=Q,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=(R>>>28|E<<32-28)^(E>>>34-32|R<<32-(34-32))^(E>>>39-32|R<<32-(39-32)),P=(E>>>28|R<<32-28)^(R>>>34-32|E<<32-(34-32))^(R>>>39-32|E<<32-(39-32)),V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,m=R&B^R&K^B&K,P=E&h^E&b^h&b,V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,A=J&65535|re<<16,yt=V&65535|k<<16,m=H,P=Be,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=ee,P=Q,V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,H=J&65535|re<<16,Be=V&65535|k<<16,B=we,K=le,se=_e,$=H,U=q,x=F,T=d,R=A,h=ae,b=fe,G=xe,Y=Be,ie=Ve,ce=Ue,de=vt,E=yt,me%16===15)for(var oe=0;oe<16;oe++)m=f[oe],P=v[oe],V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=f[(oe+9)%16],P=v[(oe+9)%16],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,ee=f[(oe+1)%16],Q=v[(oe+1)%16],m=(ee>>>1|Q<<32-1)^(ee>>>8|Q<<32-8)^ee>>>7,P=(Q>>>1|ee<<32-1)^(Q>>>8|ee<<32-8)^(Q>>>7|ee<<32-7),V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,ee=f[(oe+14)%16],Q=v[(oe+14)%16],m=(ee>>>19|Q<<32-19)^(Q>>>61-32|ee<<32-(61-32))^ee>>>6,P=(Q>>>19|ee<<32-19)^(ee>>>61-32|Q<<32-(61-32))^(Q>>>6|ee<<32-6),V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,f[oe]=J&65535|re<<16,v[oe]=V&65535|k<<16}m=R,P=E,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[0],P=w[0],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[0]=R=J&65535|re<<16,w[0]=E=V&65535|k<<16,m=B,P=h,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[1],P=w[1],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[1]=B=J&65535|re<<16,w[1]=h=V&65535|k<<16,m=K,P=b,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[2],P=w[2],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[2]=K=J&65535|re<<16,w[2]=b=V&65535|k<<16,m=se,P=G,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[3],P=w[3],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[3]=se=J&65535|re<<16,w[3]=G=V&65535|k<<16,m=$,P=Y,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[4],P=w[4],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[4]=$=J&65535|re<<16,w[4]=Y=V&65535|k<<16,m=U,P=ie,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[5],P=w[5],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[5]=U=J&65535|re<<16,w[5]=ie=V&65535|k<<16,m=x,P=ce,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[6],P=w[6],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[6]=x=J&65535|re<<16,w[6]=ce=V&65535|k<<16,m=T,P=de,V=P&65535,k=P>>>16,J=m&65535,re=m>>>16,m=p[7],P=w[7],V+=P&65535,k+=P>>>16,J+=m&65535,re+=m>>>16,k+=V>>>16,J+=k>>>16,re+=J>>>16,p[7]=T=J&65535|re<<16,w[7]=de=V&65535|k<<16,S+=128,C-=128}return S}function u(f){var v=new i;v.update(f);var p=v.digest();return v.clean(),p}n.hash=u})(gf),function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.convertSecretKeyToX25519=n.convertPublicKeyToX25519=n.verify=n.sign=n.extractPublicKeyFromSecretKey=n.generateKeyPair=n.generateKeyPairFromSeed=n.SEED_LENGTH=n.SECRET_KEY_LENGTH=n.PUBLIC_KEY_LENGTH=n.SIGNATURE_LENGTH=void 0;const e=fi,t=gf,i=Er;n.SIGNATURE_LENGTH=64,n.PUBLIC_KEY_LENGTH=32,n.SECRET_KEY_LENGTH=64,n.SEED_LENGTH=32;function o(H){const q=new Float64Array(16);if(H)for(let F=0;F<H.length;F++)q[F]=H[F];return q}const c=new Uint8Array(32);c[0]=9;const u=o(),f=o([1]),v=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),p=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),I=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),S=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function C(H,q){for(let F=0;F<16;F++)H[F]=q[F]|0}function R(H){let q=1;for(let F=0;F<16;F++){let d=H[F]+q+65535;q=Math.floor(d/65536),H[F]=d-q*65536}H[0]+=q-1+37*(q-1)}function B(H,q,F){const d=~(F-1);for(let A=0;A<16;A++){const ae=d&(H[A]^q[A]);H[A]^=ae,q[A]^=ae}}function K(H,q){const F=o(),d=o();for(let A=0;A<16;A++)d[A]=q[A];R(d),R(d),R(d);for(let A=0;A<2;A++){F[0]=d[0]-65517;for(let fe=1;fe<15;fe++)F[fe]=d[fe]-65535-(F[fe-1]>>16&1),F[fe-1]&=65535;F[15]=d[15]-32767-(F[14]>>16&1);const ae=F[15]>>16&1;F[14]&=65535,B(d,F,1-ae)}for(let A=0;A<16;A++)H[2*A]=d[A]&255,H[2*A+1]=d[A]>>8}function se(H,q){let F=0;for(let d=0;d<32;d++)F|=H[d]^q[d];return(1&F-1>>>8)-1}function $(H,q){const F=new Uint8Array(32),d=new Uint8Array(32);return K(F,H),K(d,q),se(F,d)}function U(H){const q=new Uint8Array(32);return K(q,H),q[0]&1}function x(H,q){for(let F=0;F<16;F++)H[F]=q[2*F]+(q[2*F+1]<<8);H[15]&=32767}function T(H,q,F){for(let d=0;d<16;d++)H[d]=q[d]+F[d]}function E(H,q,F){for(let d=0;d<16;d++)H[d]=q[d]-F[d]}function h(H,q,F){let d,A,ae=0,fe=0,xe=0,Be=0,Ve=0,Ue=0,vt=0,yt=0,Me=0,Oe=0,$e=0,Fe=0,qe=0,Pe=0,Le=0,Se=0,Ce=0,ze=0,Ie=0,ke=0,We=0,et=0,tt=0,Qe=0,ar=0,vr=0,Zr=0,cr=0,dn=0,An=0,Qn=0,Dt=F[0],_t=F[1],St=F[2],xt=F[3],wt=F[4],bt=F[5],Lt=F[6],Ut=F[7],Ot=F[8],jt=F[9],It=F[10],Tt=F[11],Pt=F[12],ft=F[13],Mt=F[14],qt=F[15];d=q[0],ae+=d*Dt,fe+=d*_t,xe+=d*St,Be+=d*xt,Ve+=d*wt,Ue+=d*bt,vt+=d*Lt,yt+=d*Ut,Me+=d*Ot,Oe+=d*jt,$e+=d*It,Fe+=d*Tt,qe+=d*Pt,Pe+=d*ft,Le+=d*Mt,Se+=d*qt,d=q[1],fe+=d*Dt,xe+=d*_t,Be+=d*St,Ve+=d*xt,Ue+=d*wt,vt+=d*bt,yt+=d*Lt,Me+=d*Ut,Oe+=d*Ot,$e+=d*jt,Fe+=d*It,qe+=d*Tt,Pe+=d*Pt,Le+=d*ft,Se+=d*Mt,Ce+=d*qt,d=q[2],xe+=d*Dt,Be+=d*_t,Ve+=d*St,Ue+=d*xt,vt+=d*wt,yt+=d*bt,Me+=d*Lt,Oe+=d*Ut,$e+=d*Ot,Fe+=d*jt,qe+=d*It,Pe+=d*Tt,Le+=d*Pt,Se+=d*ft,Ce+=d*Mt,ze+=d*qt,d=q[3],Be+=d*Dt,Ve+=d*_t,Ue+=d*St,vt+=d*xt,yt+=d*wt,Me+=d*bt,Oe+=d*Lt,$e+=d*Ut,Fe+=d*Ot,qe+=d*jt,Pe+=d*It,Le+=d*Tt,Se+=d*Pt,Ce+=d*ft,ze+=d*Mt,Ie+=d*qt,d=q[4],Ve+=d*Dt,Ue+=d*_t,vt+=d*St,yt+=d*xt,Me+=d*wt,Oe+=d*bt,$e+=d*Lt,Fe+=d*Ut,qe+=d*Ot,Pe+=d*jt,Le+=d*It,Se+=d*Tt,Ce+=d*Pt,ze+=d*ft,Ie+=d*Mt,ke+=d*qt,d=q[5],Ue+=d*Dt,vt+=d*_t,yt+=d*St,Me+=d*xt,Oe+=d*wt,$e+=d*bt,Fe+=d*Lt,qe+=d*Ut,Pe+=d*Ot,Le+=d*jt,Se+=d*It,Ce+=d*Tt,ze+=d*Pt,Ie+=d*ft,ke+=d*Mt,We+=d*qt,d=q[6],vt+=d*Dt,yt+=d*_t,Me+=d*St,Oe+=d*xt,$e+=d*wt,Fe+=d*bt,qe+=d*Lt,Pe+=d*Ut,Le+=d*Ot,Se+=d*jt,Ce+=d*It,ze+=d*Tt,Ie+=d*Pt,ke+=d*ft,We+=d*Mt,et+=d*qt,d=q[7],yt+=d*Dt,Me+=d*_t,Oe+=d*St,$e+=d*xt,Fe+=d*wt,qe+=d*bt,Pe+=d*Lt,Le+=d*Ut,Se+=d*Ot,Ce+=d*jt,ze+=d*It,Ie+=d*Tt,ke+=d*Pt,We+=d*ft,et+=d*Mt,tt+=d*qt,d=q[8],Me+=d*Dt,Oe+=d*_t,$e+=d*St,Fe+=d*xt,qe+=d*wt,Pe+=d*bt,Le+=d*Lt,Se+=d*Ut,Ce+=d*Ot,ze+=d*jt,Ie+=d*It,ke+=d*Tt,We+=d*Pt,et+=d*ft,tt+=d*Mt,Qe+=d*qt,d=q[9],Oe+=d*Dt,$e+=d*_t,Fe+=d*St,qe+=d*xt,Pe+=d*wt,Le+=d*bt,Se+=d*Lt,Ce+=d*Ut,ze+=d*Ot,Ie+=d*jt,ke+=d*It,We+=d*Tt,et+=d*Pt,tt+=d*ft,Qe+=d*Mt,ar+=d*qt,d=q[10],$e+=d*Dt,Fe+=d*_t,qe+=d*St,Pe+=d*xt,Le+=d*wt,Se+=d*bt,Ce+=d*Lt,ze+=d*Ut,Ie+=d*Ot,ke+=d*jt,We+=d*It,et+=d*Tt,tt+=d*Pt,Qe+=d*ft,ar+=d*Mt,vr+=d*qt,d=q[11],Fe+=d*Dt,qe+=d*_t,Pe+=d*St,Le+=d*xt,Se+=d*wt,Ce+=d*bt,ze+=d*Lt,Ie+=d*Ut,ke+=d*Ot,We+=d*jt,et+=d*It,tt+=d*Tt,Qe+=d*Pt,ar+=d*ft,vr+=d*Mt,Zr+=d*qt,d=q[12],qe+=d*Dt,Pe+=d*_t,Le+=d*St,Se+=d*xt,Ce+=d*wt,ze+=d*bt,Ie+=d*Lt,ke+=d*Ut,We+=d*Ot,et+=d*jt,tt+=d*It,Qe+=d*Tt,ar+=d*Pt,vr+=d*ft,Zr+=d*Mt,cr+=d*qt,d=q[13],Pe+=d*Dt,Le+=d*_t,Se+=d*St,Ce+=d*xt,ze+=d*wt,Ie+=d*bt,ke+=d*Lt,We+=d*Ut,et+=d*Ot,tt+=d*jt,Qe+=d*It,ar+=d*Tt,vr+=d*Pt,Zr+=d*ft,cr+=d*Mt,dn+=d*qt,d=q[14],Le+=d*Dt,Se+=d*_t,Ce+=d*St,ze+=d*xt,Ie+=d*wt,ke+=d*bt,We+=d*Lt,et+=d*Ut,tt+=d*Ot,Qe+=d*jt,ar+=d*It,vr+=d*Tt,Zr+=d*Pt,cr+=d*ft,dn+=d*Mt,An+=d*qt,d=q[15],Se+=d*Dt,Ce+=d*_t,ze+=d*St,Ie+=d*xt,ke+=d*wt,We+=d*bt,et+=d*Lt,tt+=d*Ut,Qe+=d*Ot,ar+=d*jt,vr+=d*It,Zr+=d*Tt,cr+=d*Pt,dn+=d*ft,An+=d*Mt,Qn+=d*qt,ae+=38*Ce,fe+=38*ze,xe+=38*Ie,Be+=38*ke,Ve+=38*We,Ue+=38*et,vt+=38*tt,yt+=38*Qe,Me+=38*ar,Oe+=38*vr,$e+=38*Zr,Fe+=38*cr,qe+=38*dn,Pe+=38*An,Le+=38*Qn,A=1,d=ae+A+65535,A=Math.floor(d/65536),ae=d-A*65536,d=fe+A+65535,A=Math.floor(d/65536),fe=d-A*65536,d=xe+A+65535,A=Math.floor(d/65536),xe=d-A*65536,d=Be+A+65535,A=Math.floor(d/65536),Be=d-A*65536,d=Ve+A+65535,A=Math.floor(d/65536),Ve=d-A*65536,d=Ue+A+65535,A=Math.floor(d/65536),Ue=d-A*65536,d=vt+A+65535,A=Math.floor(d/65536),vt=d-A*65536,d=yt+A+65535,A=Math.floor(d/65536),yt=d-A*65536,d=Me+A+65535,A=Math.floor(d/65536),Me=d-A*65536,d=Oe+A+65535,A=Math.floor(d/65536),Oe=d-A*65536,d=$e+A+65535,A=Math.floor(d/65536),$e=d-A*65536,d=Fe+A+65535,A=Math.floor(d/65536),Fe=d-A*65536,d=qe+A+65535,A=Math.floor(d/65536),qe=d-A*65536,d=Pe+A+65535,A=Math.floor(d/65536),Pe=d-A*65536,d=Le+A+65535,A=Math.floor(d/65536),Le=d-A*65536,d=Se+A+65535,A=Math.floor(d/65536),Se=d-A*65536,ae+=A-1+37*(A-1),A=1,d=ae+A+65535,A=Math.floor(d/65536),ae=d-A*65536,d=fe+A+65535,A=Math.floor(d/65536),fe=d-A*65536,d=xe+A+65535,A=Math.floor(d/65536),xe=d-A*65536,d=Be+A+65535,A=Math.floor(d/65536),Be=d-A*65536,d=Ve+A+65535,A=Math.floor(d/65536),Ve=d-A*65536,d=Ue+A+65535,A=Math.floor(d/65536),Ue=d-A*65536,d=vt+A+65535,A=Math.floor(d/65536),vt=d-A*65536,d=yt+A+65535,A=Math.floor(d/65536),yt=d-A*65536,d=Me+A+65535,A=Math.floor(d/65536),Me=d-A*65536,d=Oe+A+65535,A=Math.floor(d/65536),Oe=d-A*65536,d=$e+A+65535,A=Math.floor(d/65536),$e=d-A*65536,d=Fe+A+65535,A=Math.floor(d/65536),Fe=d-A*65536,d=qe+A+65535,A=Math.floor(d/65536),qe=d-A*65536,d=Pe+A+65535,A=Math.floor(d/65536),Pe=d-A*65536,d=Le+A+65535,A=Math.floor(d/65536),Le=d-A*65536,d=Se+A+65535,A=Math.floor(d/65536),Se=d-A*65536,ae+=A-1+37*(A-1),H[0]=ae,H[1]=fe,H[2]=xe,H[3]=Be,H[4]=Ve,H[5]=Ue,H[6]=vt,H[7]=yt,H[8]=Me,H[9]=Oe,H[10]=$e,H[11]=Fe,H[12]=qe,H[13]=Pe,H[14]=Le,H[15]=Se}function b(H,q){h(H,q,q)}function G(H,q){const F=o();let d;for(d=0;d<16;d++)F[d]=q[d];for(d=253;d>=0;d--)b(F,F),d!==2&&d!==4&&h(F,F,q);for(d=0;d<16;d++)H[d]=F[d]}function Y(H,q){const F=o();let d;for(d=0;d<16;d++)F[d]=q[d];for(d=250;d>=0;d--)b(F,F),d!==1&&h(F,F,q);for(d=0;d<16;d++)H[d]=F[d]}function ie(H,q){const F=o(),d=o(),A=o(),ae=o(),fe=o(),xe=o(),Be=o(),Ve=o(),Ue=o();E(F,H[1],H[0]),E(Ue,q[1],q[0]),h(F,F,Ue),T(d,H[0],H[1]),T(Ue,q[0],q[1]),h(d,d,Ue),h(A,H[3],q[3]),h(A,A,p),h(ae,H[2],q[2]),T(ae,ae,ae),E(fe,d,F),E(xe,ae,A),T(Be,ae,A),T(Ve,d,F),h(H[0],fe,xe),h(H[1],Ve,Be),h(H[2],Be,xe),h(H[3],fe,Ve)}function ce(H,q,F){for(let d=0;d<4;d++)B(H[d],q[d],F)}function de(H,q){const F=o(),d=o(),A=o();G(A,q[2]),h(F,q[0],A),h(d,q[1],A),K(H,d),H[31]^=U(F)<<7}function m(H,q,F){C(H[0],u),C(H[1],f),C(H[2],f),C(H[3],u);for(let d=255;d>=0;--d){const A=F[d/8|0]>>(d&7)&1;ce(H,q,A),ie(q,H),ie(H,H),ce(H,q,A)}}function P(H,q){const F=[o(),o(),o(),o()];C(F[0],w),C(F[1],I),C(F[2],f),h(F[3],w,I),m(H,F,q)}function ee(H){if(H.length!==n.SEED_LENGTH)throw new Error(`ed25519: seed must be ${n.SEED_LENGTH} bytes`);const q=(0,t.hash)(H);q[0]&=248,q[31]&=127,q[31]|=64;const F=new Uint8Array(32),d=[o(),o(),o(),o()];P(d,q),de(F,d);const A=new Uint8Array(64);return A.set(H),A.set(F,32),{publicKey:F,secretKey:A}}n.generateKeyPairFromSeed=ee;function Q(H){const q=(0,e.randomBytes)(32,H),F=ee(q);return(0,i.wipe)(q),F}n.generateKeyPair=Q;function V(H){if(H.length!==n.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${n.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(H.subarray(32))}n.extractPublicKeyFromSecretKey=V;const k=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function J(H,q){let F,d,A,ae;for(d=63;d>=32;--d){for(F=0,A=d-32,ae=d-12;A<ae;++A)q[A]+=F-16*q[d]*k[A-(d-32)],F=Math.floor((q[A]+128)/256),q[A]-=F*256;q[A]+=F,q[d]=0}for(F=0,A=0;A<32;A++)q[A]+=F-(q[31]>>4)*k[A],F=q[A]>>8,q[A]&=255;for(A=0;A<32;A++)q[A]-=F*k[A];for(d=0;d<32;d++)q[d+1]+=q[d]>>8,H[d]=q[d]&255}function re(H){const q=new Float64Array(64);for(let F=0;F<64;F++)q[F]=H[F];for(let F=0;F<64;F++)H[F]=0;J(H,q)}function me(H,q){const F=new Float64Array(64),d=[o(),o(),o(),o()],A=(0,t.hash)(H.subarray(0,32));A[0]&=248,A[31]&=127,A[31]|=64;const ae=new Uint8Array(64);ae.set(A.subarray(32),32);const fe=new t.SHA512;fe.update(ae.subarray(32)),fe.update(q);const xe=fe.digest();fe.clean(),re(xe),P(d,xe),de(ae,d),fe.reset(),fe.update(ae.subarray(0,32)),fe.update(H.subarray(32)),fe.update(q);const Be=fe.digest();re(Be);for(let Ve=0;Ve<32;Ve++)F[Ve]=xe[Ve];for(let Ve=0;Ve<32;Ve++)for(let Ue=0;Ue<32;Ue++)F[Ve+Ue]+=Be[Ve]*A[Ue];return J(ae.subarray(32),F),ae}n.sign=me;function oe(H,q){const F=o(),d=o(),A=o(),ae=o(),fe=o(),xe=o(),Be=o();return C(H[2],f),x(H[1],q),b(A,H[1]),h(ae,A,v),E(A,A,H[2]),T(ae,H[2],ae),b(fe,ae),b(xe,fe),h(Be,xe,fe),h(F,Be,A),h(F,F,ae),Y(F,F),h(F,F,A),h(F,F,ae),h(F,F,ae),h(H[0],F,ae),b(d,H[0]),h(d,d,ae),$(d,A)&&h(H[0],H[0],S),b(d,H[0]),h(d,d,ae),$(d,A)?-1:(U(H[0])===q[31]>>7&&E(H[0],u,H[0]),h(H[3],H[0],H[1]),0)}function we(H,q,F){const d=new Uint8Array(32),A=[o(),o(),o(),o()],ae=[o(),o(),o(),o()];if(F.length!==n.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${n.SIGNATURE_LENGTH} bytes`);if(oe(ae,H))return!1;const fe=new t.SHA512;fe.update(F.subarray(0,32)),fe.update(H),fe.update(q);const xe=fe.digest();return re(xe),m(A,ae,xe),P(ae,F.subarray(32)),ie(A,ae),de(d,A),!se(F,d)}n.verify=we;function le(H){let q=[o(),o(),o(),o()];if(oe(q,H))throw new Error("Ed25519: invalid public key");let F=o(),d=o(),A=q[1];T(F,f,A),E(d,f,A),G(d,d),h(F,F,d);let ae=new Uint8Array(32);return K(ae,F),ae}n.convertPublicKeyToX25519=le;function _e(H){const q=(0,t.hash)(H.subarray(0,32));q[0]&=248,q[31]&=127,q[31]|=64;const F=new Uint8Array(q.subarray(0,32));return(0,i.wipe)(q),F}n.convertSecretKeyToX25519=_e}(vc);const im="EdDSA",sm="JWT",vf=".",yf="base64url",om="utf8",am="utf8",cm=":",um="did",hm="key",_f="base58btc",lm="z",fm="K36",dm=32;function io(n){return nr(dr(hs(n),om),yf)}function bf(n){const e=dr(fm,_f),t=lm+nr(Aa([e,n]),_f);return[um,hm,t].join(cm)}function pm(n){return nr(n,yf)}function gm(n){return dr([io(n.header),io(n.payload)].join(vf),am)}function vm(n){return[io(n.header),io(n.payload),pm(n.signature)].join(vf)}function mf(n=fi.randomBytes(dm)){return vc.generateKeyPairFromSeed(n)}async function ym(n,e,t,i,o=ye.fromMiliseconds(Date.now())){const c={alg:im,typ:sm},u=bf(i.publicKey),f=o+t,v={iss:u,sub:n,aud:e,iat:o,exp:f},p=gm({header:c,payload:v}),w=vc.sign(i.secretKey,p);return vm({header:c,payload:v,signature:w})}const _m="PARSE_ERROR",bm="INVALID_REQUEST",mm="METHOD_NOT_FOUND",wm="INVALID_PARAMS",wf="INTERNAL_ERROR",yc="SERVER_ERROR",Em=[-32700,-32600,-32601,-32602,-32603],ls={[_m]:{code:-32700,message:"Parse error"},[bm]:{code:-32600,message:"Invalid Request"},[mm]:{code:-32601,message:"Method not found"},[wm]:{code:-32602,message:"Invalid params"},[wf]:{code:-32603,message:"Internal error"},[yc]:{code:-32e3,message:"Server error"}},Ef=yc;function Dm(n){return Em.includes(n)}function Df(n){return Object.keys(ls).includes(n)?ls[n]:ls[Ef]}function Sm(n){const e=Object.values(ls).find(t=>t.code===n);return e||ls[Ef]}function Sf(n,e,t){return n.message.includes("getaddrinfo ENOTFOUND")||n.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):n}var xf={};/*! *****************************************************************************
60
60
  Copyright (c) Microsoft Corporation.
61
61
 
62
62
  Permission to use, copy, modify, and/or distribute this software for any
@@ -69,31 +69,31 @@
69
69
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
70
70
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
71
71
  PERFORMANCE OF THIS SOFTWARE.
72
- ***************************************************************************** */var bc=function(r,e){return bc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var o in i)i.hasOwnProperty(o)&&(t[o]=i[o])},bc(r,e)};function Pm(r,e){bc(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var mc=function(){return mc=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},mc.apply(this,arguments)};function Cm(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(r);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(r,i[o])&&(t[i[o]]=r[i[o]]);return t}function Am(r,e,t,i){var o=arguments.length,a=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var f=r.length-1;f>=0;f--)(u=r[f])&&(a=(o<3?u(a):o>3?u(e,t,a):u(e,t))||a);return o>3&&a&&Object.defineProperty(e,t,a),a}function Tm(r,e){return function(t,i){e(t,i,r)}}function Rm(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function Nm(r,e,t,i){function o(a){return a instanceof t?a:new t(function(u){u(a)})}return new(t||(t=Promise))(function(a,u){function f(w){try{p(i.next(w))}catch(I){u(I)}}function v(w){try{p(i.throw(w))}catch(I){u(I)}}function p(w){w.done?a(w.value):o(w.value).then(f,v)}p((i=i.apply(r,e||[])).next())})}function $m(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,o,a,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(p){return function(w){return v([p,w])}}function v(p){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,o&&(a=p[0]&2?o.return:p[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,p[1])).done)return a;switch(o=0,a&&(p=[p[0]&2,a.value]),p[0]){case 0:case 1:a=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!a||p[1]>a[0]&&p[1]<a[3])){t.label=p[1];break}if(p[0]===6&&t.label<a[1]){t.label=a[1],a=p;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(p);break}a[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(r,t)}catch(w){p=[6,w],o=0}finally{i=a=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function Fm(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}function Lm(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function wc(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function If(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),o,a=[],u;try{for(;(e===void 0||e-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(f){u={error:f}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(u)throw u.error}}return a}function Um(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(If(arguments[e]));return r}function jm(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var i=Array(r),o=0,e=0;e<t;e++)for(var a=arguments[e],u=0,f=a.length;u<f;u++,o++)i[o]=a[u];return i}function ds(r){return this instanceof ds?(this.v=r,this):new ds(r)}function Mm(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(r,e||[]),o,a=[];return o={},u("next"),u("throw"),u("return"),o[Symbol.asyncIterator]=function(){return this},o;function u(S){i[S]&&(o[S]=function(C){return new Promise(function(R,B){a.push([S,C,R,B])>1||f(S,C)})})}function f(S,C){try{v(i[S](C))}catch(R){I(a[0][3],R)}}function v(S){S.value instanceof ds?Promise.resolve(S.value.v).then(p,w):I(a[0][2],S)}function p(S){f("next",S)}function w(S){f("throw",S)}function I(S,C){S(C),a.shift(),a.length&&f(a[0][0],a[0][1])}}function qm(r){var e,t;return e={},i("next"),i("throw",function(o){throw o}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(o,a){e[o]=r[o]?function(u){return(t=!t)?{value:ds(r[o](u)),done:o==="return"}:a?a(u):u}:a}}function Hm(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof wc=="function"?wc(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(a){t[a]=r[a]&&function(u){return new Promise(function(f,v){u=r[a](u),o(f,v,u.done,u.value)})}}function o(a,u,f,v){Promise.resolve(v).then(function(p){a({value:p,done:f})},u)}}function Bm(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function zm(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function Km(r){return r&&r.__esModule?r:{default:r}}function Vm(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function km(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var Gm=Object.freeze({__proto__:null,__extends:Pm,get __assign(){return mc},__rest:Cm,__decorate:Am,__param:Tm,__metadata:Rm,__awaiter:Nm,__generator:$m,__createBinding:Fm,__exportStar:Lm,__values:wc,__read:If,__spread:Um,__spreadArrays:jm,__await:ds,__asyncGenerator:Mm,__asyncDelegator:qm,__asyncValues:Hm,__makeTemplateObject:Bm,__importStar:zm,__importDefault:Km,__classPrivateFieldGet:Vm,__classPrivateFieldSet:km}),Wm=Bn(Gm),an={},Pf;function Ym(){if(Pf)return an;Pf=1,Object.defineProperty(an,"__esModule",{value:!0}),an.isBrowserCryptoAvailable=an.getSubtleCrypto=an.getBrowerCrypto=void 0;function r(){return Vt?.crypto||Vt?.msCrypto||{}}an.getBrowerCrypto=r;function e(){const i=r();return i.subtle||i.webkitSubtle}an.getSubtleCrypto=e;function t(){return!!r()&&!!e()}return an.isBrowserCryptoAvailable=t,an}var cn={},Cf;function Jm(){if(Cf)return cn;Cf=1,Object.defineProperty(cn,"__esModule",{value:!0}),cn.isBrowser=cn.isNode=cn.isReactNative=void 0;function r(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}cn.isReactNative=r;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}cn.isNode=e;function t(){return!r()&&!e()}return cn.isBrowser=t,cn}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Wm;e.__exportStar(Ym(),r),e.__exportStar(Jm(),r)})(Of);function Ec(r=3){const e=Date.now()*Math.pow(10,r),t=Math.floor(Math.random()*Math.pow(10,r));return e+t}function Af(r=6){return BigInt(Ec(r))}function Ei(r,e,t){return{id:t||Ec(),jsonrpc:"2.0",method:r,params:e}}function Dc(r,e){return{id:r,jsonrpc:"2.0",result:e}}function oo(r,e,t){return{id:r,jsonrpc:"2.0",error:Qm(e,t)}}function Qm(r,e){return typeof r>"u"?Sf(Ef):(typeof r=="string"&&(r=Object.assign(Object.assign({},Sf(_c)),{message:r})),typeof e<"u"&&(r.data=e),Om(r.code)&&(r=Im(r.code)),r)}class Xm{}class Zm extends Xm{constructor(){super()}}class ew extends Zm{constructor(e){super()}}const tw="^https?:",rw="^wss?:";function nw(r){const e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Tf(r,e){const t=nw(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function Rf(r){return Tf(r,tw)}function Nf(r){return Tf(r,rw)}function iw(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function $f(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function Sc(r){return $f(r)&&"method"in r}function ao(r){return $f(r)&&(un(r)||zr(r))}function un(r){return"result"in r}function zr(r){return"error"in r}class hn extends ew{constructor(e){super(e),this.events=new Yt.exports.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(Ei(e.method,e.params||[],e.id||Af().toString()),t)}async requestStrict(e,t){return new Promise(async(i,o)=>{if(!this.connection.connected)try{await this.open()}catch(a){o(a)}this.events.on(`${e.id}`,a=>{zr(a)?o(a.error):i(a.result)});try{await this.connection.send(e,t)}catch(a){o(a)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),ao(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new 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(),typeof e=="string"&&(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)}}const sw=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),ow=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",Ff=r=>r.split("?")[0],Lf=10,aw=sw();class cw{constructor(e){if(this.url=e,this.events=new Yt.exports.EventEmitter,this.registering=!1,!Nf(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}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)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e,t){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(ls(e))}catch(i){this.onError(e.id,i)}}register(e=this.url){if(!Nf(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,o)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),o(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return o(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{const o=Of.isReactNative()?void 0:{rejectUnauthorized:!iw(e)},a=new aw(e,[],o);ow()?a.onerror=u=>{const f=u;i(this.emitError(f.error))}:a.on("error",u=>{i(this.emitError(u))}),a.onopen=()=>{this.onOpen(a),t(a)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=t=>this.onClose(t),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;const t=typeof e.data=="string"?vc(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),o=i.message||i.toString(),a=oo(e,o);this.events.emit("payload",a)}parseError(e,t=this.url){return xf(e,Ff(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>Lf&&this.events.setMaxListeners(Lf)}emitError(e){const t=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${Ff(this.url)}`));return this.events.emit("register_error",t),t}}var xc={exports:{}};(function(r,e){var t=200,i="__lodash_hash_undefined__",o=1,a=2,u=9007199254740991,f="[object Arguments]",v="[object Array]",p="[object AsyncFunction]",w="[object Boolean]",I="[object Date]",S="[object Error]",C="[object Function]",R="[object GeneratorFunction]",B="[object Map]",K="[object Number]",se="[object Null]",$="[object Object]",U="[object Promise]",x="[object Proxy]",T="[object RegExp]",E="[object Set]",h="[object String]",b="[object Symbol]",G="[object Undefined]",Y="[object WeakMap]",ie="[object ArrayBuffer]",ce="[object DataView]",de="[object Float32Array]",m="[object Float64Array]",P="[object Int8Array]",ee="[object Int16Array]",Q="[object Int32Array]",V="[object Uint8Array]",k="[object Uint8ClampedArray]",J="[object Uint16Array]",re="[object Uint32Array]",me=/[\\^$.*+?()[\]{}|]/g,oe=/^\[object .+?Constructor\]$/,we=/^(?:0|[1-9]\d*)$/,le={};le[de]=le[m]=le[P]=le[ee]=le[Q]=le[V]=le[k]=le[J]=le[re]=!0,le[f]=le[v]=le[ie]=le[w]=le[ce]=le[I]=le[S]=le[C]=le[B]=le[K]=le[$]=le[T]=le[E]=le[h]=le[Y]=!1;var _e=typeof Vt=="object"&&Vt&&Vt.Object===Object&&Vt,H=typeof self=="object"&&self&&self.Object===Object&&self,q=_e||H||Function("return this")(),F=e&&!e.nodeType&&e,d=F&&!0&&r&&!r.nodeType&&r,A=d&&d.exports===F,ae=A&&_e.process,fe=function(){try{return ae&&ae.binding&&ae.binding("util")}catch{}}(),xe=fe&&fe.isTypedArray;function Be(D,L){for(var te=-1,pe=D==null?0:D.length,ct=0,Te=[];++te<pe;){var dt=D[te];L(dt,te,D)&&(Te[ct++]=dt)}return Te}function Ve(D,L){for(var te=-1,pe=L.length,ct=D.length;++te<pe;)D[ct+te]=L[te];return D}function Ue(D,L){for(var te=-1,pe=D==null?0:D.length;++te<pe;)if(L(D[te],te,D))return!0;return!1}function vt(D,L){for(var te=-1,pe=Array(D);++te<D;)pe[te]=L(te);return pe}function yt(D){return function(L){return D(L)}}function Me(D,L){return D.has(L)}function Oe(D,L){return D?.[L]}function $e(D){var L=-1,te=Array(D.size);return D.forEach(function(pe,ct){te[++L]=[ct,pe]}),te}function Fe(D,L){return function(te){return D(L(te))}}function qe(D){var L=-1,te=Array(D.size);return D.forEach(function(pe){te[++L]=pe}),te}var Pe=Array.prototype,Le=Function.prototype,Se=Object.prototype,Ce=q["__core-js_shared__"],ze=Le.toString,Ie=Se.hasOwnProperty,ke=function(){var D=/[^.]+$/.exec(Ce&&Ce.keys&&Ce.keys.IE_PROTO||"");return D?"Symbol(src)_1."+D:""}(),We=Se.toString,et=RegExp("^"+ze.call(Ie).replace(me,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),tt=A?q.Buffer:void 0,Qe=q.Symbol,cr=q.Uint8Array,yr=Se.propertyIsEnumerable,en=Pe.splice,ur=Qe?Qe.toStringTag:void 0,pn=Object.getOwnPropertySymbols,Tn=tt?tt.isBuffer:void 0,Xn=Fe(Object.keys,Object),Dt=xr(q,"DataView"),_t=xr(q,"Map"),St=xr(q,"Promise"),xt=xr(q,"Set"),wt=xr(q,"WeakMap"),bt=xr(Object,"create"),Lt=vn(Dt),Ut=vn(_t),Ot=vn(St),jt=vn(xt),It=vn(wt),Tt=Qe?Qe.prototype:void 0,Pt=Tt?Tt.valueOf:void 0;function ft(D){var L=-1,te=D==null?0:D.length;for(this.clear();++L<te;){var pe=D[L];this.set(pe[0],pe[1])}}function Mt(){this.__data__=bt?bt(null):{},this.size=0}function qt(D){var L=this.has(D)&&delete this.__data__[D];return this.size-=L?1:0,L}function Vc(D){var L=this.__data__;if(bt){var te=L[D];return te===i?void 0:te}return Ie.call(L,D)?L[D]:void 0}function kc(D){var L=this.__data__;return bt?L[D]!==void 0:Ie.call(L,D)}function Gc(D,L){var te=this.__data__;return this.size+=this.has(D)?0:1,te[D]=bt&&L===void 0?i:L,this}ft.prototype.clear=Mt,ft.prototype.delete=qt,ft.prototype.get=Vc,ft.prototype.has=kc,ft.prototype.set=Gc;function Rr(D){var L=-1,te=D==null?0:D.length;for(this.clear();++L<te;){var pe=D[L];this.set(pe[0],pe[1])}}function Wc(){this.__data__=[],this.size=0}function Yc(D){var L=this.__data__,te=Zn(L,D);if(te<0)return!1;var pe=L.length-1;return te==pe?L.pop():en.call(L,te,1),--this.size,!0}function Jc(D){var L=this.__data__,te=Zn(L,D);return te<0?void 0:L[te][1]}function Qc(D){return Zn(this.__data__,D)>-1}function Xc(D,L){var te=this.__data__,pe=Zn(te,D);return pe<0?(++this.size,te.push([D,L])):te[pe][1]=L,this}Rr.prototype.clear=Wc,Rr.prototype.delete=Yc,Rr.prototype.get=Jc,Rr.prototype.has=Qc,Rr.prototype.set=Xc;function gn(D){var L=-1,te=D==null?0:D.length;for(this.clear();++L<te;){var pe=D[L];this.set(pe[0],pe[1])}}function Si(){this.size=0,this.__data__={hash:new ft,map:new(_t||Rr),string:new ft}}function Zc(D){var L=Rn(this,D).delete(D);return this.size-=L?1:0,L}function xi(D){return Rn(this,D).get(D)}function eu(D){return Rn(this,D).has(D)}function tu(D,L){var te=Rn(this,D),pe=te.size;return te.set(D,L),this.size+=te.size==pe?0:1,this}gn.prototype.clear=Si,gn.prototype.delete=Zc,gn.prototype.get=xi,gn.prototype.has=eu,gn.prototype.set=tu;function Oi(D){var L=-1,te=D==null?0:D.length;for(this.__data__=new gn;++L<te;)this.add(D[L])}function _o(D){return this.__data__.set(D,i),this}function bo(D){return this.__data__.has(D)}Oi.prototype.add=Oi.prototype.push=_o,Oi.prototype.has=bo;function Vr(D){var L=this.__data__=new Rr(D);this.size=L.size}function ru(){this.__data__=new Rr,this.size=0}function nu(D){var L=this.__data__,te=L.delete(D);return this.size=L.size,te}function iu(D){return this.__data__.get(D)}function su(D){return this.__data__.has(D)}function mo(D,L){var te=this.__data__;if(te instanceof Rr){var pe=te.__data__;if(!_t||pe.length<t-1)return pe.push([D,L]),this.size=++te.size,this;te=this.__data__=new gn(pe)}return te.set(D,L),this.size=te.size,this}Vr.prototype.clear=ru,Vr.prototype.delete=nu,Vr.prototype.get=iu,Vr.prototype.has=su,Vr.prototype.set=mo;function wo(D,L){var te=Ci(D),pe=!te&&No(D),ct=!te&&!pe&&Ss(D),Te=!te&&!pe&&!ct&&Lo(D),dt=te||pe||ct||Te,Ht=dt?vt(D.length,String):[],Xe=Ht.length;for(var ut in D)(L||Ie.call(D,ut))&&!(dt&&(ut=="length"||ct&&(ut=="offset"||ut=="parent")||Te&&(ut=="buffer"||ut=="byteLength"||ut=="byteOffset")||Po(ut,Xe)))&&Ht.push(ut);return Ht}function Zn(D,L){for(var te=D.length;te--;)if(Ro(D[te][0],L))return te;return-1}function Es(D,L,te){var pe=L(D);return Ci(D)?pe:Ve(pe,te(D))}function ei(D){return D==null?D===void 0?G:se:ur&&ur in Object(D)?Oo(D):cu(D)}function Ds(D){return ri(D)&&ei(D)==f}function ti(D,L,te,pe,ct){return D===L?!0:D==null||L==null||!ri(D)&&!ri(L)?D!==D&&L!==L:Eo(D,L,te,pe,ti,ct)}function Eo(D,L,te,pe,ct,Te){var dt=Ci(D),Ht=Ci(L),Xe=dt?v:tn(D),ut=Ht?v:tn(L);Xe=Xe==f?$:Xe,ut=ut==f?$:ut;var Rt=Xe==$,_r=ut==$,Bt=Xe==ut;if(Bt&&Ss(D)){if(!Ss(L))return!1;dt=!0,Rt=!1}if(Bt&&!Rt)return Te||(Te=new Vr),dt||Lo(D)?Ii(D,L,te,pe,ct,Te):au(D,L,Xe,te,pe,ct,Te);if(!(te&o)){var pt=Rt&&Ie.call(D,"__wrapped__"),hr=_r&&Ie.call(L,"__wrapped__");if(pt||hr){var kr=pt?D.value():D,Nr=hr?L.value():L;return Te||(Te=new Vr),ct(kr,Nr,te,pe,Te)}}return Bt?(Te||(Te=new Vr),xo(D,L,te,pe,ct,Te)):!1}function ou(D){if(!Fo(D)||Ao(D))return!1;var L=Ai(D)?et:oe;return L.test(vn(D))}function Do(D){return ri(D)&&$o(D.length)&&!!le[ei(D)]}function So(D){if(!To(D))return Xn(D);var L=[];for(var te in Object(D))Ie.call(D,te)&&te!="constructor"&&L.push(te);return L}function Ii(D,L,te,pe,ct,Te){var dt=te&o,Ht=D.length,Xe=L.length;if(Ht!=Xe&&!(dt&&Xe>Ht))return!1;var ut=Te.get(D);if(ut&&Te.get(L))return ut==L;var Rt=-1,_r=!0,Bt=te&a?new Oi:void 0;for(Te.set(D,L),Te.set(L,D);++Rt<Ht;){var pt=D[Rt],hr=L[Rt];if(pe)var kr=dt?pe(hr,pt,Rt,L,D,Te):pe(pt,hr,Rt,D,L,Te);if(kr!==void 0){if(kr)continue;_r=!1;break}if(Bt){if(!Ue(L,function(Nr,rn){if(!Me(Bt,rn)&&(pt===Nr||ct(pt,Nr,te,pe,Te)))return Bt.push(rn)})){_r=!1;break}}else if(!(pt===hr||ct(pt,hr,te,pe,Te))){_r=!1;break}}return Te.delete(D),Te.delete(L),_r}function au(D,L,te,pe,ct,Te,dt){switch(te){case ce:if(D.byteLength!=L.byteLength||D.byteOffset!=L.byteOffset)return!1;D=D.buffer,L=L.buffer;case ie:return!(D.byteLength!=L.byteLength||!Te(new cr(D),new cr(L)));case w:case I:case K:return Ro(+D,+L);case S:return D.name==L.name&&D.message==L.message;case T:case h:return D==L+"";case B:var Ht=$e;case E:var Xe=pe&o;if(Ht||(Ht=qe),D.size!=L.size&&!Xe)return!1;var ut=dt.get(D);if(ut)return ut==L;pe|=a,dt.set(D,L);var Rt=Ii(Ht(D),Ht(L),pe,ct,Te,dt);return dt.delete(D),Rt;case b:if(Pt)return Pt.call(D)==Pt.call(L)}return!1}function xo(D,L,te,pe,ct,Te){var dt=te&o,Ht=Pi(D),Xe=Ht.length,ut=Pi(L),Rt=ut.length;if(Xe!=Rt&&!dt)return!1;for(var _r=Xe;_r--;){var Bt=Ht[_r];if(!(dt?Bt in L:Ie.call(L,Bt)))return!1}var pt=Te.get(D);if(pt&&Te.get(L))return pt==L;var hr=!0;Te.set(D,L),Te.set(L,D);for(var kr=dt;++_r<Xe;){Bt=Ht[_r];var Nr=D[Bt],rn=L[Bt];if(pe)var xs=dt?pe(rn,Nr,Bt,L,D,Te):pe(Nr,rn,Bt,D,L,Te);if(!(xs===void 0?Nr===rn||ct(Nr,rn,te,pe,Te):xs)){hr=!1;break}kr||(kr=Bt=="constructor")}if(hr&&!kr){var ni=D.constructor,Gt=L.constructor;ni!=Gt&&"constructor"in D&&"constructor"in L&&!(typeof ni=="function"&&ni instanceof ni&&typeof Gt=="function"&&Gt instanceof Gt)&&(hr=!1)}return Te.delete(D),Te.delete(L),hr}function Pi(D){return Es(D,lu,Io)}function Rn(D,L){var te=D.__data__;return Co(L)?te[typeof L=="string"?"string":"hash"]:te.map}function xr(D,L){var te=Oe(D,L);return ou(te)?te:void 0}function Oo(D){var L=Ie.call(D,ur),te=D[ur];try{D[ur]=void 0;var pe=!0}catch{}var ct=We.call(D);return pe&&(L?D[ur]=te:delete D[ur]),ct}var Io=pn?function(D){return D==null?[]:(D=Object(D),Be(pn(D),function(L){return yr.call(D,L)}))}:at,tn=ei;(Dt&&tn(new Dt(new ArrayBuffer(1)))!=ce||_t&&tn(new _t)!=B||St&&tn(St.resolve())!=U||xt&&tn(new xt)!=E||wt&&tn(new wt)!=Y)&&(tn=function(D){var L=ei(D),te=L==$?D.constructor:void 0,pe=te?vn(te):"";if(pe)switch(pe){case Lt:return ce;case Ut:return B;case Ot:return U;case jt:return E;case It:return Y}return L});function Po(D,L){return L=L??u,!!L&&(typeof D=="number"||we.test(D))&&D>-1&&D%1==0&&D<L}function Co(D){var L=typeof D;return L=="string"||L=="number"||L=="symbol"||L=="boolean"?D!=="__proto__":D===null}function Ao(D){return!!ke&&ke in D}function To(D){var L=D&&D.constructor,te=typeof L=="function"&&L.prototype||Se;return D===te}function cu(D){return We.call(D)}function vn(D){if(D!=null){try{return ze.call(D)}catch{}try{return D+""}catch{}}return""}function Ro(D,L){return D===L||D!==D&&L!==L}var No=Ds(function(){return arguments}())?Ds:function(D){return ri(D)&&Ie.call(D,"callee")&&!yr.call(D,"callee")},Ci=Array.isArray;function uu(D){return D!=null&&$o(D.length)&&!Ai(D)}var Ss=Tn||ot;function hu(D,L){return ti(D,L)}function Ai(D){if(!Fo(D))return!1;var L=ei(D);return L==C||L==R||L==p||L==x}function $o(D){return typeof D=="number"&&D>-1&&D%1==0&&D<=u}function Fo(D){var L=typeof D;return D!=null&&(L=="object"||L=="function")}function ri(D){return D!=null&&typeof D=="object"}var Lo=xe?yt(xe):Do;function lu(D){return uu(D)?wo(D):So(D)}function at(){return[]}function ot(){return!1}r.exports=hu})(xc,xc.exports);var uw=xc.exports,hw=Object.defineProperty,Uf=Object.getOwnPropertySymbols,lw=Object.prototype.hasOwnProperty,fw=Object.prototype.propertyIsEnumerable,jf=(r,e,t)=>e in r?hw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ar=(r,e)=>{for(var t in e||(e={}))lw.call(e,t)&&jf(r,t,e[t]);if(Uf)for(var t of Uf(e))fw.call(e,t)&&jf(r,t,e[t]);return r};function dw(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var o=0;o<r.length;o++){var a=r.charAt(o),u=a.charCodeAt(0);if(t[u]!==255)throw new TypeError(a+" is ambiguous");t[u]=o}var f=r.length,v=r.charAt(0),p=Math.log(f)/Math.log(256),w=Math.log(256)/Math.log(f);function I(R){if(R instanceof Uint8Array||(ArrayBuffer.isView(R)?R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength):Array.isArray(R)&&(R=Uint8Array.from(R))),!(R instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(R.length===0)return"";for(var B=0,K=0,se=0,$=R.length;se!==$&&R[se]===0;)se++,B++;for(var U=($-se)*w+1>>>0,x=new Uint8Array(U);se!==$;){for(var T=R[se],E=0,h=U-1;(T!==0||E<K)&&h!==-1;h--,E++)T+=256*x[h]>>>0,x[h]=T%f>>>0,T=T/f>>>0;if(T!==0)throw new Error("Non-zero carry");K=E,se++}for(var b=U-K;b!==U&&x[b]===0;)b++;for(var G=v.repeat(B);b<U;++b)G+=r.charAt(x[b]);return G}function S(R){if(typeof R!="string")throw new TypeError("Expected String");if(R.length===0)return new Uint8Array;var B=0;if(R[B]!==" "){for(var K=0,se=0;R[B]===v;)K++,B++;for(var $=(R.length-B)*p+1>>>0,U=new Uint8Array($);R[B];){var x=t[R.charCodeAt(B)];if(x===255)return;for(var T=0,E=$-1;(x!==0||T<se)&&E!==-1;E--,T++)x+=f*U[E]>>>0,U[E]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");se=T,B++}if(R[B]!==" "){for(var h=$-se;h!==$&&U[h]===0;)h++;for(var b=new Uint8Array(K+($-h)),G=K;h!==$;)b[G++]=U[h++];return b}}}function C(R){var B=S(R);if(B)return B;throw new Error(`Non-${e} character`)}return{encode:I,decodeUnsafe:S,decode:C}}var pw=dw,gw=pw;const Mf=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},vw=r=>new TextEncoder().encode(r),yw=r=>new TextDecoder().decode(r);class _w{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class bw{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return qf(this,e)}}class mw{constructor(e){this.decoders=e}or(e){return qf(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const qf=(r,e)=>new mw(ar(ar({},r.decoders||{[r.prefix]:r}),e.decoders||{[e.prefix]:e}));class ww{constructor(e,t,i,o){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=o,this.encoder=new _w(e,t,i),this.decoder=new bw(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const co=({name:r,prefix:e,encode:t,decode:i})=>new ww(r,e,t,i),ps=({prefix:r,name:e,alphabet:t})=>{const{encode:i,decode:o}=gw(t,e);return co({prefix:r,name:e,encode:i,decode:a=>Mf(o(a))})},Ew=(r,e,t,i)=>{const o={};for(let w=0;w<e.length;++w)o[e[w]]=w;let a=r.length;for(;r[a-1]==="=";)--a;const u=new Uint8Array(a*t/8|0);let f=0,v=0,p=0;for(let w=0;w<a;++w){const I=o[r[w]];if(I===void 0)throw new SyntaxError(`Non-${i} character`);v=v<<t|I,f+=t,f>=8&&(f-=8,u[p++]=255&v>>f)}if(f>=t||255&v<<8-f)throw new SyntaxError("Unexpected end of data");return u},Dw=(r,e,t)=>{const i=e[e.length-1]==="=",o=(1<<t)-1;let a="",u=0,f=0;for(let v=0;v<r.length;++v)for(f=f<<8|r[v],u+=8;u>t;)u-=t,a+=e[o&f>>u];if(u&&(a+=e[o&f<<t-u]),i)for(;a.length*t&7;)a+="=";return a},Qt=({name:r,prefix:e,bitsPerChar:t,alphabet:i})=>co({prefix:e,name:r,encode(o){return Dw(o,i,t)},decode(o){return Ew(o,i,t,r)}}),Sw=co({prefix:"\0",name:"identity",encode:r=>yw(r),decode:r=>vw(r)});var xw=Object.freeze({__proto__:null,identity:Sw});const Ow=Qt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Iw=Object.freeze({__proto__:null,base2:Ow});const Pw=Qt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Cw=Object.freeze({__proto__:null,base8:Pw});const Aw=ps({prefix:"9",name:"base10",alphabet:"0123456789"});var Tw=Object.freeze({__proto__:null,base10:Aw});const Rw=Qt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Nw=Qt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var $w=Object.freeze({__proto__:null,base16:Rw,base16upper:Nw});const Fw=Qt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Lw=Qt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Uw=Qt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),jw=Qt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Mw=Qt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),qw=Qt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Hw=Qt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Bw=Qt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),zw=Qt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Kw=Object.freeze({__proto__:null,base32:Fw,base32upper:Lw,base32pad:Uw,base32padupper:jw,base32hex:Mw,base32hexupper:qw,base32hexpad:Hw,base32hexpadupper:Bw,base32z:zw});const Vw=ps({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),kw=ps({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Gw=Object.freeze({__proto__:null,base36:Vw,base36upper:kw});const Ww=ps({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Yw=ps({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Jw=Object.freeze({__proto__:null,base58btc:Ww,base58flickr:Yw});const Qw=Qt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Xw=Qt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Zw=Qt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),eE=Qt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var tE=Object.freeze({__proto__:null,base64:Qw,base64pad:Xw,base64url:Zw,base64urlpad:eE});const Hf=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),rE=Hf.reduce((r,e,t)=>(r[t]=e,r),[]),nE=Hf.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function iE(r){return r.reduce((e,t)=>(e+=rE[t],e),"")}function sE(r){const e=[];for(const t of r){const i=nE[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const oE=co({prefix:"\u{1F680}",name:"base256emoji",encode:iE,decode:sE});var aE=Object.freeze({__proto__:null,base256emoji:oE}),cE=zf,Bf=128,uE=127,hE=~uE,lE=Math.pow(2,31);function zf(r,e,t){e=e||[],t=t||0;for(var i=t;r>=lE;)e[t++]=r&255|Bf,r/=128;for(;r&hE;)e[t++]=r&255|Bf,r>>>=7;return e[t]=r|0,zf.bytes=t-i+1,e}var fE=Oc,dE=128,Kf=127;function Oc(r,i){var t=0,i=i||0,o=0,a=i,u,f=r.length;do{if(a>=f)throw Oc.bytes=0,new RangeError("Could not decode varint");u=r[a++],t+=o<28?(u&Kf)<<o:(u&Kf)*Math.pow(2,o),o+=7}while(u>=dE);return Oc.bytes=a-i,t}var pE=Math.pow(2,7),gE=Math.pow(2,14),vE=Math.pow(2,21),yE=Math.pow(2,28),_E=Math.pow(2,35),bE=Math.pow(2,42),mE=Math.pow(2,49),wE=Math.pow(2,56),EE=Math.pow(2,63),DE=function(r){return r<pE?1:r<gE?2:r<vE?3:r<yE?4:r<_E?5:r<bE?6:r<mE?7:r<wE?8:r<EE?9:10},SE={encode:cE,decode:fE,encodingLength:DE},Vf=SE;const kf=(r,e,t=0)=>(Vf.encode(r,e,t),e),Gf=r=>Vf.encodingLength(r),Ic=(r,e)=>{const t=e.byteLength,i=Gf(r),o=i+Gf(t),a=new Uint8Array(o+t);return kf(r,a,0),kf(t,a,i),a.set(e,o),new xE(r,t,e,a)};class xE{constructor(e,t,i,o){this.code=e,this.size=t,this.digest=i,this.bytes=o}}const Wf=({name:r,code:e,encode:t})=>new OE(r,e,t);class OE{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Ic(this.code,t):t.then(i=>Ic(this.code,i))}else throw Error("Unknown type, must be binary type")}}const Yf=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),IE=Wf({name:"sha2-256",code:18,encode:Yf("SHA-256")}),PE=Wf({name:"sha2-512",code:19,encode:Yf("SHA-512")});var CE=Object.freeze({__proto__:null,sha256:IE,sha512:PE});const Jf=0,AE="identity",Qf=Mf;var TE=Object.freeze({__proto__:null,identity:{code:Jf,name:AE,encode:Qf,digest:r=>Ic(Jf,Qf(r))}});new TextEncoder,new TextDecoder;const Xf=ar(ar(ar(ar(ar(ar(ar(ar(ar(ar({},xw),Iw),Cw),Tw),$w),Kw),Gw),Jw),tE),aE);ar(ar({},CE),TE);function Zf(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function RE(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Zf(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function ed(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}const td=ed("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Pc=ed("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=RE(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),NE=ar({utf8:td,"utf-8":td,hex:Xf.base16,latin1:Pc,ascii:Pc,binary:Pc},Xf);function $E(r,e="utf8"){const t=NE[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Zf(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}const rd="wc",FE=2,Cc="core",Pn=`${rd}@2:${Cc}:`,LE={name:Cc,logger:"error"},UE={database:":memory:"},jE="crypto",nd="client_ed25519_seed",ME=ye.ONE_DAY,qE="keychain",HE="0.3",BE="messages",zE="0.3",KE=ye.SIX_HOURS,VE="publisher",id="irn",kE="error",sd="wss://relay.walletconnect.com",od="wss://relay.walletconnect.org",GE="relayer",er={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},WE="_subscription",ln={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},YE=ye.ONE_SECOND,JE="2.10.3",QE=1e4,XE="0.3",ZE="WALLETCONNECT_CLIENT_ID",Kr={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},e3="subscription",t3="0.3",r3=ye.FIVE_SECONDS*1e3,n3="pairing",i3="0.3",gs={wc_pairingDelete:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:0},res:{ttl:ye.ONE_DAY,prompt:!1,tag:0}}},vs={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Zr={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},s3="history",o3="0.3",a3="expirer",Tr={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},c3="0.3",Ac="verify-api",Di="https://verify.walletconnect.com",Tc="https://verify.walletconnect.org",u3=[Di,Tc];class h3{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=qE,this.version=HE,this.initialized=!1,this.storagePrefix=Pn,this.init=async()=>{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,o)=>{this.isInitialized(),this.keychain.set(i,o),await this.persist()},this.get=i=>{this.isInitialized();const o=this.keychain.get(i);if(typeof o>"u"){const{message:a}=he("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(a)}return o},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=Je.generateChildLogger(t,this.name)}get context(){return Je.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,$l(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Fl(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}}class l3{constructor(e,t,i){this.core=e,this.logger=t,this.name=jE,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=o=>(this.isInitialized(),this.keychain.has(o)),this.getClientId=async()=>{this.isInitialized();const o=await this.getClientSeed(),a=wf(o);return mf(a.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const o=l_();return this.setPrivateKey(o.publicKey,o.privateKey)},this.signJWT=async o=>{this.isInitialized();const a=await this.getClientSeed(),u=wf(a),f=Ya();return await mm(f,o,ME,u)},this.generateSharedKey=(o,a,u)=>{this.isInitialized();const f=this.getPrivateKey(o),v=f_(f,a);return this.setSymKey(v,u)},this.setSymKey=async(o,a)=>{this.isInitialized();const u=a||d_(o);return await this.keychain.set(u,o),u},this.deleteKeyPair=async o=>{this.isInitialized(),await this.keychain.del(o)},this.deleteSymKey=async o=>{this.isInitialized(),await this.keychain.del(o)},this.encode=async(o,a,u)=>{this.isInitialized();const f=Cl(u),v=ls(a);if(Al(f)){const S=f.senderPublicKey,C=f.receiverPublicKey;o=await this.generateSharedKey(S,C)}const p=this.getSymKey(o),{type:w,senderPublicKey:I}=f;return g_({type:w,symKey:p,message:v,senderPublicKey:I})},this.decode=async(o,a,u)=>{this.isInitialized();const f=__(a,u);if(Al(f)){const v=f.receiverPublicKey,p=f.senderPublicKey;o=await this.generateSharedKey(v,p)}try{const v=this.getSymKey(o),p=v_({symKey:v,encoded:a});return vc(p)}catch(v){this.logger.error(`Failed to decode message from topic: '${o}', clientId: '${await this.getClientId()}'`),this.logger.error(v)}},this.getPayloadType=o=>{const a=Xs(o);return Ji(a.type)},this.getPayloadSenderPublicKey=o=>{const a=Xs(o);return a.senderPublicKey?nr(a.senderPublicKey,ir):void 0},this.core=e,this.logger=Je.generateChildLogger(t,this.name),this.keychain=i||new h3(this.core,this.logger)}get context(){return Je.getLoggerContext(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(nd)}catch{e=Ya(),await this.keychain.set(nd,e)}return $E(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}}class f3 extends Jb{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=BE,this.version=zE,this.initialized=!1,this.storagePrefix=Pn,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,o)=>{this.isInitialized();const a=vi(o);let u=this.messages.get(i);return typeof u>"u"&&(u={}),typeof u[a]<"u"||(u[a]=o,this.messages.set(i,u),await this.persist()),a},this.get=i=>{this.isInitialized();let o=this.messages.get(i);return typeof o>"u"&&(o={}),o},this.has=(i,o)=>{this.isInitialized();const a=this.get(i),u=vi(o);return typeof a[u]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=Je.generateChildLogger(e,this.name),this.core=t}get context(){return Je.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,$l(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Fl(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}}class d3 extends Qb{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new Yt.exports.EventEmitter,this.name=VE,this.queue=new Map,this.publishTimeout=ye.toMiliseconds(ye.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(i,o,a)=>{var u;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:o,opts:a}});try{const f=a?.ttl||KE,v=Xa(a),p=a?.prompt||!1,w=a?.tag||0,I=a?.id||Af().toString(),S={topic:i,message:o,opts:{ttl:f,relay:v,prompt:p,tag:w,id:I}},C=setTimeout(()=>this.queue.set(I,S),this.publishTimeout);try{await await es(this.rpcPublish(i,o,f,v,p,w,I),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(I),this.relayer.events.emit(er.publish,S)}catch(R){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(u=a?.internal)!=null&&u.throwOnFailedPublish)throw this.removeRequestFromQueue(I),R;return}finally{clearTimeout(C)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:o,opts:a}})}catch(f){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(f),f}},this.on=(i,o)=>{this.events.on(i,o)},this.once=(i,o)=>{this.events.once(i,o)},this.off=(i,o)=>{this.events.off(i,o)},this.removeListener=(i,o)=>{this.events.removeListener(i,o)},this.relayer=e,this.logger=Je.generateChildLogger(t,this.name),this.registerEventListeners()}get context(){return Je.getLoggerContext(this.logger)}rpcPublish(e,t,i,o,a,u,f){var v,p,w,I;const S={method:Zs(o.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:a,tag:u},id:f};return sr((v=S.params)==null?void 0:v.prompt)&&((p=S.params)==null||delete p.prompt),sr((w=S.params)==null?void 0:w.tag)&&((I=S.params)==null||delete I.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:S}),this.relayer.request(S)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:t,message:i,opts:o}=e;await this.publish(t,i,o)})}registerEventListeners(){this.relayer.core.heartbeat.on(wi.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(er.connection_stalled);return}this.checkQueue()}),this.relayer.on(er.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class p3{constructor(){this.map=new Map,this.set=(e,t)=>{const i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,t))return;const o=i.filter(a=>a!==t);if(!o.length){this.map.delete(e);return}this.map.set(e,o)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var g3=Object.defineProperty,v3=Object.defineProperties,y3=Object.getOwnPropertyDescriptors,ad=Object.getOwnPropertySymbols,_3=Object.prototype.hasOwnProperty,b3=Object.prototype.propertyIsEnumerable,cd=(r,e,t)=>e in r?g3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ys=(r,e)=>{for(var t in e||(e={}))_3.call(e,t)&&cd(r,t,e[t]);if(ad)for(var t of ad(e))b3.call(e,t)&&cd(r,t,e[t]);return r},Rc=(r,e)=>v3(r,y3(e));class m3 extends em{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new p3,this.events=new Yt.exports.EventEmitter,this.name=e3,this.version=t3,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Pn,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(i,o)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:o}});try{const a=Xa(o),u={topic:i,relay:a};this.pending.set(i,u);const f=await this.rpcSubscribe(i,a);return this.onSubscribe(f,u),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:o}}),f}catch(a){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(a),a}},this.unsubscribe=async(i,o)=>{await this.restartToComplete(),this.isInitialized(),typeof o?.id<"u"?await this.unsubscribeById(i,o.id,o):await this.unsubscribeByTopic(i,o)},this.isSubscribed=async i=>this.topics.includes(i)?!0:await new Promise((o,a)=>{const u=new ye.Watch;u.start(this.pendingSubscriptionWatchLabel);const f=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(f),u.stop(this.pendingSubscriptionWatchLabel),o(!0)),u.elapsed(this.pendingSubscriptionWatchLabel)>=r3&&(clearInterval(f),u.stop(this.pendingSubscriptionWatchLabel),a(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1),this.on=(i,o)=>{this.events.on(i,o)},this.once=(i,o)=>{this.events.once(i,o)},this.off=(i,o)=>{this.events.off(i,o)},this.removeListener=(i,o)=>{this.events.removeListener(i,o)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Je.generateChildLogger(t,this.name),this.clientId=""}get context(){return Je.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const i=this.topicMap.get(e);await Promise.all(i.map(async o=>await this.unsubscribeById(e,o,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{const o=Xa(i);await this.rpcUnsubscribe(e,t,o);const a=At("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,a),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(o){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(o),o}}async rpcSubscribe(e,t){const i={method:Zs(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{await await es(this.relayer.request(i),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(er.connection_stalled)}return vi(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,i={method:Zs(t.protocol).batchSubscribe,params:{topics:e.map(o=>o.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{return await await es(this.relayer.request(i),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(er.connection_stalled)}}rpcUnsubscribe(e,t,i){const o={method:Zs(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:o}),this.relayer.request(o)}onSubscribe(e,t){this.setSubscription(e,Rc(ys({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,ys({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.subscriptions.has(e)||(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,ys({},t)),this.topicMap.set(t.topic,e),this.events.emit(Kr.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:i}=he("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(Kr.deleted,Rc(ys({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Kr.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const i=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(i)}}this.events.emit(Kr.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=he("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);Xr(t)&&this.onBatchSubscribe(t.map((i,o)=>Rc(ys({},e[o]),{id:i})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;const e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(wi.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(er.connect,async()=>{await this.onConnect()}),this.relayer.on(er.disconnect,()=>{this.onDisconnect()}),this.events.on(Kr.created,async e=>{const t=Kr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(Kr.deleted,async e=>{const t=Kr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}}var w3=Object.defineProperty,ud=Object.getOwnPropertySymbols,E3=Object.prototype.hasOwnProperty,D3=Object.prototype.propertyIsEnumerable,hd=(r,e,t)=>e in r?w3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,S3=(r,e)=>{for(var t in e||(e={}))E3.call(e,t)&&hd(r,t,e[t]);if(ud)for(var t of ud(e))D3.call(e,t)&&hd(r,t,e[t]);return r};class x3 extends Xb{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Yt.exports.EventEmitter,this.name=GE,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async t=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(t)}catch(i){throw this.logger.debug("Failed to Publish Request"),this.logger.error(i),i}},this.onPayloadHandler=t=>{this.onProviderPayload(t)},this.onConnectHandler=()=>{this.events.emit(er.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(er.error,t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(ln.payload,this.onPayloadHandler),this.provider.on(ln.connect,this.onConnectHandler),this.provider.on(ln.disconnect,this.onDisconnectHandler),this.provider.on(ln.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Je.generateChildLogger(e.logger,this.name):Je.pino(Je.getDefaultLoggerOptions({level:e.logger||kE})),this.messages=new f3(this.logger,e.core),this.subscriber=new m3(this,this.logger),this.publisher=new d3(this,this.logger),this.relayUrl=e?.relayUrl||sd,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${od}...`),await this.restartTransport(od)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},QE)}get context(){return Je.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now()})}async subscribe(e,t){var i;this.isInitialized();let o=((i=this.subscriber.topicMap.get(e))==null?void 0:i[0])||"";if(o)return o;let a;const u=f=>{f.topic===e&&(this.subscriber.off(Kr.created,u),a())};return await Promise.all([new Promise(f=>{a=f,this.subscriber.on(Kr.created,u)}),new Promise(async f=>{o=await this.subscriber.subscribe(e,t),f()})]),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 transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await es(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(t=>{if(!this.initialized)return t();this.subscriber.once(Kr.resubscribed,()=>{t()})}),new Promise(async(t,i)=>{try{await es(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(o){i(o);return}t()})])}catch(t){this.logger.error(t);const i=t;if(!this.isConnectionStalled(i.message))throw t;this.provider.events.emit(ln.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await kl())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new hn(new cw(C_({sdkVersion:JE,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){const{topic:t,message:i}=e;if(!i||i.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const o=this.messages.has(t,i);return o&&this.logger.debug(`Ignoring duplicate message: ${i}`),o}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Sc(e)){if(!e.method.endsWith(WE))return;const t=e.params,{topic:i,message:o,publishedAt:a}=t.data,u={topic:i,message:o,publishedAt:a};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(S3({type:"event",event:t.id},u)),this.events.emit(t.id,u),await this.acknowledgePayload(e),await this.onMessageEvent(u)}else ao(e)&&this.events.emit(er.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(er.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=Dc(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(ln.payload,this.onPayloadHandler),this.provider.off(ln.connect,this.onConnectHandler),this.provider.off(ln.disconnect,this.onDisconnectHandler),this.provider.off(ln.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(er.connection_stalled,()=>{this.restartTransport().catch(t=>this.logger.error(t))});let e=await kl();w1(async t=>{this.initialized&&e!==t&&(e=t,t?await this.restartTransport().catch(i=>this.logger.error(i)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(i=>this.logger.error(i))))})}onProviderDisconnect(){this.events.emit(er.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},ye.toMiliseconds(YE)))}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(e=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}}var O3=Object.defineProperty,ld=Object.getOwnPropertySymbols,I3=Object.prototype.hasOwnProperty,P3=Object.prototype.propertyIsEnumerable,fd=(r,e,t)=>e in r?O3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,dd=(r,e)=>{for(var t in e||(e={}))I3.call(e,t)&&fd(r,t,e[t]);if(ld)for(var t of ld(e))P3.call(e,t)&&fd(r,t,e[t]);return r};class uo extends Zb{constructor(e,t,i,o=Pn,a=void 0){super(e,t,i,o),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=XE,this.cached=[],this.initialized=!1,this.storagePrefix=Pn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(u=>{this.getKey&&u!==null&&!sr(u)?this.map.set(this.getKey(u),u):X_(u)?this.map.set(u.id,u):Z_(u)&&this.map.set(u.topic,u)}),this.cached=[],this.initialized=!0)},this.set=async(u,f)=>{this.isInitialized(),this.map.has(u)?await this.update(u,f):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:u,value:f}),this.map.set(u,f),await this.persist())},this.get=u=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:u}),this.getData(u)),this.getAll=u=>(this.isInitialized(),u?this.values.filter(f=>Object.keys(u).every(v=>uw(f[v],u[v]))):this.values),this.update=async(u,f)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:u,update:f});const v=dd(dd({},this.getData(u)),f);this.map.set(u,v),await this.persist()},this.delete=async(u,f)=>{this.isInitialized(),this.map.has(u)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:u,reason:f}),this.map.delete(u),await this.persist())},this.logger=Je.generateChildLogger(t,this.name),this.storagePrefix=o,this.getKey=a}get context(){return Je.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){const{message:i}=he("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:t}=he("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}}class C3{constructor(e,t){this.core=e,this.logger=t,this.name=n3,this.version=i3,this.events=new Yt.exports,this.initialized=!1,this.storagePrefix=Pn,this.ignoredPayloadTypes=[kn],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async()=>{this.isInitialized();const i=Ya(),o=await this.core.crypto.setSymKey(i),a=Br(ye.FIVE_MINUTES),u={protocol:id},f={topic:o,expiry:a,relay:u,active:!1},v=B_({protocol:this.core.protocol,version:this.core.version,topic:o,symKey:i,relay:u});return await this.pairings.set(o,f),await this.core.relayer.subscribe(o),this.core.expirer.set(o,a),{topic:o,uri:v}},this.pair=async i=>{this.isInitialized(),this.isValidPair(i);const{topic:o,symKey:a,relay:u}=M_(i.uri);let f;if(this.pairings.keys.includes(o)&&(f=this.pairings.get(o),f.active))throw new Error(`Pairing already exists: ${o}. Please try again with a new connection URI.`);this.core.crypto.keychain.has(o)||(await this.core.crypto.setSymKey(a,o),await this.core.relayer.subscribe(o,{relay:u}));const v=Br(ye.FIVE_MINUTES),p={topic:o,relay:u,expiry:v,active:!1};return await this.pairings.set(o,p),this.core.expirer.set(o,v),i.activatePairing&&await this.activate({topic:o}),this.events.emit(vs.create,p),p},this.activate=async({topic:i})=>{this.isInitialized();const o=Br(ye.THIRTY_DAYS);await this.pairings.update(i,{active:!0,expiry:o}),this.core.expirer.set(i,o)},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:o}=i;if(this.pairings.keys.includes(o)){const a=await this.sendRequest(o,"wc_pairingPing",{}),{done:u,resolve:f,reject:v}=yi();this.events.once(Ft("pairing_ping",a),({error:p})=>{p?v(p):f()}),await u()}},this.updateExpiry=async({topic:i,expiry:o})=>{this.isInitialized(),await this.pairings.update(i,{expiry:o})},this.updateMetadata=async({topic:i,metadata:o})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:o})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:o}=i;this.pairings.keys.includes(o)&&(await this.sendRequest(o,"wc_pairingDelete",At("USER_DISCONNECTED")),await this.deletePairing(o))},this.sendRequest=async(i,o,a)=>{const u=Ei(o,a),f=await this.core.crypto.encode(i,u),v=gs[o].req;return this.core.history.set(i,u),this.core.relayer.publish(i,f,v),u.id},this.sendResult=async(i,o,a)=>{const u=Dc(i,a),f=await this.core.crypto.encode(o,u),v=await this.core.history.get(o,i),p=gs[v.request.method].res;await this.core.relayer.publish(o,f,p),await this.core.history.resolve(u)},this.sendError=async(i,o,a)=>{const u=oo(i,a),f=await this.core.crypto.encode(o,u),v=await this.core.history.get(o,i),p=gs[v.request.method]?gs[v.request.method].res:gs.unregistered_method.res;await this.core.relayer.publish(o,f,p),await this.core.history.resolve(u)},this.deletePairing=async(i,o)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,At("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),o?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{const i=this.pairings.getAll().filter(o=>In(o.expiry));await Promise.all(i.map(o=>this.deletePairing(o.topic)))},this.onRelayEventRequest=i=>{const{topic:o,payload:a}=i;switch(a.method){case"wc_pairingPing":return this.onPairingPingRequest(o,a);case"wc_pairingDelete":return this.onPairingDeleteRequest(o,a);default:return this.onUnknownRpcMethodRequest(o,a)}},this.onRelayEventResponse=async i=>{const{topic:o,payload:a}=i,u=(await this.core.history.get(o,a.id)).request.method;switch(u){case"wc_pairingPing":return this.onPairingPingResponse(o,a);default:return this.onUnknownRpcMethodResponse(u)}},this.onPairingPingRequest=async(i,o)=>{const{id:a}=o;try{this.isValidPing({topic:i}),await this.sendResult(a,i,!0),this.events.emit(vs.ping,{id:a,topic:i})}catch(u){await this.sendError(a,i,u),this.logger.error(u)}},this.onPairingPingResponse=(i,o)=>{const{id:a}=o;setTimeout(()=>{un(o)?this.events.emit(Ft("pairing_ping",a),{}):zr(o)&&this.events.emit(Ft("pairing_ping",a),{error:o.error})},500)},this.onPairingDeleteRequest=async(i,o)=>{const{id:a}=o;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(vs.delete,{id:a,topic:i})}catch(u){await this.sendError(a,i,u),this.logger.error(u)}},this.onUnknownRpcMethodRequest=async(i,o)=>{const{id:a,method:u}=o;try{if(this.registeredMethods.includes(u))return;const f=At("WC_METHOD_UNSUPPORTED",u);await this.sendError(a,i,f),this.logger.error(f)}catch(f){await this.sendError(a,i,f),this.logger.error(f)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(At("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=i=>{if(!gr(i)){const{message:o}=he("MISSING_OR_INVALID",`pair() params: ${i}`);throw new Error(o)}if(!Q_(i.uri)){const{message:o}=he("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw new Error(o)}},this.isValidPing=async i=>{if(!gr(i)){const{message:a}=he("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(a)}const{topic:o}=i;await this.isValidPairingTopic(o)},this.isValidDisconnect=async i=>{if(!gr(i)){const{message:a}=he("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(a)}const{topic:o}=i;await this.isValidPairingTopic(o)},this.isValidPairingTopic=async i=>{if(!kt(i,!1)){const{message:o}=he("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(o)}if(!this.pairings.keys.includes(i)){const{message:o}=he("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(o)}if(In(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:o}=he("EXPIRED",`pairing topic: ${i}`);throw new Error(o)}},this.core=e,this.logger=Je.generateChildLogger(t,this.name),this.pairings=new uo(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Je.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(er.message,async e=>{const{topic:t,message:i}=e;if(!this.pairings.keys.includes(t)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const o=await this.core.crypto.decode(t,i);try{Sc(o)?(this.core.history.set(t,o),this.onRelayEventRequest({topic:t,payload:o})):ao(o)&&(await this.core.history.resolve(o),await this.onRelayEventResponse({topic:t,payload:o}),this.core.history.delete(t,o.id))}catch(a){this.logger.error(a)}})}registerExpirerEvents(){this.core.expirer.on(Tr.expired,async e=>{const{topic:t}=Ul(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(vs.expire,{topic:t}))})}}class A3 extends Yb{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new Yt.exports.EventEmitter,this.name=s3,this.version=o3,this.cached=[],this.initialized=!1,this.storagePrefix=Pn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,o,a)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:o,chainId:a}),this.records.has(o.id))return;const u={id:o.id,topic:i,request:{method:o.method,params:o.params||null},chainId:a,expiry:Br(ye.THIRTY_DAYS)};this.records.set(u.id,u),this.events.emit(Zr.created,u)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const o=await this.getRecord(i.id);typeof o.response>"u"&&(o.response=zr(i)?{error:i.error}:{result:i.result},this.records.set(o.id,o),this.events.emit(Zr.updated,o))},this.get=async(i,o)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:o}),await this.getRecord(o)),this.delete=(i,o)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:o}),this.values.forEach(a=>{if(a.topic===i){if(typeof o<"u"&&a.id!==o)return;this.records.delete(a.id),this.events.emit(Zr.deleted,a)}})},this.exists=async(i,o)=>(this.isInitialized(),this.records.has(o)?(await this.getRecord(o)).topic===i:!1),this.on=(i,o)=>{this.events.on(i,o)},this.once=(i,o)=>{this.events.once(i,o)},this.off=(i,o)=>{this.events.off(i,o)},this.removeListener=(i,o)=>{this.events.removeListener(i,o)},this.logger=Je.generateChildLogger(t,this.name)}get context(){return Je.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const i={topic:t.topic,request:Ei(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:i}=he("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Zr.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=he("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Zr.created,e=>{const t=Zr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Zr.updated,e=>{const t=Zr.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Zr.deleted,e=>{const t=Zr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.core.heartbeat.on(wi.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{ye.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))})}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}}class T3 extends tm{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new Yt.exports.EventEmitter,this.name=a3,this.version=c3,this.cached=[],this.initialized=!1,this.storagePrefix=Pn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{const o=this.formatTarget(i);return typeof this.getExpiration(o)<"u"}catch{return!1}},this.set=(i,o)=>{this.isInitialized();const a=this.formatTarget(i),u={target:a,expiry:o};this.expirations.set(a,u),this.checkExpiry(a,u),this.events.emit(Tr.created,{target:a,expiration:u})},this.get=i=>{this.isInitialized();const o=this.formatTarget(i);return this.getExpiration(o)},this.del=i=>{if(this.isInitialized(),this.has(i)){const o=this.formatTarget(i),a=this.getExpiration(o);this.expirations.delete(o),this.events.emit(Tr.deleted,{target:o,expiration:a})}},this.on=(i,o)=>{this.events.on(i,o)},this.once=(i,o)=>{this.events.once(i,o)},this.off=(i,o)=>{this.events.off(i,o)},this.removeListener=(i,o)=>{this.events.removeListener(i,o)},this.logger=Je.generateChildLogger(t,this.name)}get context(){return Je.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return A_(e);if(typeof e=="number")return T_(e);const{message:t}=he("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Tr.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=he("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:i}=he("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}checkExpiry(e,t){const{expiry:i}=t;ye.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(Tr.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(wi.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Tr.created,e=>{const t=Tr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Tr.expired,e=>{const t=Tr.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Tr.deleted,e=>{const t=Tr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}}class R3 extends rm{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.name=Ac,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async i=>{if(this.verifyDisabled||Qi()||!Xi())return;const o=this.getVerifyUrl(i?.verifyUrl);this.verifyUrl!==o&&this.removeIframe(),this.verifyUrl=o;try{await this.createIframe()}catch(a){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(a)}if(!this.initialized){this.removeIframe(),this.verifyUrl=Tc;try{await this.createIframe()}catch(a){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(a),this.verifyDisabled=!0}}},this.register=async i=>{this.initialized?this.sendPost(i.attestationId):(this.addToQueue(i.attestationId),await this.init())},this.resolve=async i=>{if(this.isDevEnv)return"";const o=this.getVerifyUrl(i?.verifyUrl);let a;try{a=await this.fetchAttestation(i.attestationId,o)}catch(u){this.logger.info(`failed to resolve attestation: ${i.attestationId} from url: ${o}`),this.logger.info(u),a=await this.fetchAttestation(i.attestationId,Tc)}return a},this.fetchAttestation=async(i,o)=>{this.logger.info(`resolving attestation: ${i} from url: ${o}`);const a=this.startAbortTimer(ye.ONE_SECOND*2),u=await fetch(`${o}/attestation/${i}`,{signal:this.abortController.signal});return clearTimeout(a),u.status===200?await u.json():void 0},this.addToQueue=i=>{this.queue.push(i)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(i=>this.sendPost(i)),this.queue=[])},this.sendPost=i=>{var o;try{if(!this.iframe)return;(o=this.iframe.contentWindow)==null||o.postMessage(i,"*"),this.logger.info(`postMessage sent: ${i} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let i;const o=a=>{a.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",o),i())};await Promise.race([new Promise(a=>{if(document.getElementById(Ac))return a();window.addEventListener("message",o);const u=document.createElement("iframe");u.id=Ac,u.src=`${this.verifyUrl}/${this.projectId}`,u.style.display="none",document.body.append(u),this.iframe=u,i=a}),new Promise((a,u)=>setTimeout(()=>{window.removeEventListener("message",o),u("verify iframe load timeout")},ye.toMiliseconds(ye.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=i=>{let o=i||Di;return u3.includes(o)||(this.logger.info(`verify url: ${o}, not included in trusted list, assigning default: ${Di}`),o=Di),o},this.logger=Je.generateChildLogger(t,this.name),this.verifyUrl=Di,this.abortController=new AbortController,this.isDevEnv=Ja()&&process.env.IS_VITEST}get context(){return Je.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),ye.toMiliseconds(e))}}var N3=Object.defineProperty,pd=Object.getOwnPropertySymbols,$3=Object.prototype.hasOwnProperty,F3=Object.prototype.propertyIsEnumerable,gd=(r,e,t)=>e in r?N3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vd=(r,e)=>{for(var t in e||(e={}))$3.call(e,t)&&gd(r,t,e[t]);if(pd)for(var t of pd(e))F3.call(e,t)&&gd(r,t,e[t]);return r};class Nc extends Wb{constructor(e){super(e),this.protocol=rd,this.version=FE,this.name=Cc,this.events=new Yt.exports.EventEmitter,this.initialized=!1,this.on=(i,o)=>this.events.on(i,o),this.once=(i,o)=>this.events.once(i,o),this.off=(i,o)=>this.events.off(i,o),this.removeListener=(i,o)=>this.events.removeListener(i,o),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||sd,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Je.pino(Je.getDefaultLoggerOptions({level:e?.logger||LE.logger}));this.logger=Je.generateChildLogger(t,this.name),this.heartbeat=new wi.HeartBeat,this.crypto=new l3(this,this.logger,e?.keychain),this.history=new A3(this,this.logger),this.expirer=new T3(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new X1(vd(vd({},UE),e?.storageOptions)),this.relayer=new x3({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new C3(this,this.logger),this.verify=new R3(this.projectId||"",this.logger)}static async init(e){const t=new Nc(e);await t.initialize();const i=await t.crypto.getClientId();return await t.storage.setItem(ZE,i),t}get context(){return Je.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const L3=Nc,yd="wc",_d=2,bd="client",$c=`${yd}@${_d}:${bd}:`,Fc={name:bd,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},md="WALLETCONNECT_DEEPLINK_CHOICE",U3="proposal",wd="Proposal expired",j3="session",ho=ye.SEVEN_DAYS,M3="engine",_s={wc_sessionPropose:{req:{ttl:ye.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ye.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ye.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1115}}},Lc={min:ye.FIVE_MINUTES,max:ye.SEVEN_DAYS},fn={idle:"IDLE",active:"ACTIVE"},q3="request",H3=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var B3=Object.defineProperty,z3=Object.defineProperties,K3=Object.getOwnPropertyDescriptors,Ed=Object.getOwnPropertySymbols,V3=Object.prototype.hasOwnProperty,k3=Object.prototype.propertyIsEnumerable,Dd=(r,e,t)=>e in r?B3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vr=(r,e)=>{for(var t in e||(e={}))V3.call(e,t)&&Dd(r,t,e[t]);if(Ed)for(var t of Ed(e))k3.call(e,t)&&Dd(r,t,e[t]);return r},bs=(r,e)=>z3(r,K3(e));class G3 extends im{constructor(e){super(e),this.name=M3,this.events=new Yt.exports,this.initialized=!1,this.ignoredPayloadTypes=[kn],this.requestQueue={state:fn.idle,queue:[]},this.sessionRequestQueue={state:fn.idle,queue:[]},this.requestQueueDelay=ye.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(_s)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},ye.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{await this.isInitialized();const i=bs(vr({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(i);const{pairingTopic:o,requiredNamespaces:a,optionalNamespaces:u,sessionProperties:f,relays:v}=i;let p=o,w,I=!1;if(p&&(I=this.client.core.pairing.pairings.get(p).active),!p||!I){const{topic:U,uri:x}=await this.client.core.pairing.create();p=U,w=x}const S=await this.client.core.crypto.generateKeyPair(),C=vr({requiredNamespaces:a,optionalNamespaces:u,relays:v??[{protocol:id}],proposer:{publicKey:S,metadata:this.client.metadata}},f&&{sessionProperties:f}),{reject:R,resolve:B,done:K}=yi(ye.FIVE_MINUTES,wd);if(this.events.once(Ft("session_connect"),async({error:U,session:x})=>{if(U)R(U);else if(x){x.self.publicKey=S;const T=bs(vr({},x),{requiredNamespaces:x.requiredNamespaces,optionalNamespaces:x.optionalNamespaces});await this.client.session.set(x.topic,T),await this.setExpiry(x.topic,x.expiry),p&&await this.client.core.pairing.updateMetadata({topic:p,metadata:x.peer.metadata}),B(T)}}),!p){const{message:U}=he("NO_MATCHING_KEY",`connect() pairing topic: ${p}`);throw new Error(U)}const se=await this.sendRequest({topic:p,method:"wc_sessionPropose",params:C}),$=Br(ye.FIVE_MINUTES);return await this.setProposal(se,vr({id:se,expiry:$},C)),{uri:w,approval:K}},this.pair=async t=>(await this.isInitialized(),await this.client.core.pairing.pair(t)),this.approve=async t=>{await this.isInitialized(),await this.isValidApprove(t);const{id:i,relayProtocol:o,namespaces:a,sessionProperties:u}=t,f=this.client.proposal.get(i);let{pairingTopic:v,proposer:p,requiredNamespaces:w,optionalNamespaces:I}=f;v=v||"",bi(w)||(w=k_(a,"approve()"));const S=await this.client.core.crypto.generateKeyPair(),C=p.publicKey,R=await this.client.core.crypto.generateSharedKey(S,C);v&&i&&(await this.client.core.pairing.updateMetadata({topic:v,metadata:p.metadata}),await this.sendResult({id:i,topic:v,result:{relay:{protocol:o??"irn"},responderPublicKey:S}}),await this.client.proposal.delete(i,At("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:v}));const B=vr({relay:{protocol:o??"irn"},namespaces:a,requiredNamespaces:w,optionalNamespaces:I,pairingTopic:v,controller:{publicKey:S,metadata:this.client.metadata},expiry:Br(ho)},u&&{sessionProperties:u});await this.client.core.relayer.subscribe(R),await this.sendRequest({topic:R,method:"wc_sessionSettle",params:B,throwOnFailedPublish:!0});const K=bs(vr({},B),{topic:R,pairingTopic:v,acknowledged:!1,self:B.controller,peer:{publicKey:p.publicKey,metadata:p.metadata},controller:S});return await this.client.session.set(R,K),await this.setExpiry(R,Br(ho)),{topic:R,acknowledged:()=>new Promise(se=>setTimeout(()=>se(this.client.session.get(R)),500))}},this.reject=async t=>{await this.isInitialized(),await this.isValidReject(t);const{id:i,reason:o}=t,{pairingTopic:a}=this.client.proposal.get(i);a&&(await this.sendError(i,a,o),await this.client.proposal.delete(i,At("USER_DISCONNECTED")))},this.update=async t=>{await this.isInitialized(),await this.isValidUpdate(t);const{topic:i,namespaces:o}=t,a=await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:o}}),{done:u,resolve:f,reject:v}=yi();return this.events.once(Ft("session_update",a),({error:p})=>{p?v(p):f()}),await this.client.session.update(i,{namespaces:o}),{acknowledged:u}},this.extend=async t=>{await this.isInitialized(),await this.isValidExtend(t);const{topic:i}=t,o=await this.sendRequest({topic:i,method:"wc_sessionExtend",params:{}}),{done:a,resolve:u,reject:f}=yi();return this.events.once(Ft("session_extend",o),({error:v})=>{v?f(v):u()}),await this.setExpiry(i,Br(ho)),{acknowledged:a}},this.request=async t=>{await this.isInitialized(),await this.isValidRequest(t);const{chainId:i,request:o,topic:a,expiry:u}=t,f=Ec(),{done:v,resolve:p,reject:w}=yi(u,"Request expired. Please try again.");return this.events.once(Ft("session_request",f),({error:I,result:S})=>{I?w(I):p(S)}),await Promise.all([new Promise(async I=>{await this.sendRequest({clientRpcId:f,topic:a,method:"wc_sessionRequest",params:{request:o,chainId:i},expiry:u,throwOnFailedPublish:!0}).catch(S=>w(S)),this.client.events.emit("session_request_sent",{topic:a,request:o,chainId:i,id:f}),I()}),new Promise(async I=>{const S=await this.client.core.storage.getItem(md);R_({id:f,topic:a,wcDeepLink:S}),I()}),v()]).then(I=>I[2])},this.respond=async t=>{await this.isInitialized(),await this.isValidRespond(t);const{topic:i,response:o}=t,{id:a}=o;un(o)?await this.sendResult({id:a,topic:i,result:o.result,throwOnFailedPublish:!0}):zr(o)&&await this.sendError(a,i,o.error),this.cleanupAfterResponse(t)},this.ping=async t=>{await this.isInitialized(),await this.isValidPing(t);const{topic:i}=t;if(this.client.session.keys.includes(i)){const o=await this.sendRequest({topic:i,method:"wc_sessionPing",params:{}}),{done:a,resolve:u,reject:f}=yi();this.events.once(Ft("session_ping",o),({error:v})=>{v?f(v):u()}),await a()}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async t=>{await this.isInitialized(),await this.isValidEmit(t);const{topic:i,event:o,chainId:a}=t;await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:o,chainId:a}})},this.disconnect=async t=>{await this.isInitialized(),await this.isValidDisconnect(t);const{topic:i}=t;this.client.session.keys.includes(i)?(await this.sendRequest({topic:i,method:"wc_sessionDelete",params:At("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(i)):await this.client.core.pairing.disconnect({topic:i})},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>Y_(i,t))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const i=this.client.core.pairing.pairings.get(t.pairingTopic),o=this.client.core.pairing.pairings.getAll().filter(a=>{var u,f;return((u=a.peerMetadata)==null?void 0:u.url)&&((f=a.peerMetadata)==null?void 0:f.url)===t.peer.metadata.url&&a.topic&&a.topic!==i.topic});if(o.length===0)return;this.client.logger.info(`Cleaning up ${o.length} duplicate pairing(s)`),await Promise.all(o.map(a=>this.client.core.pairing.disconnect({topic:a.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}},this.deleteSession=async(t,i)=>{const{self:o}=this.client.session.get(t);await this.client.core.relayer.unsubscribe(t),this.client.session.delete(t,At("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(o.publicKey)&&await this.client.core.crypto.deleteKeyPair(o.publicKey),this.client.core.crypto.keychain.has(t)&&await this.client.core.crypto.deleteSymKey(t),i||this.client.core.expirer.del(t),this.client.core.storage.removeItem(md).catch(a=>this.client.logger.warn(a))},this.deleteProposal=async(t,i)=>{await Promise.all([this.client.proposal.delete(t,At("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)])},this.deletePendingSessionRequest=async(t,i,o=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,i),o?Promise.resolve():this.client.core.expirer.del(t)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(a=>a.id!==t),o&&(this.sessionRequestQueue.state=fn.idle)},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&await this.client.session.update(t,{expiry:i}),this.client.core.expirer.set(t,i)},this.setProposal=async(t,i)=>{await this.client.proposal.set(t,i),this.client.core.expirer.set(t,i.expiry)},this.setPendingSessionRequest=async t=>{const i=_s.wc_sessionRequest.req.ttl,{id:o,topic:a,params:u,verifyContext:f}=t;await this.client.pendingRequest.set(o,{id:o,topic:a,params:u,verifyContext:f}),i&&this.client.core.expirer.set(o,Br(i))},this.sendRequest=async t=>{const{topic:i,method:o,params:a,expiry:u,relayRpcId:f,clientRpcId:v,throwOnFailedPublish:p}=t,w=Ei(o,a,v);if(Xi()&&H3.includes(o)){const C=vi(JSON.stringify(w));this.client.core.verify.register({attestationId:C})}const I=await this.client.core.crypto.encode(i,w),S=_s[o].req;return u&&(S.ttl=u),f&&(S.id=f),this.client.core.history.set(i,w),p?(S.internal=bs(vr({},S.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,I,S)):this.client.core.relayer.publish(i,I,S).catch(C=>this.client.logger.error(C)),w.id},this.sendResult=async t=>{const{id:i,topic:o,result:a,throwOnFailedPublish:u}=t,f=Dc(i,a),v=await this.client.core.crypto.encode(o,f),p=await this.client.core.history.get(o,i),w=_s[p.request.method].res;u?(w.internal=bs(vr({},w.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(o,v,w)):this.client.core.relayer.publish(o,v,w).catch(I=>this.client.logger.error(I)),await this.client.core.history.resolve(f)},this.sendError=async(t,i,o)=>{const a=oo(t,o),u=await this.client.core.crypto.encode(i,a),f=await this.client.core.history.get(i,t),v=_s[f.request.method].res;this.client.core.relayer.publish(i,u,v),await this.client.core.history.resolve(a)},this.cleanup=async()=>{const t=[],i=[];this.client.session.getAll().forEach(o=>{In(o.expiry)&&t.push(o.topic)}),this.client.proposal.getAll().forEach(o=>{In(o.expiry)&&i.push(o.id)}),await Promise.all([...t.map(o=>this.deleteSession(o)),...i.map(o=>this.deleteProposal(o))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===fn.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=fn.active;const t=this.requestQueue.queue.shift();if(t)try{this.processRequest(t),await new Promise(i=>setTimeout(i,300))}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=fn.idle},this.processRequest=t=>{const{topic:i,payload:o}=t,a=o.method;switch(a){case"wc_sessionPropose":return this.onSessionProposeRequest(i,o);case"wc_sessionSettle":return this.onSessionSettleRequest(i,o);case"wc_sessionUpdate":return this.onSessionUpdateRequest(i,o);case"wc_sessionExtend":return this.onSessionExtendRequest(i,o);case"wc_sessionPing":return this.onSessionPingRequest(i,o);case"wc_sessionDelete":return this.onSessionDeleteRequest(i,o);case"wc_sessionRequest":return this.onSessionRequest(i,o);case"wc_sessionEvent":return this.onSessionEventRequest(i,o);default:return this.client.logger.info(`Unsupported request method ${a}`)}},this.onRelayEventResponse=async t=>{const{topic:i,payload:o}=t,a=(await this.client.core.history.get(i,o.id)).request.method;switch(a){case"wc_sessionPropose":return this.onSessionProposeResponse(i,o);case"wc_sessionSettle":return this.onSessionSettleResponse(i,o);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,o);case"wc_sessionExtend":return this.onSessionExtendResponse(i,o);case"wc_sessionPing":return this.onSessionPingResponse(i,o);case"wc_sessionRequest":return this.onSessionRequestResponse(i,o);default:return this.client.logger.info(`Unsupported response method ${a}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:i}=t,{message:o}=he("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(o)},this.onSessionProposeRequest=async(t,i)=>{const{params:o,id:a}=i;try{this.isValidConnect(vr({},i.params));const u=Br(ye.FIVE_MINUTES),f=vr({id:a,pairingTopic:t,expiry:u},o);await this.setProposal(a,f);const v=vi(JSON.stringify(i)),p=await this.getVerifyContext(v,f.proposer.metadata);this.client.events.emit("session_proposal",{id:a,params:f,verifyContext:p})}catch(u){await this.sendError(a,t,u),this.client.logger.error(u)}},this.onSessionProposeResponse=async(t,i)=>{const{id:o}=i;if(un(i)){const{result:a}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:a});const u=this.client.proposal.get(o);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:u});const f=u.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:f});const v=a.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:v});const p=await this.client.core.crypto.generateSharedKey(f,v);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:p});const w=await this.client.core.relayer.subscribe(p);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:w}),await this.client.core.pairing.activate({topic:t})}else zr(i)&&(await this.client.proposal.delete(o,At("USER_DISCONNECTED")),this.events.emit(Ft("session_connect"),{error:i.error}))},this.onSessionSettleRequest=async(t,i)=>{const{id:o,params:a}=i;try{this.isValidSessionSettleRequest(a);const{relay:u,controller:f,expiry:v,namespaces:p,requiredNamespaces:w,optionalNamespaces:I,sessionProperties:S,pairingTopic:C}=i.params,R=vr({topic:t,relay:u,expiry:v,namespaces:p,acknowledged:!0,pairingTopic:C,requiredNamespaces:w,optionalNamespaces:I,controller:f.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:f.publicKey,metadata:f.metadata}},S&&{sessionProperties:S});await this.sendResult({id:i.id,topic:t,result:!0}),this.events.emit(Ft("session_connect"),{session:R}),this.cleanupDuplicatePairings(R)}catch(u){await this.sendError(o,t,u),this.client.logger.error(u)}},this.onSessionSettleResponse=async(t,i)=>{const{id:o}=i;un(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(Ft("session_approve",o),{})):zr(i)&&(await this.client.session.delete(t,At("USER_DISCONNECTED")),this.events.emit(Ft("session_approve",o),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{const{params:o,id:a}=i;try{const u=`${t}_session_update`,f=ro.get(u);if(f&&this.isRequestOutOfSync(f,a)){this.client.logger.info(`Discarding out of sync request - ${a}`);return}this.isValidUpdate(vr({topic:t},o)),await this.client.session.update(t,{namespaces:o.namespaces}),await this.sendResult({id:a,topic:t,result:!0}),this.client.events.emit("session_update",{id:a,topic:t,params:o}),ro.set(u,a)}catch(u){await this.sendError(a,t,u),this.client.logger.error(u)}},this.isRequestOutOfSync=(t,i)=>parseInt(i.toString().slice(0,-3))<=parseInt(t.toString().slice(0,-3)),this.onSessionUpdateResponse=(t,i)=>{const{id:o}=i;un(i)?this.events.emit(Ft("session_update",o),{}):zr(i)&&this.events.emit(Ft("session_update",o),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{const{id:o}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,Br(ho)),await this.sendResult({id:o,topic:t,result:!0}),this.client.events.emit("session_extend",{id:o,topic:t})}catch(a){await this.sendError(o,t,a),this.client.logger.error(a)}},this.onSessionExtendResponse=(t,i)=>{const{id:o}=i;un(i)?this.events.emit(Ft("session_extend",o),{}):zr(i)&&this.events.emit(Ft("session_extend",o),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{const{id:o}=i;try{this.isValidPing({topic:t}),await this.sendResult({id:o,topic:t,result:!0}),this.client.events.emit("session_ping",{id:o,topic:t})}catch(a){await this.sendError(o,t,a),this.client.logger.error(a)}},this.onSessionPingResponse=(t,i)=>{const{id:o}=i;setTimeout(()=>{un(i)?this.events.emit(Ft("session_ping",o),{}):zr(i)&&this.events.emit(Ft("session_ping",o),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{const{id:o}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),await Promise.all([new Promise(a=>{this.client.core.relayer.once(er.publish,async()=>{a(await this.deleteSession(t))})}),this.sendResult({id:o,topic:t,result:!0})]),this.client.events.emit("session_delete",{id:o,topic:t})}catch(a){this.client.logger.error(a)}},this.onSessionRequest=async(t,i)=>{const{id:o,params:a}=i;try{this.isValidRequest(vr({topic:t},a));const u=vi(JSON.stringify(Ei("wc_sessionRequest",a,o))),f=this.client.session.get(t),v=await this.getVerifyContext(u,f.peer.metadata),p={id:o,topic:t,params:a,verifyContext:v};await this.setPendingSessionRequest(p),this.addSessionRequestToSessionRequestQueue(p),this.processSessionRequestQueue()}catch(u){await this.sendError(o,t,u),this.client.logger.error(u)}},this.onSessionRequestResponse=(t,i)=>{const{id:o}=i;un(i)?this.events.emit(Ft("session_request",o),{result:i.result}):zr(i)&&this.events.emit(Ft("session_request",o),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{const{id:o,params:a}=i;try{const u=`${t}_session_event_${a.event.name}`,f=ro.get(u);if(f&&this.isRequestOutOfSync(f,o)){this.client.logger.info(`Discarding out of sync request - ${o}`);return}this.isValidEmit(vr({topic:t},a)),this.client.events.emit("session_event",{id:o,topic:t,params:a}),ro.set(u,o)}catch(u){await this.sendError(o,t,u),this.client.logger.error(u)}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=fn.idle,this.processSessionRequestQueue()},ye.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===fn.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=fn.active,this.client.events.emit("session_request",t)}catch(i){this.client.logger.error(i)}},this.onPairingCreated=t=>{if(t.active)return;const i=this.client.proposal.getAll().find(o=>o.pairingTopic===t.topic);i&&this.onSessionProposeRequest(t.topic,Ei("wc_sessionPropose",{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer},i.id))},this.isValidConnect=async t=>{if(!gr(t)){const{message:v}=he("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(v)}const{pairingTopic:i,requiredNamespaces:o,optionalNamespaces:a,sessionProperties:u,relays:f}=t;if(sr(i)||await this.isValidPairingTopic(i),!a1(f,!0)){const{message:v}=he("MISSING_OR_INVALID",`connect() relays: ${f}`);throw new Error(v)}!sr(o)&&bi(o)!==0&&this.validateNamespaces(o,"requiredNamespaces"),!sr(a)&&bi(a)!==0&&this.validateNamespaces(a,"optionalNamespaces"),sr(u)||this.validateSessionProps(u,"sessionProperties")},this.validateNamespaces=(t,i)=>{const o=o1(t,"connect()",i);if(o)throw new Error(o.message)},this.isValidApprove=async t=>{if(!gr(t))throw new Error(he("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:i,namespaces:o,relayProtocol:a,sessionProperties:u}=t;await this.isValidProposalId(i);const f=this.client.proposal.get(i),v=to(o,"approve()");if(v)throw new Error(v.message);const p=Kl(f.requiredNamespaces,o,"approve()");if(p)throw new Error(p.message);if(!kt(a,!0)){const{message:w}=he("MISSING_OR_INVALID",`approve() relayProtocol: ${a}`);throw new Error(w)}sr(u)||this.validateSessionProps(u,"sessionProperties")},this.isValidReject=async t=>{if(!gr(t)){const{message:a}=he("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(a)}const{id:i,reason:o}=t;if(await this.isValidProposalId(i),!u1(o)){const{message:a}=he("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(o)}`);throw new Error(a)}},this.isValidSessionSettleRequest=t=>{if(!gr(t)){const{message:p}=he("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(p)}const{relay:i,controller:o,namespaces:a,expiry:u}=t;if(!Bl(i)){const{message:p}=he("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(p)}const f=e1(o,"onSessionSettleRequest()");if(f)throw new Error(f.message);const v=to(a,"onSessionSettleRequest()");if(v)throw new Error(v.message);if(In(u)){const{message:p}=he("EXPIRED","onSessionSettleRequest()");throw new Error(p)}},this.isValidUpdate=async t=>{if(!gr(t)){const{message:v}=he("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(v)}const{topic:i,namespaces:o}=t;await this.isValidSessionTopic(i);const a=this.client.session.get(i),u=to(o,"update()");if(u)throw new Error(u.message);const f=Kl(a.requiredNamespaces,o,"update()");if(f)throw new Error(f.message)},this.isValidExtend=async t=>{if(!gr(t)){const{message:o}=he("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(o)}const{topic:i}=t;await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!gr(t)){const{message:v}=he("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(v)}const{topic:i,request:o,chainId:a,expiry:u}=t;await this.isValidSessionTopic(i);const{namespaces:f}=this.client.session.get(i);if(!zl(f,a)){const{message:v}=he("MISSING_OR_INVALID",`request() chainId: ${a}`);throw new Error(v)}if(!h1(o)){const{message:v}=he("MISSING_OR_INVALID",`request() ${JSON.stringify(o)}`);throw new Error(v)}if(!d1(f,a,o.method)){const{message:v}=he("MISSING_OR_INVALID",`request() method: ${o.method}`);throw new Error(v)}if(u&&!y1(u,Lc)){const{message:v}=he("MISSING_OR_INVALID",`request() expiry: ${u}. Expiry must be a number (in seconds) between ${Lc.min} and ${Lc.max}`);throw new Error(v)}},this.isValidRespond=async t=>{if(!gr(t)){const{message:a}=he("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(a)}const{topic:i,response:o}=t;if(await this.isValidSessionTopic(i),!l1(o)){const{message:a}=he("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(o)}`);throw new Error(a)}},this.isValidPing=async t=>{if(!gr(t)){const{message:o}=he("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(o)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!gr(t)){const{message:f}=he("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(f)}const{topic:i,event:o,chainId:a}=t;await this.isValidSessionTopic(i);const{namespaces:u}=this.client.session.get(i);if(!zl(u,a)){const{message:f}=he("MISSING_OR_INVALID",`emit() chainId: ${a}`);throw new Error(f)}if(!f1(o)){const{message:f}=he("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(o)}`);throw new Error(f)}if(!p1(u,a,o.name)){const{message:f}=he("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(o)}`);throw new Error(f)}},this.isValidDisconnect=async t=>{if(!gr(t)){const{message:o}=he("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(o)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.getVerifyContext=async(t,i)=>{const o={verified:{verifyUrl:i.verifyUrl||Di,validation:"UNKNOWN",origin:i.url||""}};try{const a=await this.client.core.verify.resolve({attestationId:t,verifyUrl:i.verifyUrl});a&&(o.verified.origin=a.origin,o.verified.isScam=a.isScam,o.verified.validation=a.origin===new URL(i.url).origin?"VALID":"INVALID")}catch(a){this.client.logger.info(a)}return this.client.logger.info(`Verify context: ${JSON.stringify(o)}`),o},this.validateSessionProps=(t,i)=>{Object.values(t).forEach(o=>{if(!kt(o,!1)){const{message:a}=he("MISSING_OR_INVALID",`${i} must be in Record<string, string> format. Received: ${JSON.stringify(o)}`);throw new Error(a)}})}}async isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(er.message,async e=>{const{topic:t,message:i}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(i)))return;const o=await this.client.core.crypto.decode(t,i);try{Sc(o)?(this.client.core.history.set(t,o),this.onRelayEventRequest({topic:t,payload:o})):ao(o)?(await this.client.core.history.resolve(o),await this.onRelayEventResponse({topic:t,payload:o}),this.client.core.history.delete(t,o.id)):this.onRelayEventUnknownPayload({topic:t,payload:o})}catch(a){this.client.logger.error(a)}})}registerExpirerEvents(){this.client.core.expirer.on(Tr.expired,async e=>{const{topic:t,id:i}=Ul(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,he("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession(t,!0),this.client.events.emit("session_expire",{topic:t})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(vs.create,e=>this.onPairingCreated(e))}isValidPairingTopic(e){if(!kt(e,!1)){const{message:t}=he("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=he("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(In(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=he("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!kt(e,!1)){const{message:t}=he("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(!this.client.session.keys.includes(e)){const{message:t}=he("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(In(this.client.session.get(e).expiry)){await this.deleteSession(e);const{message:t}=he("EXPIRED",`session topic: ${e}`);throw new Error(t)}}async isValidSessionOrPairingTopic(e){if(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(kt(e,!1)){const{message:t}=he("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=he("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!c1(e)){const{message:t}=he("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=he("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(In(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);const{message:t}=he("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class W3 extends uo{constructor(e,t){super(e,t,U3,$c),this.core=e,this.logger=t}}class Y3 extends uo{constructor(e,t){super(e,t,j3,$c),this.core=e,this.logger=t}}class J3 extends uo{constructor(e,t){super(e,t,q3,$c,i=>i.id),this.core=e,this.logger=t}}class Uc extends nm{constructor(e){super(e),this.protocol=yd,this.version=_d,this.name=Fc.name,this.events=new Yt.exports.EventEmitter,this.on=(i,o)=>this.events.on(i,o),this.once=(i,o)=>this.events.once(i,o),this.off=(i,o)=>this.events.off(i,o),this.removeListener=(i,o)=>this.events.removeListener(i,o),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(o){throw this.logger.error(o.message),o}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(o){throw this.logger.error(o.message),o}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(o){throw this.logger.error(o.message),o}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(o){throw this.logger.error(o.message),o}},this.update=async i=>{try{return await this.engine.update(i)}catch(o){throw this.logger.error(o.message),o}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(o){throw this.logger.error(o.message),o}},this.request=async i=>{try{return await this.engine.request(i)}catch(o){throw this.logger.error(o.message),o}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(o){throw this.logger.error(o.message),o}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(o){throw this.logger.error(o.message),o}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(o){throw this.logger.error(o.message),o}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(o){throw this.logger.error(o.message),o}},this.find=i=>{try{return this.engine.find(i)}catch(o){throw this.logger.error(o.message),o}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.name=e?.name||Fc.name,this.metadata=e?.metadata||x_();const t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Je.pino(Je.getDefaultLoggerOptions({level:e?.logger||Fc.logger}));this.core=e?.core||new L3(e),this.logger=Je.generateChildLogger(t,this.name),this.session=new Y3(this.core,this.logger),this.proposal=new W3(this.core,this.logger),this.pendingRequest=new J3(this.core,this.logger),this.engine=new G3(this)}static async init(e){const t=new Uc(e);return await t.initialize(),t}get context(){return Je.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var jc={exports:{}};(function(r,e){var t=typeof self<"u"?self:Vt,i=function(){function a(){this.fetch=!1,this.DOMException=t.DOMException}return a.prototype=t,new a}();(function(a){(function(u){var f={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function v(m){return m&&DataView.prototype.isPrototypeOf(m)}if(f.arrayBuffer)var p=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],w=ArrayBuffer.isView||function(m){return m&&p.indexOf(Object.prototype.toString.call(m))>-1};function I(m){if(typeof m!="string"&&(m=String(m)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(m))throw new TypeError("Invalid character in header field name");return m.toLowerCase()}function S(m){return typeof m!="string"&&(m=String(m)),m}function C(m){var P={next:function(){var ee=m.shift();return{done:ee===void 0,value:ee}}};return f.iterable&&(P[Symbol.iterator]=function(){return P}),P}function R(m){this.map={},m instanceof R?m.forEach(function(P,ee){this.append(ee,P)},this):Array.isArray(m)?m.forEach(function(P){this.append(P[0],P[1])},this):m&&Object.getOwnPropertyNames(m).forEach(function(P){this.append(P,m[P])},this)}R.prototype.append=function(m,P){m=I(m),P=S(P);var ee=this.map[m];this.map[m]=ee?ee+", "+P:P},R.prototype.delete=function(m){delete this.map[I(m)]},R.prototype.get=function(m){return m=I(m),this.has(m)?this.map[m]:null},R.prototype.has=function(m){return this.map.hasOwnProperty(I(m))},R.prototype.set=function(m,P){this.map[I(m)]=S(P)},R.prototype.forEach=function(m,P){for(var ee in this.map)this.map.hasOwnProperty(ee)&&m.call(P,this.map[ee],ee,this)},R.prototype.keys=function(){var m=[];return this.forEach(function(P,ee){m.push(ee)}),C(m)},R.prototype.values=function(){var m=[];return this.forEach(function(P){m.push(P)}),C(m)},R.prototype.entries=function(){var m=[];return this.forEach(function(P,ee){m.push([ee,P])}),C(m)},f.iterable&&(R.prototype[Symbol.iterator]=R.prototype.entries);function B(m){if(m.bodyUsed)return Promise.reject(new TypeError("Already read"));m.bodyUsed=!0}function K(m){return new Promise(function(P,ee){m.onload=function(){P(m.result)},m.onerror=function(){ee(m.error)}})}function se(m){var P=new FileReader,ee=K(P);return P.readAsArrayBuffer(m),ee}function $(m){var P=new FileReader,ee=K(P);return P.readAsText(m),ee}function U(m){for(var P=new Uint8Array(m),ee=new Array(P.length),Q=0;Q<P.length;Q++)ee[Q]=String.fromCharCode(P[Q]);return ee.join("")}function x(m){if(m.slice)return m.slice(0);var P=new Uint8Array(m.byteLength);return P.set(new Uint8Array(m)),P.buffer}function T(){return this.bodyUsed=!1,this._initBody=function(m){this._bodyInit=m,m?typeof m=="string"?this._bodyText=m:f.blob&&Blob.prototype.isPrototypeOf(m)?this._bodyBlob=m:f.formData&&FormData.prototype.isPrototypeOf(m)?this._bodyFormData=m:f.searchParams&&URLSearchParams.prototype.isPrototypeOf(m)?this._bodyText=m.toString():f.arrayBuffer&&f.blob&&v(m)?(this._bodyArrayBuffer=x(m.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):f.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(m)||w(m))?this._bodyArrayBuffer=x(m):this._bodyText=m=Object.prototype.toString.call(m):this._bodyText="",this.headers.get("content-type")||(typeof m=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):f.searchParams&&URLSearchParams.prototype.isPrototypeOf(m)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},f.blob&&(this.blob=function(){var m=B(this);if(m)return m;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?B(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(se)}),this.text=function(){var m=B(this);if(m)return m;if(this._bodyBlob)return $(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(U(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},f.formData&&(this.formData=function(){return this.text().then(G)}),this.json=function(){return this.text().then(JSON.parse)},this}var E=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function h(m){var P=m.toUpperCase();return E.indexOf(P)>-1?P:m}function b(m,P){P=P||{};var ee=P.body;if(m instanceof b){if(m.bodyUsed)throw new TypeError("Already read");this.url=m.url,this.credentials=m.credentials,P.headers||(this.headers=new R(m.headers)),this.method=m.method,this.mode=m.mode,this.signal=m.signal,!ee&&m._bodyInit!=null&&(ee=m._bodyInit,m.bodyUsed=!0)}else this.url=String(m);if(this.credentials=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new R(P.headers)),this.method=h(P.method||this.method||"GET"),this.mode=P.mode||this.mode||null,this.signal=P.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&ee)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(ee)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})};function G(m){var P=new FormData;return m.trim().split("&").forEach(function(ee){if(ee){var Q=ee.split("="),V=Q.shift().replace(/\+/g," "),k=Q.join("=").replace(/\+/g," ");P.append(decodeURIComponent(V),decodeURIComponent(k))}}),P}function Y(m){var P=new R,ee=m.replace(/\r?\n[\t ]+/g," ");return ee.split(/\r?\n/).forEach(function(Q){var V=Q.split(":"),k=V.shift().trim();if(k){var J=V.join(":").trim();P.append(k,J)}}),P}T.call(b.prototype);function ie(m,P){P||(P={}),this.type="default",this.status=P.status===void 0?200:P.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in P?P.statusText:"OK",this.headers=new R(P.headers),this.url=P.url||"",this._initBody(m)}T.call(ie.prototype),ie.prototype.clone=function(){return new ie(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new R(this.headers),url:this.url})},ie.error=function(){var m=new ie(null,{status:0,statusText:""});return m.type="error",m};var ce=[301,302,303,307,308];ie.redirect=function(m,P){if(ce.indexOf(P)===-1)throw new RangeError("Invalid status code");return new ie(null,{status:P,headers:{location:m}})},u.DOMException=a.DOMException;try{new u.DOMException}catch{u.DOMException=function(P,ee){this.message=P,this.name=ee;var Q=Error(P);this.stack=Q.stack},u.DOMException.prototype=Object.create(Error.prototype),u.DOMException.prototype.constructor=u.DOMException}function de(m,P){return new Promise(function(ee,Q){var V=new b(m,P);if(V.signal&&V.signal.aborted)return Q(new u.DOMException("Aborted","AbortError"));var k=new XMLHttpRequest;function J(){k.abort()}k.onload=function(){var re={status:k.status,statusText:k.statusText,headers:Y(k.getAllResponseHeaders()||"")};re.url="responseURL"in k?k.responseURL:re.headers.get("X-Request-URL");var me="response"in k?k.response:k.responseText;ee(new ie(me,re))},k.onerror=function(){Q(new TypeError("Network request failed"))},k.ontimeout=function(){Q(new TypeError("Network request failed"))},k.onabort=function(){Q(new u.DOMException("Aborted","AbortError"))},k.open(V.method,V.url,!0),V.credentials==="include"?k.withCredentials=!0:V.credentials==="omit"&&(k.withCredentials=!1),"responseType"in k&&f.blob&&(k.responseType="blob"),V.headers.forEach(function(re,me){k.setRequestHeader(me,re)}),V.signal&&(V.signal.addEventListener("abort",J),k.onreadystatechange=function(){k.readyState===4&&V.signal.removeEventListener("abort",J)}),k.send(typeof V._bodyInit>"u"?null:V._bodyInit)})}return de.polyfill=!0,a.fetch||(a.fetch=de,a.Headers=R,a.Request=b,a.Response=ie),u.Headers=R,u.Request=b,u.Response=ie,u.fetch=de,Object.defineProperty(u,"__esModule",{value:!0}),u})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var o=i;e=o.fetch,e.default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,r.exports=e})(jc,jc.exports);var Sd=qg(jc.exports);const xd={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},Od=10;class Cn{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new Yt.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!Rf(e))throw new 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 new Error("Connection already closed");this.onClose()}async send(e,t){this.isAvailable||await this.register();try{const i=ls(e),a=await(await Sd(this.url,Object.assign(Object.assign({},xd),{body:i}))).json();this.onPayload({data:a})}catch(i){this.onError(e.id,i)}}async register(e=this.url){if(!Rf(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,o)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),o(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return o(new Error("HTTP connection is missing or invalid"));i()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=ls({id:1,jsonrpc:"2.0",method:"test",params:[]});await Sd(e,Object.assign(Object.assign({},xd),{body:t}))}this.onOpen()}catch(t){const i=this.parseError(t);throw this.events.emit("register_error",i),this.onClose(),i}}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;const t=typeof e.data=="string"?vc(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),o=i.message||i.toString(),a=oo(e,o);this.events.emit("payload",a)}parseError(e,t=this.url){return xf(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>Od&&this.events.setMaxListeners(Od)}}const Id="error",Q3="wss://relay.walletconnect.com",X3="wc",Z3="universal_provider",Pd=`${X3}@2:${Z3}:`,e2="https://rpc.walletconnect.com/v1/",dn={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var ms=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Mc={exports:{}};/**
72
+ ***************************************************************************** */var _c=function(n,e){return _c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var o in i)i.hasOwnProperty(o)&&(t[o]=i[o])},_c(n,e)};function xm(n,e){_c(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var bc=function(){return bc=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++){t=arguments[i];for(var c in t)Object.prototype.hasOwnProperty.call(t,c)&&(e[c]=t[c])}return e},bc.apply(this,arguments)};function Om(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,i=Object.getOwnPropertySymbols(n);o<i.length;o++)e.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(n,i[o])&&(t[i[o]]=n[i[o]]);return t}function Im(n,e,t,i){var o=arguments.length,c=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(n,e,t,i);else for(var f=n.length-1;f>=0;f--)(u=n[f])&&(c=(o<3?u(c):o>3?u(e,t,c):u(e,t))||c);return o>3&&c&&Object.defineProperty(e,t,c),c}function Pm(n,e){return function(t,i){e(t,i,n)}}function Cm(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function Am(n,e,t,i){function o(c){return c instanceof t?c:new t(function(u){u(c)})}return new(t||(t=Promise))(function(c,u){function f(w){try{p(i.next(w))}catch(I){u(I)}}function v(w){try{p(i.throw(w))}catch(I){u(I)}}function p(w){w.done?c(w.value):o(w.value).then(f,v)}p((i=i.apply(n,e||[])).next())})}function Tm(n,e){var t={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},i,o,c,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(p){return function(w){return v([p,w])}}function v(p){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,o&&(c=p[0]&2?o.return:p[0]?o.throw||((c=o.return)&&c.call(o),0):o.next)&&!(c=c.call(o,p[1])).done)return c;switch(o=0,c&&(p=[p[0]&2,c.value]),p[0]){case 0:case 1:c=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,o=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(c=t.trys,!(c=c.length>0&&c[c.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!c||p[1]>c[0]&&p[1]<c[3])){t.label=p[1];break}if(p[0]===6&&t.label<c[1]){t.label=c[1],c=p;break}if(c&&t.label<c[2]){t.label=c[2],t.ops.push(p);break}c[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(n,t)}catch(w){p=[6,w],o=0}finally{i=c=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function Rm(n,e,t,i){i===void 0&&(i=t),n[i]=e[t]}function Nm(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function mc(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],i=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Of(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var i=t.call(n),o,c=[],u;try{for(;(e===void 0||e-- >0)&&!(o=i.next()).done;)c.push(o.value)}catch(f){u={error:f}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(u)throw u.error}}return c}function $m(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(Of(arguments[e]));return n}function Fm(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var i=Array(n),o=0,e=0;e<t;e++)for(var c=arguments[e],u=0,f=c.length;u<f;u++,o++)i[o]=c[u];return i}function fs(n){return this instanceof fs?(this.v=n,this):new fs(n)}function Lm(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(n,e||[]),o,c=[];return o={},u("next"),u("throw"),u("return"),o[Symbol.asyncIterator]=function(){return this},o;function u(S){i[S]&&(o[S]=function(C){return new Promise(function(R,B){c.push([S,C,R,B])>1||f(S,C)})})}function f(S,C){try{v(i[S](C))}catch(R){I(c[0][3],R)}}function v(S){S.value instanceof fs?Promise.resolve(S.value.v).then(p,w):I(c[0][2],S)}function p(S){f("next",S)}function w(S){f("throw",S)}function I(S,C){S(C),c.shift(),c.length&&f(c[0][0],c[0][1])}}function Um(n){var e,t;return e={},i("next"),i("throw",function(o){throw o}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(o,c){e[o]=n[o]?function(u){return(t=!t)?{value:fs(n[o](u)),done:o==="return"}:c?c(u):u}:c}}function jm(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof mc=="function"?mc(n):n[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(c){t[c]=n[c]&&function(u){return new Promise(function(f,v){u=n[c](u),o(f,v,u.done,u.value)})}}function o(c,u,f,v){Promise.resolve(v).then(function(p){c({value:p,done:f})},u)}}function Mm(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function qm(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)Object.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e.default=n,e}function Hm(n){return n&&n.__esModule?n:{default:n}}function Bm(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function zm(n,e,t){if(!e.has(n))throw new TypeError("attempted to set private field on non-instance");return e.set(n,t),t}var Km=Object.freeze({__proto__:null,__extends:xm,get __assign(){return bc},__rest:Om,__decorate:Im,__param:Pm,__metadata:Cm,__awaiter:Am,__generator:Tm,__createBinding:Rm,__exportStar:Nm,__values:mc,__read:Of,__spread:$m,__spreadArrays:Fm,__await:fs,__asyncGenerator:Lm,__asyncDelegator:Um,__asyncValues:jm,__makeTemplateObject:Mm,__importStar:qm,__importDefault:Hm,__classPrivateFieldGet:Bm,__classPrivateFieldSet:zm}),Vm=Hn(Km),on={},If;function km(){if(If)return on;If=1,Object.defineProperty(on,"__esModule",{value:!0}),on.isBrowserCryptoAvailable=on.getSubtleCrypto=on.getBrowerCrypto=void 0;function n(){return Vt?.crypto||Vt?.msCrypto||{}}on.getBrowerCrypto=n;function e(){const i=n();return i.subtle||i.webkitSubtle}on.getSubtleCrypto=e;function t(){return!!n()&&!!e()}return on.isBrowserCryptoAvailable=t,on}var an={},Pf;function Gm(){if(Pf)return an;Pf=1,Object.defineProperty(an,"__esModule",{value:!0}),an.isBrowser=an.isNode=an.isReactNative=void 0;function n(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}an.isReactNative=n;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}an.isNode=e;function t(){return!n()&&!e()}return an.isBrowser=t,an}(function(n){Object.defineProperty(n,"__esModule",{value:!0});const e=Vm;e.__exportStar(km(),n),e.__exportStar(Gm(),n)})(xf);function wc(n=3){const e=Date.now()*Math.pow(10,n),t=Math.floor(Math.random()*Math.pow(10,n));return e+t}function Cf(n=6){return BigInt(wc(n))}function wi(n,e,t){return{id:t||wc(),jsonrpc:"2.0",method:n,params:e}}function Ec(n,e){return{id:n,jsonrpc:"2.0",result:e}}function so(n,e,t){return{id:n,jsonrpc:"2.0",error:Wm(e,t)}}function Wm(n,e){return typeof n>"u"?Df(wf):(typeof n=="string"&&(n=Object.assign(Object.assign({},Df(yc)),{message:n})),typeof e<"u"&&(n.data=e),Dm(n.code)&&(n=Sm(n.code)),n)}class Ym{}class Jm extends Ym{constructor(){super()}}class Qm extends Jm{constructor(e){super()}}const Xm="^https?:",Zm="^wss?:";function ew(n){const e=n.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Af(n,e){const t=ew(n);return typeof t>"u"?!1:new RegExp(e).test(t)}function Tf(n){return Af(n,Xm)}function Rf(n){return Af(n,Zm)}function tw(n){return new RegExp("wss?://localhost(:d{2,5})?").test(n)}function Nf(n){return typeof n=="object"&&"id"in n&&"jsonrpc"in n&&n.jsonrpc==="2.0"}function Dc(n){return Nf(n)&&"method"in n}function oo(n){return Nf(n)&&(cn(n)||Br(n))}function cn(n){return"result"in n}function Br(n){return"error"in n}class un extends Qm{constructor(e){super(e),this.events=new Yt.exports.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(wi(e.method,e.params||[],e.id||Cf().toString()),t)}async requestStrict(e,t){return new Promise(async(i,o)=>{if(!this.connection.connected)try{await this.open()}catch(c){o(c)}this.events.on(`${e.id}`,c=>{Br(c)?o(c.error):i(c.result)});try{await this.connection.send(e,t)}catch(c){o(c)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),oo(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new 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(),typeof e=="string"&&(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)}}const rw=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),nw=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",$f=n=>n.split("?")[0],Ff=10,iw=rw();class sw{constructor(e){if(this.url=e,this.events=new Yt.exports.EventEmitter,this.registering=!1,!Rf(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}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)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e,t){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(hs(e))}catch(i){this.onError(e.id,i)}}register(e=this.url){if(!Rf(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,o)=>{this.events.once("register_error",c=>{this.resetMaxListeners(),o(c)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return o(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{const o=xf.isReactNative()?void 0:{rejectUnauthorized:!tw(e)},c=new iw(e,[],o);nw()?c.onerror=u=>{const f=u;i(this.emitError(f.error))}:c.on("error",u=>{i(this.emitError(u))}),c.onopen=()=>{this.onOpen(c),t(c)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=t=>this.onClose(t),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;const t=typeof e.data=="string"?gc(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),o=i.message||i.toString(),c=so(e,o);this.events.emit("payload",c)}parseError(e,t=this.url){return Sf(e,$f(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>Ff&&this.events.setMaxListeners(Ff)}emitError(e){const t=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${$f(this.url)}`));return this.events.emit("register_error",t),t}}var Sc={exports:{}};(function(n,e){var t=200,i="__lodash_hash_undefined__",o=1,c=2,u=9007199254740991,f="[object Arguments]",v="[object Array]",p="[object AsyncFunction]",w="[object Boolean]",I="[object Date]",S="[object Error]",C="[object Function]",R="[object GeneratorFunction]",B="[object Map]",K="[object Number]",se="[object Null]",$="[object Object]",U="[object Promise]",x="[object Proxy]",T="[object RegExp]",E="[object Set]",h="[object String]",b="[object Symbol]",G="[object Undefined]",Y="[object WeakMap]",ie="[object ArrayBuffer]",ce="[object DataView]",de="[object Float32Array]",m="[object Float64Array]",P="[object Int8Array]",ee="[object Int16Array]",Q="[object Int32Array]",V="[object Uint8Array]",k="[object Uint8ClampedArray]",J="[object Uint16Array]",re="[object Uint32Array]",me=/[\\^$.*+?()[\]{}|]/g,oe=/^\[object .+?Constructor\]$/,we=/^(?:0|[1-9]\d*)$/,le={};le[de]=le[m]=le[P]=le[ee]=le[Q]=le[V]=le[k]=le[J]=le[re]=!0,le[f]=le[v]=le[ie]=le[w]=le[ce]=le[I]=le[S]=le[C]=le[B]=le[K]=le[$]=le[T]=le[E]=le[h]=le[Y]=!1;var _e=typeof Vt=="object"&&Vt&&Vt.Object===Object&&Vt,H=typeof self=="object"&&self&&self.Object===Object&&self,q=_e||H||Function("return this")(),F=e&&!e.nodeType&&e,d=F&&!0&&n&&!n.nodeType&&n,A=d&&d.exports===F,ae=A&&_e.process,fe=function(){try{return ae&&ae.binding&&ae.binding("util")}catch{}}(),xe=fe&&fe.isTypedArray;function Be(D,L){for(var te=-1,pe=D==null?0:D.length,ct=0,Te=[];++te<pe;){var dt=D[te];L(dt,te,D)&&(Te[ct++]=dt)}return Te}function Ve(D,L){for(var te=-1,pe=L.length,ct=D.length;++te<pe;)D[ct+te]=L[te];return D}function Ue(D,L){for(var te=-1,pe=D==null?0:D.length;++te<pe;)if(L(D[te],te,D))return!0;return!1}function vt(D,L){for(var te=-1,pe=Array(D);++te<D;)pe[te]=L(te);return pe}function yt(D){return function(L){return D(L)}}function Me(D,L){return D.has(L)}function Oe(D,L){return D?.[L]}function $e(D){var L=-1,te=Array(D.size);return D.forEach(function(pe,ct){te[++L]=[ct,pe]}),te}function Fe(D,L){return function(te){return D(L(te))}}function qe(D){var L=-1,te=Array(D.size);return D.forEach(function(pe){te[++L]=pe}),te}var Pe=Array.prototype,Le=Function.prototype,Se=Object.prototype,Ce=q["__core-js_shared__"],ze=Le.toString,Ie=Se.hasOwnProperty,ke=function(){var D=/[^.]+$/.exec(Ce&&Ce.keys&&Ce.keys.IE_PROTO||"");return D?"Symbol(src)_1."+D:""}(),We=Se.toString,et=RegExp("^"+ze.call(Ie).replace(me,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),tt=A?q.Buffer:void 0,Qe=q.Symbol,ar=q.Uint8Array,vr=Se.propertyIsEnumerable,Zr=Pe.splice,cr=Qe?Qe.toStringTag:void 0,dn=Object.getOwnPropertySymbols,An=tt?tt.isBuffer:void 0,Qn=Fe(Object.keys,Object),Dt=Sr(q,"DataView"),_t=Sr(q,"Map"),St=Sr(q,"Promise"),xt=Sr(q,"Set"),wt=Sr(q,"WeakMap"),bt=Sr(Object,"create"),Lt=gn(Dt),Ut=gn(_t),Ot=gn(St),jt=gn(xt),It=gn(wt),Tt=Qe?Qe.prototype:void 0,Pt=Tt?Tt.valueOf:void 0;function ft(D){var L=-1,te=D==null?0:D.length;for(this.clear();++L<te;){var pe=D[L];this.set(pe[0],pe[1])}}function Mt(){this.__data__=bt?bt(null):{},this.size=0}function qt(D){var L=this.has(D)&&delete this.__data__[D];return this.size-=L?1:0,L}function Kc(D){var L=this.__data__;if(bt){var te=L[D];return te===i?void 0:te}return Ie.call(L,D)?L[D]:void 0}function Vc(D){var L=this.__data__;return bt?L[D]!==void 0:Ie.call(L,D)}function kc(D,L){var te=this.__data__;return this.size+=this.has(D)?0:1,te[D]=bt&&L===void 0?i:L,this}ft.prototype.clear=Mt,ft.prototype.delete=qt,ft.prototype.get=Kc,ft.prototype.has=Vc,ft.prototype.set=kc;function Tr(D){var L=-1,te=D==null?0:D.length;for(this.clear();++L<te;){var pe=D[L];this.set(pe[0],pe[1])}}function Gc(){this.__data__=[],this.size=0}function Wc(D){var L=this.__data__,te=Xn(L,D);if(te<0)return!1;var pe=L.length-1;return te==pe?L.pop():Zr.call(L,te,1),--this.size,!0}function Yc(D){var L=this.__data__,te=Xn(L,D);return te<0?void 0:L[te][1]}function Jc(D){return Xn(this.__data__,D)>-1}function Qc(D,L){var te=this.__data__,pe=Xn(te,D);return pe<0?(++this.size,te.push([D,L])):te[pe][1]=L,this}Tr.prototype.clear=Gc,Tr.prototype.delete=Wc,Tr.prototype.get=Yc,Tr.prototype.has=Jc,Tr.prototype.set=Qc;function pn(D){var L=-1,te=D==null?0:D.length;for(this.clear();++L<te;){var pe=D[L];this.set(pe[0],pe[1])}}function Di(){this.size=0,this.__data__={hash:new ft,map:new(_t||Tr),string:new ft}}function Xc(D){var L=Tn(this,D).delete(D);return this.size-=L?1:0,L}function Si(D){return Tn(this,D).get(D)}function Zc(D){return Tn(this,D).has(D)}function eu(D,L){var te=Tn(this,D),pe=te.size;return te.set(D,L),this.size+=te.size==pe?0:1,this}pn.prototype.clear=Di,pn.prototype.delete=Xc,pn.prototype.get=Si,pn.prototype.has=Zc,pn.prototype.set=eu;function xi(D){var L=-1,te=D==null?0:D.length;for(this.__data__=new pn;++L<te;)this.add(D[L])}function yo(D){return this.__data__.set(D,i),this}function _o(D){return this.__data__.has(D)}xi.prototype.add=xi.prototype.push=yo,xi.prototype.has=_o;function Kr(D){var L=this.__data__=new Tr(D);this.size=L.size}function tu(){this.__data__=new Tr,this.size=0}function ru(D){var L=this.__data__,te=L.delete(D);return this.size=L.size,te}function nu(D){return this.__data__.get(D)}function iu(D){return this.__data__.has(D)}function bo(D,L){var te=this.__data__;if(te instanceof Tr){var pe=te.__data__;if(!_t||pe.length<t-1)return pe.push([D,L]),this.size=++te.size,this;te=this.__data__=new pn(pe)}return te.set(D,L),this.size=te.size,this}Kr.prototype.clear=tu,Kr.prototype.delete=ru,Kr.prototype.get=nu,Kr.prototype.has=iu,Kr.prototype.set=bo;function mo(D,L){var te=Pi(D),pe=!te&&Ro(D),ct=!te&&!pe&&Ds(D),Te=!te&&!pe&&!ct&&Fo(D),dt=te||pe||ct||Te,Ht=dt?vt(D.length,String):[],Xe=Ht.length;for(var ut in D)(L||Ie.call(D,ut))&&!(dt&&(ut=="length"||ct&&(ut=="offset"||ut=="parent")||Te&&(ut=="buffer"||ut=="byteLength"||ut=="byteOffset")||Io(ut,Xe)))&&Ht.push(ut);return Ht}function Xn(D,L){for(var te=D.length;te--;)if(To(D[te][0],L))return te;return-1}function ws(D,L,te){var pe=L(D);return Pi(D)?pe:Ve(pe,te(D))}function Zn(D){return D==null?D===void 0?G:se:cr&&cr in Object(D)?xo(D):au(D)}function Es(D){return ti(D)&&Zn(D)==f}function ei(D,L,te,pe,ct){return D===L?!0:D==null||L==null||!ti(D)&&!ti(L)?D!==D&&L!==L:wo(D,L,te,pe,ei,ct)}function wo(D,L,te,pe,ct,Te){var dt=Pi(D),Ht=Pi(L),Xe=dt?v:en(D),ut=Ht?v:en(L);Xe=Xe==f?$:Xe,ut=ut==f?$:ut;var Rt=Xe==$,yr=ut==$,Bt=Xe==ut;if(Bt&&Ds(D)){if(!Ds(L))return!1;dt=!0,Rt=!1}if(Bt&&!Rt)return Te||(Te=new Kr),dt||Fo(D)?Oi(D,L,te,pe,ct,Te):ou(D,L,Xe,te,pe,ct,Te);if(!(te&o)){var pt=Rt&&Ie.call(D,"__wrapped__"),ur=yr&&Ie.call(L,"__wrapped__");if(pt||ur){var Vr=pt?D.value():D,Rr=ur?L.value():L;return Te||(Te=new Kr),ct(Vr,Rr,te,pe,Te)}}return Bt?(Te||(Te=new Kr),So(D,L,te,pe,ct,Te)):!1}function su(D){if(!$o(D)||Co(D))return!1;var L=Ci(D)?et:oe;return L.test(gn(D))}function Eo(D){return ti(D)&&No(D.length)&&!!le[Zn(D)]}function Do(D){if(!Ao(D))return Qn(D);var L=[];for(var te in Object(D))Ie.call(D,te)&&te!="constructor"&&L.push(te);return L}function Oi(D,L,te,pe,ct,Te){var dt=te&o,Ht=D.length,Xe=L.length;if(Ht!=Xe&&!(dt&&Xe>Ht))return!1;var ut=Te.get(D);if(ut&&Te.get(L))return ut==L;var Rt=-1,yr=!0,Bt=te&c?new xi:void 0;for(Te.set(D,L),Te.set(L,D);++Rt<Ht;){var pt=D[Rt],ur=L[Rt];if(pe)var Vr=dt?pe(ur,pt,Rt,L,D,Te):pe(pt,ur,Rt,D,L,Te);if(Vr!==void 0){if(Vr)continue;yr=!1;break}if(Bt){if(!Ue(L,function(Rr,tn){if(!Me(Bt,tn)&&(pt===Rr||ct(pt,Rr,te,pe,Te)))return Bt.push(tn)})){yr=!1;break}}else if(!(pt===ur||ct(pt,ur,te,pe,Te))){yr=!1;break}}return Te.delete(D),Te.delete(L),yr}function ou(D,L,te,pe,ct,Te,dt){switch(te){case ce:if(D.byteLength!=L.byteLength||D.byteOffset!=L.byteOffset)return!1;D=D.buffer,L=L.buffer;case ie:return!(D.byteLength!=L.byteLength||!Te(new ar(D),new ar(L)));case w:case I:case K:return To(+D,+L);case S:return D.name==L.name&&D.message==L.message;case T:case h:return D==L+"";case B:var Ht=$e;case E:var Xe=pe&o;if(Ht||(Ht=qe),D.size!=L.size&&!Xe)return!1;var ut=dt.get(D);if(ut)return ut==L;pe|=c,dt.set(D,L);var Rt=Oi(Ht(D),Ht(L),pe,ct,Te,dt);return dt.delete(D),Rt;case b:if(Pt)return Pt.call(D)==Pt.call(L)}return!1}function So(D,L,te,pe,ct,Te){var dt=te&o,Ht=Ii(D),Xe=Ht.length,ut=Ii(L),Rt=ut.length;if(Xe!=Rt&&!dt)return!1;for(var yr=Xe;yr--;){var Bt=Ht[yr];if(!(dt?Bt in L:Ie.call(L,Bt)))return!1}var pt=Te.get(D);if(pt&&Te.get(L))return pt==L;var ur=!0;Te.set(D,L),Te.set(L,D);for(var Vr=dt;++yr<Xe;){Bt=Ht[yr];var Rr=D[Bt],tn=L[Bt];if(pe)var Ss=dt?pe(tn,Rr,Bt,L,D,Te):pe(Rr,tn,Bt,D,L,Te);if(!(Ss===void 0?Rr===tn||ct(Rr,tn,te,pe,Te):Ss)){ur=!1;break}Vr||(Vr=Bt=="constructor")}if(ur&&!Vr){var ri=D.constructor,Gt=L.constructor;ri!=Gt&&"constructor"in D&&"constructor"in L&&!(typeof ri=="function"&&ri instanceof ri&&typeof Gt=="function"&&Gt instanceof Gt)&&(ur=!1)}return Te.delete(D),Te.delete(L),ur}function Ii(D){return ws(D,hu,Oo)}function Tn(D,L){var te=D.__data__;return Po(L)?te[typeof L=="string"?"string":"hash"]:te.map}function Sr(D,L){var te=Oe(D,L);return su(te)?te:void 0}function xo(D){var L=Ie.call(D,cr),te=D[cr];try{D[cr]=void 0;var pe=!0}catch{}var ct=We.call(D);return pe&&(L?D[cr]=te:delete D[cr]),ct}var Oo=dn?function(D){return D==null?[]:(D=Object(D),Be(dn(D),function(L){return vr.call(D,L)}))}:at,en=Zn;(Dt&&en(new Dt(new ArrayBuffer(1)))!=ce||_t&&en(new _t)!=B||St&&en(St.resolve())!=U||xt&&en(new xt)!=E||wt&&en(new wt)!=Y)&&(en=function(D){var L=Zn(D),te=L==$?D.constructor:void 0,pe=te?gn(te):"";if(pe)switch(pe){case Lt:return ce;case Ut:return B;case Ot:return U;case jt:return E;case It:return Y}return L});function Io(D,L){return L=L??u,!!L&&(typeof D=="number"||we.test(D))&&D>-1&&D%1==0&&D<L}function Po(D){var L=typeof D;return L=="string"||L=="number"||L=="symbol"||L=="boolean"?D!=="__proto__":D===null}function Co(D){return!!ke&&ke in D}function Ao(D){var L=D&&D.constructor,te=typeof L=="function"&&L.prototype||Se;return D===te}function au(D){return We.call(D)}function gn(D){if(D!=null){try{return ze.call(D)}catch{}try{return D+""}catch{}}return""}function To(D,L){return D===L||D!==D&&L!==L}var Ro=Es(function(){return arguments}())?Es:function(D){return ti(D)&&Ie.call(D,"callee")&&!vr.call(D,"callee")},Pi=Array.isArray;function cu(D){return D!=null&&No(D.length)&&!Ci(D)}var Ds=An||ot;function uu(D,L){return ei(D,L)}function Ci(D){if(!$o(D))return!1;var L=Zn(D);return L==C||L==R||L==p||L==x}function No(D){return typeof D=="number"&&D>-1&&D%1==0&&D<=u}function $o(D){var L=typeof D;return D!=null&&(L=="object"||L=="function")}function ti(D){return D!=null&&typeof D=="object"}var Fo=xe?yt(xe):Eo;function hu(D){return cu(D)?mo(D):Do(D)}function at(){return[]}function ot(){return!1}n.exports=uu})(Sc,Sc.exports);var ow=Sc.exports;function aw(n,e){if(n.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var o=0;o<n.length;o++){var c=n.charAt(o),u=c.charCodeAt(0);if(t[u]!==255)throw new TypeError(c+" is ambiguous");t[u]=o}var f=n.length,v=n.charAt(0),p=Math.log(f)/Math.log(256),w=Math.log(256)/Math.log(f);function I(R){if(R instanceof Uint8Array||(ArrayBuffer.isView(R)?R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength):Array.isArray(R)&&(R=Uint8Array.from(R))),!(R instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(R.length===0)return"";for(var B=0,K=0,se=0,$=R.length;se!==$&&R[se]===0;)se++,B++;for(var U=($-se)*w+1>>>0,x=new Uint8Array(U);se!==$;){for(var T=R[se],E=0,h=U-1;(T!==0||E<K)&&h!==-1;h--,E++)T+=256*x[h]>>>0,x[h]=T%f>>>0,T=T/f>>>0;if(T!==0)throw new Error("Non-zero carry");K=E,se++}for(var b=U-K;b!==U&&x[b]===0;)b++;for(var G=v.repeat(B);b<U;++b)G+=n.charAt(x[b]);return G}function S(R){if(typeof R!="string")throw new TypeError("Expected String");if(R.length===0)return new Uint8Array;var B=0;if(R[B]!==" "){for(var K=0,se=0;R[B]===v;)K++,B++;for(var $=(R.length-B)*p+1>>>0,U=new Uint8Array($);R[B];){var x=t[R.charCodeAt(B)];if(x===255)return;for(var T=0,E=$-1;(x!==0||T<se)&&E!==-1;E--,T++)x+=f*U[E]>>>0,U[E]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");se=T,B++}if(R[B]!==" "){for(var h=$-se;h!==$&&U[h]===0;)h++;for(var b=new Uint8Array(K+($-h)),G=K;h!==$;)b[G++]=U[h++];return b}}}function C(R){var B=S(R);if(B)return B;throw new Error(`Non-${e} character`)}return{encode:I,decodeUnsafe:S,decode:C}}var cw=aw,uw=cw;const Lf=n=>{if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")},hw=n=>new TextEncoder().encode(n),lw=n=>new TextDecoder().decode(n);class fw{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class dw{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Uf(this,e)}}class pw{constructor(e){this.decoders=e}or(e){return Uf(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Uf=(n,e)=>new pw({...n.decoders||{[n.prefix]:n},...e.decoders||{[e.prefix]:e}});class gw{constructor(e,t,i,o){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=o,this.encoder=new fw(e,t,i),this.decoder=new dw(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const ao=({name:n,prefix:e,encode:t,decode:i})=>new gw(n,e,t,i),ds=({prefix:n,name:e,alphabet:t})=>{const{encode:i,decode:o}=uw(t,e);return ao({prefix:n,name:e,encode:i,decode:c=>Lf(o(c))})},vw=(n,e,t,i)=>{const o={};for(let w=0;w<e.length;++w)o[e[w]]=w;let c=n.length;for(;n[c-1]==="=";)--c;const u=new Uint8Array(c*t/8|0);let f=0,v=0,p=0;for(let w=0;w<c;++w){const I=o[n[w]];if(I===void 0)throw new SyntaxError(`Non-${i} character`);v=v<<t|I,f+=t,f>=8&&(f-=8,u[p++]=255&v>>f)}if(f>=t||255&v<<8-f)throw new SyntaxError("Unexpected end of data");return u},yw=(n,e,t)=>{const i=e[e.length-1]==="=",o=(1<<t)-1;let c="",u=0,f=0;for(let v=0;v<n.length;++v)for(f=f<<8|n[v],u+=8;u>t;)u-=t,c+=e[o&f>>u];if(u&&(c+=e[o&f<<t-u]),i)for(;c.length*t&7;)c+="=";return c},Qt=({name:n,prefix:e,bitsPerChar:t,alphabet:i})=>ao({prefix:e,name:n,encode(o){return yw(o,i,t)},decode(o){return vw(o,i,t,n)}}),_w=ao({prefix:"\0",name:"identity",encode:n=>lw(n),decode:n=>hw(n)});var bw=Object.freeze({__proto__:null,identity:_w});const mw=Qt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ww=Object.freeze({__proto__:null,base2:mw});const Ew=Qt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Dw=Object.freeze({__proto__:null,base8:Ew});const Sw=ds({prefix:"9",name:"base10",alphabet:"0123456789"});var xw=Object.freeze({__proto__:null,base10:Sw});const Ow=Qt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Iw=Qt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Pw=Object.freeze({__proto__:null,base16:Ow,base16upper:Iw});const Cw=Qt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Aw=Qt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Tw=Qt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Rw=Qt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Nw=Qt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$w=Qt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Fw=Qt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Lw=Qt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Uw=Qt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var jw=Object.freeze({__proto__:null,base32:Cw,base32upper:Aw,base32pad:Tw,base32padupper:Rw,base32hex:Nw,base32hexupper:$w,base32hexpad:Fw,base32hexpadupper:Lw,base32z:Uw});const Mw=ds({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),qw=ds({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Hw=Object.freeze({__proto__:null,base36:Mw,base36upper:qw});const Bw=ds({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),zw=ds({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Kw=Object.freeze({__proto__:null,base58btc:Bw,base58flickr:zw});const Vw=Qt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),kw=Qt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Gw=Qt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ww=Qt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Yw=Object.freeze({__proto__:null,base64:Vw,base64pad:kw,base64url:Gw,base64urlpad:Ww});const jf=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Jw=jf.reduce((n,e,t)=>(n[t]=e,n),[]),Qw=jf.reduce((n,e,t)=>(n[e.codePointAt(0)]=t,n),[]);function Xw(n){return n.reduce((e,t)=>(e+=Jw[t],e),"")}function Zw(n){const e=[];for(const t of n){const i=Qw[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const eE=ao({prefix:"\u{1F680}",name:"base256emoji",encode:Xw,decode:Zw});var tE=Object.freeze({__proto__:null,base256emoji:eE}),rE=qf,Mf=128,nE=127,iE=~nE,sE=Math.pow(2,31);function qf(n,e,t){e=e||[],t=t||0;for(var i=t;n>=sE;)e[t++]=n&255|Mf,n/=128;for(;n&iE;)e[t++]=n&255|Mf,n>>>=7;return e[t]=n|0,qf.bytes=t-i+1,e}var oE=xc,aE=128,Hf=127;function xc(n,i){var t=0,i=i||0,o=0,c=i,u,f=n.length;do{if(c>=f)throw xc.bytes=0,new RangeError("Could not decode varint");u=n[c++],t+=o<28?(u&Hf)<<o:(u&Hf)*Math.pow(2,o),o+=7}while(u>=aE);return xc.bytes=c-i,t}var cE=Math.pow(2,7),uE=Math.pow(2,14),hE=Math.pow(2,21),lE=Math.pow(2,28),fE=Math.pow(2,35),dE=Math.pow(2,42),pE=Math.pow(2,49),gE=Math.pow(2,56),vE=Math.pow(2,63),yE=function(n){return n<cE?1:n<uE?2:n<hE?3:n<lE?4:n<fE?5:n<dE?6:n<pE?7:n<gE?8:n<vE?9:10},_E={encode:rE,decode:oE,encodingLength:yE},Bf=_E;const zf=(n,e,t=0)=>(Bf.encode(n,e,t),e),Kf=n=>Bf.encodingLength(n),Oc=(n,e)=>{const t=e.byteLength,i=Kf(n),o=i+Kf(t),c=new Uint8Array(o+t);return zf(n,c,0),zf(t,c,i),c.set(e,o),new bE(n,t,e,c)};class bE{constructor(e,t,i,o){this.code=e,this.size=t,this.digest=i,this.bytes=o}}const Vf=({name:n,code:e,encode:t})=>new mE(n,e,t);class mE{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Oc(this.code,t):t.then(i=>Oc(this.code,i))}else throw Error("Unknown type, must be binary type")}}const kf=n=>async e=>new Uint8Array(await crypto.subtle.digest(n,e)),wE=Vf({name:"sha2-256",code:18,encode:kf("SHA-256")}),EE=Vf({name:"sha2-512",code:19,encode:kf("SHA-512")});var DE=Object.freeze({__proto__:null,sha256:wE,sha512:EE});const Gf=0,SE="identity",Wf=Lf;var xE=Object.freeze({__proto__:null,identity:{code:Gf,name:SE,encode:Wf,digest:n=>Oc(Gf,Wf(n))}});new TextEncoder,new TextDecoder;const Yf={...bw,...ww,...Dw,...xw,...Pw,...jw,...Hw,...Kw,...Yw,...tE};({...DE,...xE});function Jf(n){return globalThis.Buffer!=null?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):n}function OE(n=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Jf(globalThis.Buffer.allocUnsafe(n)):new Uint8Array(n)}function Qf(n,e,t,i){return{name:n,prefix:e,encoder:{name:n,prefix:e,encode:t},decoder:{decode:i}}}const Xf=Qf("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),Ic=Qf("ascii","a",n=>{let e="a";for(let t=0;t<n.length;t++)e+=String.fromCharCode(n[t]);return e},n=>{n=n.substring(1);const e=OE(n.length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return e}),IE={utf8:Xf,"utf-8":Xf,hex:Yf.base16,latin1:Ic,ascii:Ic,binary:Ic,...Yf};function PE(n,e="utf8"){const t=IE[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Jf(globalThis.Buffer.from(n,"utf-8")):t.decoder.decode(`${t.prefix}${n}`)}const Zf="wc",CE=2,Pc="core",In=`${Zf}@2:${Pc}:`,AE={name:Pc,logger:"error"},TE={database:":memory:"},RE="crypto",ed="client_ed25519_seed",NE=ye.ONE_DAY,$E="keychain",FE="0.3",LE="messages",UE="0.3",jE=ye.SIX_HOURS,ME="publisher",td="irn",qE="error",rd="wss://relay.walletconnect.com",nd="wss://relay.walletconnect.org",HE="relayer",er={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},BE="_subscription",hn={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},zE=ye.ONE_SECOND,KE="2.10.4",VE=1e4,kE="0.3",GE="WALLETCONNECT_CLIENT_ID",zr={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},WE="subscription",YE="0.3",JE=ye.FIVE_SECONDS*1e3,QE="pairing",XE="0.3",ps={wc_pairingDelete:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:0},res:{ttl:ye.ONE_DAY,prompt:!1,tag:0}}},gs={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Xr={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},ZE="history",e3="0.3",t3="expirer",Ar={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},r3="0.3",Cc="verify-api",Ei="https://verify.walletconnect.com",Ac="https://verify.walletconnect.org",n3=[Ei,Ac];class i3{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=$E,this.version=FE,this.initialized=!1,this.storagePrefix=In,this.init=async()=>{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,o)=>{this.isInitialized(),this.keychain.set(i,o),await this.persist()},this.get=i=>{this.isInitialized();const o=this.keychain.get(i);if(typeof o>"u"){const{message:c}=he("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(c)}return o},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=Je.generateChildLogger(t,this.name)}get context(){return Je.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Nl(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?$l(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}}class s3{constructor(e,t,i){this.core=e,this.logger=t,this.name=RE,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=o=>(this.isInitialized(),this.keychain.has(o)),this.getClientId=async()=>{this.isInitialized();const o=await this.getClientSeed(),c=mf(o);return bf(c.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const o=c_();return this.setPrivateKey(o.publicKey,o.privateKey)},this.signJWT=async o=>{this.isInitialized();const c=await this.getClientSeed(),u=mf(c),f=Wa();return await ym(f,o,NE,u)},this.generateSharedKey=(o,c,u)=>{this.isInitialized();const f=this.getPrivateKey(o),v=u_(f,c);return this.setSymKey(v,u)},this.setSymKey=async(o,c)=>{this.isInitialized();const u=c||h_(o);return await this.keychain.set(u,o),u},this.deleteKeyPair=async o=>{this.isInitialized(),await this.keychain.del(o)},this.deleteSymKey=async o=>{this.isInitialized(),await this.keychain.del(o)},this.encode=async(o,c,u)=>{this.isInitialized();const f=Pl(u),v=hs(c);if(Cl(f)){const S=f.senderPublicKey,C=f.receiverPublicKey;o=await this.generateSharedKey(S,C)}const p=this.getSymKey(o),{type:w,senderPublicKey:I}=f;return f_({type:w,symKey:p,message:v,senderPublicKey:I})},this.decode=async(o,c,u)=>{this.isInitialized();const f=g_(c,u);if(Cl(f)){const v=f.receiverPublicKey,p=f.senderPublicKey;o=await this.generateSharedKey(v,p)}try{const v=this.getSymKey(o),p=d_({symKey:v,encoded:c});return gc(p)}catch(v){this.logger.error(`Failed to decode message from topic: '${o}', clientId: '${await this.getClientId()}'`),this.logger.error(v)}},this.getPayloadType=o=>{const c=Qs(o);return Yi(c.type)},this.getPayloadSenderPublicKey=o=>{const c=Qs(o);return c.senderPublicKey?nr(c.senderPublicKey,ir):void 0},this.core=e,this.logger=Je.generateChildLogger(t,this.name),this.keychain=i||new i3(this.core,this.logger)}get context(){return Je.getLoggerContext(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(ed)}catch{e=Wa(),await this.keychain.set(ed,e)}return PE(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}}class o3 extends Gb{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=LE,this.version=UE,this.initialized=!1,this.storagePrefix=In,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,o)=>{this.isInitialized();const c=gi(o);let u=this.messages.get(i);return typeof u>"u"&&(u={}),typeof u[c]<"u"||(u[c]=o,this.messages.set(i,u),await this.persist()),c},this.get=i=>{this.isInitialized();let o=this.messages.get(i);return typeof o>"u"&&(o={}),o},this.has=(i,o)=>{this.isInitialized();const c=this.get(i),u=gi(o);return typeof c[u]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=Je.generateChildLogger(e,this.name),this.core=t}get context(){return Je.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Nl(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?$l(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}}class a3 extends Wb{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new Yt.exports.EventEmitter,this.name=ME,this.queue=new Map,this.publishTimeout=ye.toMiliseconds(ye.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(i,o,c)=>{var u;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:o,opts:c}});try{const f=c?.ttl||jE,v=Qa(c),p=c?.prompt||!1,w=c?.tag||0,I=c?.id||Cf().toString(),S={topic:i,message:o,opts:{ttl:f,relay:v,prompt:p,tag:w,id:I}},C=setTimeout(()=>this.queue.set(I,S),this.publishTimeout);try{await await Zi(this.rpcPublish(i,o,f,v,p,w,I),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(I),this.relayer.events.emit(er.publish,S)}catch(R){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(u=c?.internal)!=null&&u.throwOnFailedPublish)throw this.removeRequestFromQueue(I),R;return}finally{clearTimeout(C)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:o,opts:c}})}catch(f){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(f),f}},this.on=(i,o)=>{this.events.on(i,o)},this.once=(i,o)=>{this.events.once(i,o)},this.off=(i,o)=>{this.events.off(i,o)},this.removeListener=(i,o)=>{this.events.removeListener(i,o)},this.relayer=e,this.logger=Je.generateChildLogger(t,this.name),this.registerEventListeners()}get context(){return Je.getLoggerContext(this.logger)}rpcPublish(e,t,i,o,c,u,f){var v,p,w,I;const S={method:Xs(o.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:c,tag:u},id:f};return sr((v=S.params)==null?void 0:v.prompt)&&((p=S.params)==null||delete p.prompt),sr((w=S.params)==null?void 0:w.tag)&&((I=S.params)==null||delete I.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:S}),this.relayer.request(S)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:t,message:i,opts:o}=e;await this.publish(t,i,o)})}registerEventListeners(){this.relayer.core.heartbeat.on(mi.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(er.connection_stalled);return}this.checkQueue()}),this.relayer.on(er.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class c3{constructor(){this.map=new Map,this.set=(e,t)=>{const i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,t))return;const o=i.filter(c=>c!==t);if(!o.length){this.map.delete(e);return}this.map.set(e,o)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var u3=Object.defineProperty,h3=Object.defineProperties,l3=Object.getOwnPropertyDescriptors,id=Object.getOwnPropertySymbols,f3=Object.prototype.hasOwnProperty,d3=Object.prototype.propertyIsEnumerable,sd=(n,e,t)=>e in n?u3(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,vs=(n,e)=>{for(var t in e||(e={}))f3.call(e,t)&&sd(n,t,e[t]);if(id)for(var t of id(e))d3.call(e,t)&&sd(n,t,e[t]);return n},Tc=(n,e)=>h3(n,l3(e));class p3 extends Qb{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new c3,this.events=new Yt.exports.EventEmitter,this.name=WE,this.version=YE,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=In,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(i,o)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:o}});try{const c=Qa(o),u={topic:i,relay:c};this.pending.set(i,u);const f=await this.rpcSubscribe(i,c);return this.onSubscribe(f,u),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:o}}),f}catch(c){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(c),c}},this.unsubscribe=async(i,o)=>{await this.restartToComplete(),this.isInitialized(),typeof o?.id<"u"?await this.unsubscribeById(i,o.id,o):await this.unsubscribeByTopic(i,o)},this.isSubscribed=async i=>this.topics.includes(i)?!0:await new Promise((o,c)=>{const u=new ye.Watch;u.start(this.pendingSubscriptionWatchLabel);const f=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(f),u.stop(this.pendingSubscriptionWatchLabel),o(!0)),u.elapsed(this.pendingSubscriptionWatchLabel)>=JE&&(clearInterval(f),u.stop(this.pendingSubscriptionWatchLabel),c(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1),this.on=(i,o)=>{this.events.on(i,o)},this.once=(i,o)=>{this.events.once(i,o)},this.off=(i,o)=>{this.events.off(i,o)},this.removeListener=(i,o)=>{this.events.removeListener(i,o)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Je.generateChildLogger(t,this.name),this.clientId=""}get context(){return Je.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const i=this.topicMap.get(e);await Promise.all(i.map(async o=>await this.unsubscribeById(e,o,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{const o=Qa(i);await this.rpcUnsubscribe(e,t,o);const c=At("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,c),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(o){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(o),o}}async rpcSubscribe(e,t){const i={method:Xs(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{await await Zi(this.relayer.request(i),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(er.connection_stalled)}return gi(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,i={method:Xs(t.protocol).batchSubscribe,params:{topics:e.map(o=>o.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{return await await Zi(this.relayer.request(i),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(er.connection_stalled)}}rpcUnsubscribe(e,t,i){const o={method:Xs(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:o}),this.relayer.request(o)}onSubscribe(e,t){this.setSubscription(e,Tc(vs({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,vs({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.subscriptions.has(e)||(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,vs({},t)),this.topicMap.set(t.topic,e),this.events.emit(zr.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:i}=he("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(zr.deleted,Tc(vs({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(zr.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const i=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(i)}}this.events.emit(zr.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=he("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);Qr(t)&&this.onBatchSubscribe(t.map((i,o)=>Tc(vs({},e[o]),{id:i})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;const e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(mi.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(er.connect,async()=>{await this.onConnect()}),this.relayer.on(er.disconnect,()=>{this.onDisconnect()}),this.events.on(zr.created,async e=>{const t=zr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(zr.deleted,async e=>{const t=zr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}}var g3=Object.defineProperty,od=Object.getOwnPropertySymbols,v3=Object.prototype.hasOwnProperty,y3=Object.prototype.propertyIsEnumerable,ad=(n,e,t)=>e in n?g3(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,_3=(n,e)=>{for(var t in e||(e={}))v3.call(e,t)&&ad(n,t,e[t]);if(od)for(var t of od(e))y3.call(e,t)&&ad(n,t,e[t]);return n};class b3 extends Yb{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Yt.exports.EventEmitter,this.name=HE,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async t=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(t)}catch(i){throw this.logger.debug("Failed to Publish Request"),this.logger.error(i),i}},this.onPayloadHandler=t=>{this.onProviderPayload(t)},this.onConnectHandler=()=>{this.events.emit(er.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(er.error,t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(hn.payload,this.onPayloadHandler),this.provider.on(hn.connect,this.onConnectHandler),this.provider.on(hn.disconnect,this.onDisconnectHandler),this.provider.on(hn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Je.generateChildLogger(e.logger,this.name):Je.pino(Je.getDefaultLoggerOptions({level:e.logger||qE})),this.messages=new o3(this.logger,e.core),this.subscriber=new p3(this,this.logger),this.publisher=new a3(this,this.logger),this.relayUrl=e?.relayUrl||rd,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${nd}...`),await this.restartTransport(nd)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},VE)}get context(){return Je.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now()})}async subscribe(e,t){var i;this.isInitialized();let o=((i=this.subscriber.topicMap.get(e))==null?void 0:i[0])||"";if(o)return o;let c;const u=f=>{f.topic===e&&(this.subscriber.off(zr.created,u),c())};return await Promise.all([new Promise(f=>{c=f,this.subscriber.on(zr.created,u)}),new Promise(async f=>{o=await this.subscriber.subscribe(e,t),f()})]),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 transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await Zi(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(t=>{if(!this.initialized)return t();this.subscriber.once(zr.resubscribed,()=>{t()})}),new Promise(async(t,i)=>{try{await Zi(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(o){i(o);return}t()})])}catch(t){this.logger.error(t);const i=t;if(!this.isConnectionStalled(i.message))throw t;this.provider.events.emit(hn.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Vl())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new un(new sw(O_({sdkVersion:KE,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){const{topic:t,message:i}=e;if(!i||i.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const o=this.messages.has(t,i);return o&&this.logger.debug(`Ignoring duplicate message: ${i}`),o}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Dc(e)){if(!e.method.endsWith(BE))return;const t=e.params,{topic:i,message:o,publishedAt:c}=t.data,u={topic:i,message:o,publishedAt:c};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(_3({type:"event",event:t.id},u)),this.events.emit(t.id,u),await this.acknowledgePayload(e),await this.onMessageEvent(u)}else oo(e)&&this.events.emit(er.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(er.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=Ec(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(hn.payload,this.onPayloadHandler),this.provider.off(hn.connect,this.onConnectHandler),this.provider.off(hn.disconnect,this.onDisconnectHandler),this.provider.off(hn.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(er.connection_stalled,()=>{this.restartTransport().catch(t=>this.logger.error(t))});let e=await Vl();_1(async t=>{this.initialized&&e!==t&&(e=t,t?await this.restartTransport().catch(i=>this.logger.error(i)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(i=>this.logger.error(i))))})}onProviderDisconnect(){this.events.emit(er.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},ye.toMiliseconds(zE)))}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(e=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}}var m3=Object.defineProperty,cd=Object.getOwnPropertySymbols,w3=Object.prototype.hasOwnProperty,E3=Object.prototype.propertyIsEnumerable,ud=(n,e,t)=>e in n?m3(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,hd=(n,e)=>{for(var t in e||(e={}))w3.call(e,t)&&ud(n,t,e[t]);if(cd)for(var t of cd(e))E3.call(e,t)&&ud(n,t,e[t]);return n};class co extends Jb{constructor(e,t,i,o=In,c=void 0){super(e,t,i,o),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=kE,this.cached=[],this.initialized=!1,this.storagePrefix=In,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(u=>{this.getKey&&u!==null&&!sr(u)?this.map.set(this.getKey(u),u):Y_(u)?this.map.set(u.id,u):J_(u)&&this.map.set(u.topic,u)}),this.cached=[],this.initialized=!0)},this.set=async(u,f)=>{this.isInitialized(),this.map.has(u)?await this.update(u,f):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:u,value:f}),this.map.set(u,f),await this.persist())},this.get=u=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:u}),this.getData(u)),this.getAll=u=>(this.isInitialized(),u?this.values.filter(f=>Object.keys(u).every(v=>ow(f[v],u[v]))):this.values),this.update=async(u,f)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:u,update:f});const v=hd(hd({},this.getData(u)),f);this.map.set(u,v),await this.persist()},this.delete=async(u,f)=>{this.isInitialized(),this.map.has(u)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:u,reason:f}),this.map.delete(u),await this.persist())},this.logger=Je.generateChildLogger(t,this.name),this.storagePrefix=o,this.getKey=c}get context(){return Je.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){const{message:i}=he("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:t}=he("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}}class D3{constructor(e,t){this.core=e,this.logger=t,this.name=QE,this.version=XE,this.events=new Yt.exports,this.initialized=!1,this.storagePrefix=In,this.ignoredPayloadTypes=[Vn],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async()=>{this.isInitialized();const i=Wa(),o=await this.core.crypto.setSymKey(i),c=Hr(ye.FIVE_MINUTES),u={protocol:td},f={topic:o,expiry:c,relay:u,active:!1},v=M_({protocol:this.core.protocol,version:this.core.version,topic:o,symKey:i,relay:u});return await this.pairings.set(o,f),await this.core.relayer.subscribe(o),this.core.expirer.set(o,c),{topic:o,uri:v}},this.pair=async i=>{this.isInitialized(),this.isValidPair(i);const{topic:o,symKey:c,relay:u}=L_(i.uri);let f;if(this.pairings.keys.includes(o)&&(f=this.pairings.get(o),f.active))throw new Error(`Pairing already exists: ${o}. Please try again with a new connection URI.`);this.core.crypto.keychain.has(o)||(await this.core.crypto.setSymKey(c,o),await this.core.relayer.subscribe(o,{relay:u}));const v=Hr(ye.FIVE_MINUTES),p={topic:o,relay:u,expiry:v,active:!1};return await this.pairings.set(o,p),this.core.expirer.set(o,v),i.activatePairing&&await this.activate({topic:o}),this.events.emit(gs.create,p),p},this.activate=async({topic:i})=>{this.isInitialized();const o=Hr(ye.THIRTY_DAYS);await this.pairings.update(i,{active:!0,expiry:o}),this.core.expirer.set(i,o)},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:o}=i;if(this.pairings.keys.includes(o)){const c=await this.sendRequest(o,"wc_pairingPing",{}),{done:u,resolve:f,reject:v}=vi();this.events.once(Ft("pairing_ping",c),({error:p})=>{p?v(p):f()}),await u()}},this.updateExpiry=async({topic:i,expiry:o})=>{this.isInitialized(),await this.pairings.update(i,{expiry:o})},this.updateMetadata=async({topic:i,metadata:o})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:o})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:o}=i;this.pairings.keys.includes(o)&&(await this.sendRequest(o,"wc_pairingDelete",At("USER_DISCONNECTED")),await this.deletePairing(o))},this.sendRequest=async(i,o,c)=>{const u=wi(o,c),f=await this.core.crypto.encode(i,u),v=ps[o].req;return this.core.history.set(i,u),this.core.relayer.publish(i,f,v),u.id},this.sendResult=async(i,o,c)=>{const u=Ec(i,c),f=await this.core.crypto.encode(o,u),v=await this.core.history.get(o,i),p=ps[v.request.method].res;await this.core.relayer.publish(o,f,p),await this.core.history.resolve(u)},this.sendError=async(i,o,c)=>{const u=so(i,c),f=await this.core.crypto.encode(o,u),v=await this.core.history.get(o,i),p=ps[v.request.method]?ps[v.request.method].res:ps.unregistered_method.res;await this.core.relayer.publish(o,f,p),await this.core.history.resolve(u)},this.deletePairing=async(i,o)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,At("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),o?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{const i=this.pairings.getAll().filter(o=>On(o.expiry));await Promise.all(i.map(o=>this.deletePairing(o.topic)))},this.onRelayEventRequest=i=>{const{topic:o,payload:c}=i;switch(c.method){case"wc_pairingPing":return this.onPairingPingRequest(o,c);case"wc_pairingDelete":return this.onPairingDeleteRequest(o,c);default:return this.onUnknownRpcMethodRequest(o,c)}},this.onRelayEventResponse=async i=>{const{topic:o,payload:c}=i,u=(await this.core.history.get(o,c.id)).request.method;switch(u){case"wc_pairingPing":return this.onPairingPingResponse(o,c);default:return this.onUnknownRpcMethodResponse(u)}},this.onPairingPingRequest=async(i,o)=>{const{id:c}=o;try{this.isValidPing({topic:i}),await this.sendResult(c,i,!0),this.events.emit(gs.ping,{id:c,topic:i})}catch(u){await this.sendError(c,i,u),this.logger.error(u)}},this.onPairingPingResponse=(i,o)=>{const{id:c}=o;setTimeout(()=>{cn(o)?this.events.emit(Ft("pairing_ping",c),{}):Br(o)&&this.events.emit(Ft("pairing_ping",c),{error:o.error})},500)},this.onPairingDeleteRequest=async(i,o)=>{const{id:c}=o;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(gs.delete,{id:c,topic:i})}catch(u){await this.sendError(c,i,u),this.logger.error(u)}},this.onUnknownRpcMethodRequest=async(i,o)=>{const{id:c,method:u}=o;try{if(this.registeredMethods.includes(u))return;const f=At("WC_METHOD_UNSUPPORTED",u);await this.sendError(c,i,f),this.logger.error(f)}catch(f){await this.sendError(c,i,f),this.logger.error(f)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(At("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=i=>{if(!pr(i)){const{message:o}=he("MISSING_OR_INVALID",`pair() params: ${i}`);throw new Error(o)}if(!W_(i.uri)){const{message:o}=he("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw new Error(o)}},this.isValidPing=async i=>{if(!pr(i)){const{message:c}=he("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(c)}const{topic:o}=i;await this.isValidPairingTopic(o)},this.isValidDisconnect=async i=>{if(!pr(i)){const{message:c}=he("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(c)}const{topic:o}=i;await this.isValidPairingTopic(o)},this.isValidPairingTopic=async i=>{if(!kt(i,!1)){const{message:o}=he("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(o)}if(!this.pairings.keys.includes(i)){const{message:o}=he("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(o)}if(On(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:o}=he("EXPIRED",`pairing topic: ${i}`);throw new Error(o)}},this.core=e,this.logger=Je.generateChildLogger(t,this.name),this.pairings=new co(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Je.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(er.message,async e=>{const{topic:t,message:i}=e;if(!this.pairings.keys.includes(t)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const o=await this.core.crypto.decode(t,i);try{Dc(o)?(this.core.history.set(t,o),this.onRelayEventRequest({topic:t,payload:o})):oo(o)&&(await this.core.history.resolve(o),await this.onRelayEventResponse({topic:t,payload:o}),this.core.history.delete(t,o.id))}catch(c){this.logger.error(c)}})}registerExpirerEvents(){this.core.expirer.on(Ar.expired,async e=>{const{topic:t}=Ll(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(gs.expire,{topic:t}))})}}class S3 extends kb{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new Yt.exports.EventEmitter,this.name=ZE,this.version=e3,this.cached=[],this.initialized=!1,this.storagePrefix=In,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,o,c)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:o,chainId:c}),this.records.has(o.id))return;const u={id:o.id,topic:i,request:{method:o.method,params:o.params||null},chainId:c,expiry:Hr(ye.THIRTY_DAYS)};this.records.set(u.id,u),this.events.emit(Xr.created,u)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const o=await this.getRecord(i.id);typeof o.response>"u"&&(o.response=Br(i)?{error:i.error}:{result:i.result},this.records.set(o.id,o),this.events.emit(Xr.updated,o))},this.get=async(i,o)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:o}),await this.getRecord(o)),this.delete=(i,o)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:o}),this.values.forEach(c=>{if(c.topic===i){if(typeof o<"u"&&c.id!==o)return;this.records.delete(c.id),this.events.emit(Xr.deleted,c)}})},this.exists=async(i,o)=>(this.isInitialized(),this.records.has(o)?(await this.getRecord(o)).topic===i:!1),this.on=(i,o)=>{this.events.on(i,o)},this.once=(i,o)=>{this.events.once(i,o)},this.off=(i,o)=>{this.events.off(i,o)},this.removeListener=(i,o)=>{this.events.removeListener(i,o)},this.logger=Je.generateChildLogger(t,this.name)}get context(){return Je.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const i={topic:t.topic,request:wi(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:i}=he("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Xr.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=he("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Xr.created,e=>{const t=Xr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Xr.updated,e=>{const t=Xr.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Xr.deleted,e=>{const t=Xr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.core.heartbeat.on(mi.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{ye.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))})}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}}class x3 extends Xb{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new Yt.exports.EventEmitter,this.name=t3,this.version=r3,this.cached=[],this.initialized=!1,this.storagePrefix=In,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{const o=this.formatTarget(i);return typeof this.getExpiration(o)<"u"}catch{return!1}},this.set=(i,o)=>{this.isInitialized();const c=this.formatTarget(i),u={target:c,expiry:o};this.expirations.set(c,u),this.checkExpiry(c,u),this.events.emit(Ar.created,{target:c,expiration:u})},this.get=i=>{this.isInitialized();const o=this.formatTarget(i);return this.getExpiration(o)},this.del=i=>{if(this.isInitialized(),this.has(i)){const o=this.formatTarget(i),c=this.getExpiration(o);this.expirations.delete(o),this.events.emit(Ar.deleted,{target:o,expiration:c})}},this.on=(i,o)=>{this.events.on(i,o)},this.once=(i,o)=>{this.events.once(i,o)},this.off=(i,o)=>{this.events.off(i,o)},this.removeListener=(i,o)=>{this.events.removeListener(i,o)},this.logger=Je.generateChildLogger(t,this.name)}get context(){return Je.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return I_(e);if(typeof e=="number")return P_(e);const{message:t}=he("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Ar.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=he("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:i}=he("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}checkExpiry(e,t){const{expiry:i}=t;ye.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(Ar.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(mi.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Ar.created,e=>{const t=Ar.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Ar.expired,e=>{const t=Ar.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Ar.deleted,e=>{const t=Ar.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}}}class O3 extends Zb{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.name=Cc,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async i=>{if(this.verifyDisabled||Ji()||!Qi())return;const o=this.getVerifyUrl(i?.verifyUrl);this.verifyUrl!==o&&this.removeIframe(),this.verifyUrl=o;try{await this.createIframe()}catch(c){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(c)}if(!this.initialized){this.removeIframe(),this.verifyUrl=Ac;try{await this.createIframe()}catch(c){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(c),this.verifyDisabled=!0}}},this.register=async i=>{this.initialized?this.sendPost(i.attestationId):(this.addToQueue(i.attestationId),await this.init())},this.resolve=async i=>{if(this.isDevEnv)return"";const o=this.getVerifyUrl(i?.verifyUrl);let c;try{c=await this.fetchAttestation(i.attestationId,o)}catch(u){this.logger.info(`failed to resolve attestation: ${i.attestationId} from url: ${o}`),this.logger.info(u),c=await this.fetchAttestation(i.attestationId,Ac)}return c},this.fetchAttestation=async(i,o)=>{this.logger.info(`resolving attestation: ${i} from url: ${o}`);const c=this.startAbortTimer(ye.ONE_SECOND*2),u=await fetch(`${o}/attestation/${i}`,{signal:this.abortController.signal});return clearTimeout(c),u.status===200?await u.json():void 0},this.addToQueue=i=>{this.queue.push(i)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(i=>this.sendPost(i)),this.queue=[])},this.sendPost=i=>{var o;try{if(!this.iframe)return;(o=this.iframe.contentWindow)==null||o.postMessage(i,"*"),this.logger.info(`postMessage sent: ${i} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let i;const o=c=>{c.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",o),i())};await Promise.race([new Promise(c=>{if(document.getElementById(Cc))return c();window.addEventListener("message",o);const u=document.createElement("iframe");u.id=Cc,u.src=`${this.verifyUrl}/${this.projectId}`,u.style.display="none",document.body.append(u),this.iframe=u,i=c}),new Promise((c,u)=>setTimeout(()=>{window.removeEventListener("message",o),u("verify iframe load timeout")},ye.toMiliseconds(ye.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=i=>{let o=i||Ei;return n3.includes(o)||(this.logger.info(`verify url: ${o}, not included in trusted list, assigning default: ${Ei}`),o=Ei),o},this.logger=Je.generateChildLogger(t,this.name),this.verifyUrl=Ei,this.abortController=new AbortController,this.isDevEnv=Ya()&&process.env.IS_VITEST}get context(){return Je.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),ye.toMiliseconds(e))}}var I3=Object.defineProperty,ld=Object.getOwnPropertySymbols,P3=Object.prototype.hasOwnProperty,C3=Object.prototype.propertyIsEnumerable,fd=(n,e,t)=>e in n?I3(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,dd=(n,e)=>{for(var t in e||(e={}))P3.call(e,t)&&fd(n,t,e[t]);if(ld)for(var t of ld(e))C3.call(e,t)&&fd(n,t,e[t]);return n};class Rc extends Vb{constructor(e){super(e),this.protocol=Zf,this.version=CE,this.name=Pc,this.events=new Yt.exports.EventEmitter,this.initialized=!1,this.on=(i,o)=>this.events.on(i,o),this.once=(i,o)=>this.events.once(i,o),this.off=(i,o)=>this.events.off(i,o),this.removeListener=(i,o)=>this.events.removeListener(i,o),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||rd,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Je.pino(Je.getDefaultLoggerOptions({level:e?.logger||AE.logger}));this.logger=Je.generateChildLogger(t,this.name),this.heartbeat=new mi.HeartBeat,this.crypto=new s3(this,this.logger,e?.keychain),this.history=new S3(this,this.logger),this.expirer=new x3(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new Y1(dd(dd({},TE),e?.storageOptions)),this.relayer=new b3({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new D3(this,this.logger),this.verify=new O3(this.projectId||"",this.logger)}static async init(e){const t=new Rc(e);await t.initialize();const i=await t.crypto.getClientId();return await t.storage.setItem(GE,i),t}get context(){return Je.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const A3=Rc,pd="wc",gd=2,vd="client",Nc=`${pd}@${gd}:${vd}:`,$c={name:vd,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},yd="WALLETCONNECT_DEEPLINK_CHOICE",T3="proposal",_d="Proposal expired",R3="session",uo=ye.SEVEN_DAYS,N3="engine",ys={wc_sessionPropose:{req:{ttl:ye.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ye.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ye.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1115}}},Fc={min:ye.FIVE_MINUTES,max:ye.SEVEN_DAYS},ln={idle:"IDLE",active:"ACTIVE"},$3="request",F3=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var L3=Object.defineProperty,U3=Object.defineProperties,j3=Object.getOwnPropertyDescriptors,bd=Object.getOwnPropertySymbols,M3=Object.prototype.hasOwnProperty,q3=Object.prototype.propertyIsEnumerable,md=(n,e,t)=>e in n?L3(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,gr=(n,e)=>{for(var t in e||(e={}))M3.call(e,t)&&md(n,t,e[t]);if(bd)for(var t of bd(e))q3.call(e,t)&&md(n,t,e[t]);return n},_s=(n,e)=>U3(n,j3(e));class H3 extends tm{constructor(e){super(e),this.name=N3,this.events=new Yt.exports,this.initialized=!1,this.ignoredPayloadTypes=[Vn],this.requestQueue={state:ln.idle,queue:[]},this.sessionRequestQueue={state:ln.idle,queue:[]},this.requestQueueDelay=ye.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(ys)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},ye.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{await this.isInitialized();const i=_s(gr({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(i);const{pairingTopic:o,requiredNamespaces:c,optionalNamespaces:u,sessionProperties:f,relays:v}=i;let p=o,w,I=!1;if(p&&(I=this.client.core.pairing.pairings.get(p).active),!p||!I){const{topic:U,uri:x}=await this.client.core.pairing.create();p=U,w=x}const S=await this.client.core.crypto.generateKeyPair(),C=gr({requiredNamespaces:c,optionalNamespaces:u,relays:v??[{protocol:td}],proposer:{publicKey:S,metadata:this.client.metadata}},f&&{sessionProperties:f}),{reject:R,resolve:B,done:K}=vi(ye.FIVE_MINUTES,_d);if(this.events.once(Ft("session_connect"),async({error:U,session:x})=>{if(U)R(U);else if(x){x.self.publicKey=S;const T=_s(gr({},x),{requiredNamespaces:x.requiredNamespaces,optionalNamespaces:x.optionalNamespaces});await this.client.session.set(x.topic,T),await this.setExpiry(x.topic,x.expiry),p&&await this.client.core.pairing.updateMetadata({topic:p,metadata:x.peer.metadata}),B(T)}}),!p){const{message:U}=he("NO_MATCHING_KEY",`connect() pairing topic: ${p}`);throw new Error(U)}const se=await this.sendRequest({topic:p,method:"wc_sessionPropose",params:C}),$=Hr(ye.FIVE_MINUTES);return await this.setProposal(se,gr({id:se,expiry:$},C)),{uri:w,approval:K}},this.pair=async t=>(await this.isInitialized(),await this.client.core.pairing.pair(t)),this.approve=async t=>{await this.isInitialized(),await this.isValidApprove(t);const{id:i,relayProtocol:o,namespaces:c,sessionProperties:u}=t,f=this.client.proposal.get(i);let{pairingTopic:v,proposer:p,requiredNamespaces:w,optionalNamespaces:I}=f;v=v||"",_i(w)||(w=z_(c,"approve()"));const S=await this.client.core.crypto.generateKeyPair(),C=p.publicKey,R=await this.client.core.crypto.generateSharedKey(S,C);v&&i&&(await this.client.core.pairing.updateMetadata({topic:v,metadata:p.metadata}),await this.sendResult({id:i,topic:v,result:{relay:{protocol:o??"irn"},responderPublicKey:S}}),await this.client.proposal.delete(i,At("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:v}));const B=gr({relay:{protocol:o??"irn"},namespaces:c,requiredNamespaces:w,optionalNamespaces:I,pairingTopic:v,controller:{publicKey:S,metadata:this.client.metadata},expiry:Hr(uo)},u&&{sessionProperties:u});await this.client.core.relayer.subscribe(R),await this.sendRequest({topic:R,method:"wc_sessionSettle",params:B,throwOnFailedPublish:!0});const K=_s(gr({},B),{topic:R,pairingTopic:v,acknowledged:!1,self:B.controller,peer:{publicKey:p.publicKey,metadata:p.metadata},controller:S});return await this.client.session.set(R,K),await this.setExpiry(R,Hr(uo)),{topic:R,acknowledged:()=>new Promise(se=>setTimeout(()=>se(this.client.session.get(R)),500))}},this.reject=async t=>{await this.isInitialized(),await this.isValidReject(t);const{id:i,reason:o}=t,{pairingTopic:c}=this.client.proposal.get(i);c&&(await this.sendError(i,c,o),await this.client.proposal.delete(i,At("USER_DISCONNECTED")))},this.update=async t=>{await this.isInitialized(),await this.isValidUpdate(t);const{topic:i,namespaces:o}=t,c=await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:o}}),{done:u,resolve:f,reject:v}=vi();return this.events.once(Ft("session_update",c),({error:p})=>{p?v(p):f()}),await this.client.session.update(i,{namespaces:o}),{acknowledged:u}},this.extend=async t=>{await this.isInitialized(),await this.isValidExtend(t);const{topic:i}=t,o=await this.sendRequest({topic:i,method:"wc_sessionExtend",params:{}}),{done:c,resolve:u,reject:f}=vi();return this.events.once(Ft("session_extend",o),({error:v})=>{v?f(v):u()}),await this.setExpiry(i,Hr(uo)),{acknowledged:c}},this.request=async t=>{await this.isInitialized(),await this.isValidRequest(t);const{chainId:i,request:o,topic:c,expiry:u}=t,f=wc(),{done:v,resolve:p,reject:w}=vi(u,"Request expired. Please try again.");return this.events.once(Ft("session_request",f),({error:I,result:S})=>{I?w(I):p(S)}),await Promise.all([new Promise(async I=>{await this.sendRequest({clientRpcId:f,topic:c,method:"wc_sessionRequest",params:{request:o,chainId:i},expiry:u,throwOnFailedPublish:!0}).catch(S=>w(S)),this.client.events.emit("session_request_sent",{topic:c,request:o,chainId:i,id:f}),I()}),new Promise(async I=>{const S=await this.client.core.storage.getItem(yd);C_({id:f,topic:c,wcDeepLink:S}),I()}),v()]).then(I=>I[2])},this.respond=async t=>{await this.isInitialized(),await this.isValidRespond(t);const{topic:i,response:o}=t,{id:c}=o;cn(o)?await this.sendResult({id:c,topic:i,result:o.result,throwOnFailedPublish:!0}):Br(o)&&await this.sendError(c,i,o.error),this.cleanupAfterResponse(t)},this.ping=async t=>{await this.isInitialized(),await this.isValidPing(t);const{topic:i}=t;if(this.client.session.keys.includes(i)){const o=await this.sendRequest({topic:i,method:"wc_sessionPing",params:{}}),{done:c,resolve:u,reject:f}=vi();this.events.once(Ft("session_ping",o),({error:v})=>{v?f(v):u()}),await c()}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async t=>{await this.isInitialized(),await this.isValidEmit(t);const{topic:i,event:o,chainId:c}=t;await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:o,chainId:c}})},this.disconnect=async t=>{await this.isInitialized(),await this.isValidDisconnect(t);const{topic:i}=t;this.client.session.keys.includes(i)?(await this.sendRequest({topic:i,method:"wc_sessionDelete",params:At("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(i)):await this.client.core.pairing.disconnect({topic:i})},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>k_(i,t))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const i=this.client.core.pairing.pairings.get(t.pairingTopic),o=this.client.core.pairing.pairings.getAll().filter(c=>{var u,f;return((u=c.peerMetadata)==null?void 0:u.url)&&((f=c.peerMetadata)==null?void 0:f.url)===t.peer.metadata.url&&c.topic&&c.topic!==i.topic});if(o.length===0)return;this.client.logger.info(`Cleaning up ${o.length} duplicate pairing(s)`),await Promise.all(o.map(c=>this.client.core.pairing.disconnect({topic:c.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}},this.deleteSession=async(t,i)=>{const{self:o}=this.client.session.get(t);await this.client.core.relayer.unsubscribe(t),this.client.session.delete(t,At("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(o.publicKey)&&await this.client.core.crypto.deleteKeyPair(o.publicKey),this.client.core.crypto.keychain.has(t)&&await this.client.core.crypto.deleteSymKey(t),i||this.client.core.expirer.del(t),this.client.core.storage.removeItem(yd).catch(c=>this.client.logger.warn(c))},this.deleteProposal=async(t,i)=>{await Promise.all([this.client.proposal.delete(t,At("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)])},this.deletePendingSessionRequest=async(t,i,o=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,i),o?Promise.resolve():this.client.core.expirer.del(t)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(c=>c.id!==t),o&&(this.sessionRequestQueue.state=ln.idle)},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&await this.client.session.update(t,{expiry:i}),this.client.core.expirer.set(t,i)},this.setProposal=async(t,i)=>{await this.client.proposal.set(t,i),this.client.core.expirer.set(t,i.expiry)},this.setPendingSessionRequest=async t=>{const i=ys.wc_sessionRequest.req.ttl,{id:o,topic:c,params:u,verifyContext:f}=t;await this.client.pendingRequest.set(o,{id:o,topic:c,params:u,verifyContext:f}),i&&this.client.core.expirer.set(o,Hr(i))},this.sendRequest=async t=>{const{topic:i,method:o,params:c,expiry:u,relayRpcId:f,clientRpcId:v,throwOnFailedPublish:p}=t,w=wi(o,c,v);if(Qi()&&F3.includes(o)){const C=gi(JSON.stringify(w));this.client.core.verify.register({attestationId:C})}const I=await this.client.core.crypto.encode(i,w),S=ys[o].req;return u&&(S.ttl=u),f&&(S.id=f),this.client.core.history.set(i,w),p?(S.internal=_s(gr({},S.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,I,S)):this.client.core.relayer.publish(i,I,S).catch(C=>this.client.logger.error(C)),w.id},this.sendResult=async t=>{const{id:i,topic:o,result:c,throwOnFailedPublish:u}=t,f=Ec(i,c),v=await this.client.core.crypto.encode(o,f),p=await this.client.core.history.get(o,i),w=ys[p.request.method].res;u?(w.internal=_s(gr({},w.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(o,v,w)):this.client.core.relayer.publish(o,v,w).catch(I=>this.client.logger.error(I)),await this.client.core.history.resolve(f)},this.sendError=async(t,i,o)=>{const c=so(t,o),u=await this.client.core.crypto.encode(i,c),f=await this.client.core.history.get(i,t),v=ys[f.request.method].res;this.client.core.relayer.publish(i,u,v),await this.client.core.history.resolve(c)},this.cleanup=async()=>{const t=[],i=[];this.client.session.getAll().forEach(o=>{On(o.expiry)&&t.push(o.topic)}),this.client.proposal.getAll().forEach(o=>{On(o.expiry)&&i.push(o.id)}),await Promise.all([...t.map(o=>this.deleteSession(o)),...i.map(o=>this.deleteProposal(o))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===ln.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=ln.active;const t=this.requestQueue.queue.shift();if(t)try{this.processRequest(t),await new Promise(i=>setTimeout(i,300))}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=ln.idle},this.processRequest=t=>{const{topic:i,payload:o}=t,c=o.method;switch(c){case"wc_sessionPropose":return this.onSessionProposeRequest(i,o);case"wc_sessionSettle":return this.onSessionSettleRequest(i,o);case"wc_sessionUpdate":return this.onSessionUpdateRequest(i,o);case"wc_sessionExtend":return this.onSessionExtendRequest(i,o);case"wc_sessionPing":return this.onSessionPingRequest(i,o);case"wc_sessionDelete":return this.onSessionDeleteRequest(i,o);case"wc_sessionRequest":return this.onSessionRequest(i,o);case"wc_sessionEvent":return this.onSessionEventRequest(i,o);default:return this.client.logger.info(`Unsupported request method ${c}`)}},this.onRelayEventResponse=async t=>{const{topic:i,payload:o}=t,c=(await this.client.core.history.get(i,o.id)).request.method;switch(c){case"wc_sessionPropose":return this.onSessionProposeResponse(i,o);case"wc_sessionSettle":return this.onSessionSettleResponse(i,o);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,o);case"wc_sessionExtend":return this.onSessionExtendResponse(i,o);case"wc_sessionPing":return this.onSessionPingResponse(i,o);case"wc_sessionRequest":return this.onSessionRequestResponse(i,o);default:return this.client.logger.info(`Unsupported response method ${c}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:i}=t,{message:o}=he("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(o)},this.onSessionProposeRequest=async(t,i)=>{const{params:o,id:c}=i;try{this.isValidConnect(gr({},i.params));const u=Hr(ye.FIVE_MINUTES),f=gr({id:c,pairingTopic:t,expiry:u},o);await this.setProposal(c,f);const v=gi(JSON.stringify(i)),p=await this.getVerifyContext(v,f.proposer.metadata);this.client.events.emit("session_proposal",{id:c,params:f,verifyContext:p})}catch(u){await this.sendError(c,t,u),this.client.logger.error(u)}},this.onSessionProposeResponse=async(t,i)=>{const{id:o}=i;if(cn(i)){const{result:c}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:c});const u=this.client.proposal.get(o);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:u});const f=u.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:f});const v=c.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:v});const p=await this.client.core.crypto.generateSharedKey(f,v);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:p});const w=await this.client.core.relayer.subscribe(p);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:w}),await this.client.core.pairing.activate({topic:t})}else Br(i)&&(await this.client.proposal.delete(o,At("USER_DISCONNECTED")),this.events.emit(Ft("session_connect"),{error:i.error}))},this.onSessionSettleRequest=async(t,i)=>{const{id:o,params:c}=i;try{this.isValidSessionSettleRequest(c);const{relay:u,controller:f,expiry:v,namespaces:p,requiredNamespaces:w,optionalNamespaces:I,sessionProperties:S,pairingTopic:C}=i.params,R=gr({topic:t,relay:u,expiry:v,namespaces:p,acknowledged:!0,pairingTopic:C,requiredNamespaces:w,optionalNamespaces:I,controller:f.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:f.publicKey,metadata:f.metadata}},S&&{sessionProperties:S});await this.sendResult({id:i.id,topic:t,result:!0}),this.events.emit(Ft("session_connect"),{session:R}),this.cleanupDuplicatePairings(R)}catch(u){await this.sendError(o,t,u),this.client.logger.error(u)}},this.onSessionSettleResponse=async(t,i)=>{const{id:o}=i;cn(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(Ft("session_approve",o),{})):Br(i)&&(await this.client.session.delete(t,At("USER_DISCONNECTED")),this.events.emit(Ft("session_approve",o),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{const{params:o,id:c}=i;try{const u=`${t}_session_update`,f=to.get(u);if(f&&this.isRequestOutOfSync(f,c)){this.client.logger.info(`Discarding out of sync request - ${c}`);return}this.isValidUpdate(gr({topic:t},o)),await this.client.session.update(t,{namespaces:o.namespaces}),await this.sendResult({id:c,topic:t,result:!0}),this.client.events.emit("session_update",{id:c,topic:t,params:o}),to.set(u,c)}catch(u){await this.sendError(c,t,u),this.client.logger.error(u)}},this.isRequestOutOfSync=(t,i)=>parseInt(i.toString().slice(0,-3))<=parseInt(t.toString().slice(0,-3)),this.onSessionUpdateResponse=(t,i)=>{const{id:o}=i;cn(i)?this.events.emit(Ft("session_update",o),{}):Br(i)&&this.events.emit(Ft("session_update",o),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{const{id:o}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,Hr(uo)),await this.sendResult({id:o,topic:t,result:!0}),this.client.events.emit("session_extend",{id:o,topic:t})}catch(c){await this.sendError(o,t,c),this.client.logger.error(c)}},this.onSessionExtendResponse=(t,i)=>{const{id:o}=i;cn(i)?this.events.emit(Ft("session_extend",o),{}):Br(i)&&this.events.emit(Ft("session_extend",o),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{const{id:o}=i;try{this.isValidPing({topic:t}),await this.sendResult({id:o,topic:t,result:!0}),this.client.events.emit("session_ping",{id:o,topic:t})}catch(c){await this.sendError(o,t,c),this.client.logger.error(c)}},this.onSessionPingResponse=(t,i)=>{const{id:o}=i;setTimeout(()=>{cn(i)?this.events.emit(Ft("session_ping",o),{}):Br(i)&&this.events.emit(Ft("session_ping",o),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{const{id:o}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),await Promise.all([new Promise(c=>{this.client.core.relayer.once(er.publish,async()=>{c(await this.deleteSession(t))})}),this.sendResult({id:o,topic:t,result:!0})]),this.client.events.emit("session_delete",{id:o,topic:t})}catch(c){this.client.logger.error(c)}},this.onSessionRequest=async(t,i)=>{const{id:o,params:c}=i;try{this.isValidRequest(gr({topic:t},c));const u=gi(JSON.stringify(wi("wc_sessionRequest",c,o))),f=this.client.session.get(t),v=await this.getVerifyContext(u,f.peer.metadata),p={id:o,topic:t,params:c,verifyContext:v};await this.setPendingSessionRequest(p),this.addSessionRequestToSessionRequestQueue(p),this.processSessionRequestQueue()}catch(u){await this.sendError(o,t,u),this.client.logger.error(u)}},this.onSessionRequestResponse=(t,i)=>{const{id:o}=i;cn(i)?this.events.emit(Ft("session_request",o),{result:i.result}):Br(i)&&this.events.emit(Ft("session_request",o),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{const{id:o,params:c}=i;try{const u=`${t}_session_event_${c.event.name}`,f=to.get(u);if(f&&this.isRequestOutOfSync(f,o)){this.client.logger.info(`Discarding out of sync request - ${o}`);return}this.isValidEmit(gr({topic:t},c)),this.client.events.emit("session_event",{id:o,topic:t,params:c}),to.set(u,o)}catch(u){await this.sendError(o,t,u),this.client.logger.error(u)}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ln.idle,this.processSessionRequestQueue()},ye.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===ln.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=ln.active,this.client.events.emit("session_request",t)}catch(i){this.client.logger.error(i)}},this.onPairingCreated=t=>{if(t.active)return;const i=this.client.proposal.getAll().find(o=>o.pairingTopic===t.topic);i&&this.onSessionProposeRequest(t.topic,wi("wc_sessionPropose",{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer},i.id))},this.isValidConnect=async t=>{if(!pr(t)){const{message:v}=he("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(v)}const{pairingTopic:i,requiredNamespaces:o,optionalNamespaces:c,sessionProperties:u,relays:f}=t;if(sr(i)||await this.isValidPairingTopic(i),!i1(f,!0)){const{message:v}=he("MISSING_OR_INVALID",`connect() relays: ${f}`);throw new Error(v)}!sr(o)&&_i(o)!==0&&this.validateNamespaces(o,"requiredNamespaces"),!sr(c)&&_i(c)!==0&&this.validateNamespaces(c,"optionalNamespaces"),sr(u)||this.validateSessionProps(u,"sessionProperties")},this.validateNamespaces=(t,i)=>{const o=n1(t,"connect()",i);if(o)throw new Error(o.message)},this.isValidApprove=async t=>{if(!pr(t))throw new Error(he("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:i,namespaces:o,relayProtocol:c,sessionProperties:u}=t;await this.isValidProposalId(i);const f=this.client.proposal.get(i),v=eo(o,"approve()");if(v)throw new Error(v.message);const p=zl(f.requiredNamespaces,o,"approve()");if(p)throw new Error(p.message);if(!kt(c,!0)){const{message:w}=he("MISSING_OR_INVALID",`approve() relayProtocol: ${c}`);throw new Error(w)}sr(u)||this.validateSessionProps(u,"sessionProperties")},this.isValidReject=async t=>{if(!pr(t)){const{message:c}=he("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(c)}const{id:i,reason:o}=t;if(await this.isValidProposalId(i),!o1(o)){const{message:c}=he("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(o)}`);throw new Error(c)}},this.isValidSessionSettleRequest=t=>{if(!pr(t)){const{message:p}=he("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(p)}const{relay:i,controller:o,namespaces:c,expiry:u}=t;if(!Hl(i)){const{message:p}=he("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(p)}const f=Q_(o,"onSessionSettleRequest()");if(f)throw new Error(f.message);const v=eo(c,"onSessionSettleRequest()");if(v)throw new Error(v.message);if(On(u)){const{message:p}=he("EXPIRED","onSessionSettleRequest()");throw new Error(p)}},this.isValidUpdate=async t=>{if(!pr(t)){const{message:v}=he("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(v)}const{topic:i,namespaces:o}=t;await this.isValidSessionTopic(i);const c=this.client.session.get(i),u=eo(o,"update()");if(u)throw new Error(u.message);const f=zl(c.requiredNamespaces,o,"update()");if(f)throw new Error(f.message)},this.isValidExtend=async t=>{if(!pr(t)){const{message:o}=he("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(o)}const{topic:i}=t;await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!pr(t)){const{message:v}=he("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(v)}const{topic:i,request:o,chainId:c,expiry:u}=t;await this.isValidSessionTopic(i);const{namespaces:f}=this.client.session.get(i);if(!Bl(f,c)){const{message:v}=he("MISSING_OR_INVALID",`request() chainId: ${c}`);throw new Error(v)}if(!a1(o)){const{message:v}=he("MISSING_OR_INVALID",`request() ${JSON.stringify(o)}`);throw new Error(v)}if(!h1(f,c,o.method)){const{message:v}=he("MISSING_OR_INVALID",`request() method: ${o.method}`);throw new Error(v)}if(u&&!p1(u,Fc)){const{message:v}=he("MISSING_OR_INVALID",`request() expiry: ${u}. Expiry must be a number (in seconds) between ${Fc.min} and ${Fc.max}`);throw new Error(v)}},this.isValidRespond=async t=>{if(!pr(t)){const{message:c}=he("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(c)}const{topic:i,response:o}=t;if(await this.isValidSessionTopic(i),!c1(o)){const{message:c}=he("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(o)}`);throw new Error(c)}},this.isValidPing=async t=>{if(!pr(t)){const{message:o}=he("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(o)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!pr(t)){const{message:f}=he("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(f)}const{topic:i,event:o,chainId:c}=t;await this.isValidSessionTopic(i);const{namespaces:u}=this.client.session.get(i);if(!Bl(u,c)){const{message:f}=he("MISSING_OR_INVALID",`emit() chainId: ${c}`);throw new Error(f)}if(!u1(o)){const{message:f}=he("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(o)}`);throw new Error(f)}if(!l1(u,c,o.name)){const{message:f}=he("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(o)}`);throw new Error(f)}},this.isValidDisconnect=async t=>{if(!pr(t)){const{message:o}=he("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(o)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.getVerifyContext=async(t,i)=>{const o={verified:{verifyUrl:i.verifyUrl||Ei,validation:"UNKNOWN",origin:i.url||""}};try{const c=await this.client.core.verify.resolve({attestationId:t,verifyUrl:i.verifyUrl});c&&(o.verified.origin=c.origin,o.verified.isScam=c.isScam,o.verified.validation=c.origin===new URL(i.url).origin?"VALID":"INVALID")}catch(c){this.client.logger.info(c)}return this.client.logger.info(`Verify context: ${JSON.stringify(o)}`),o},this.validateSessionProps=(t,i)=>{Object.values(t).forEach(o=>{if(!kt(o,!1)){const{message:c}=he("MISSING_OR_INVALID",`${i} must be in Record<string, string> format. Received: ${JSON.stringify(o)}`);throw new Error(c)}})}}async isInitialized(){if(!this.initialized){const{message:e}=he("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(er.message,async e=>{const{topic:t,message:i}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(i)))return;const o=await this.client.core.crypto.decode(t,i);try{Dc(o)?(this.client.core.history.set(t,o),this.onRelayEventRequest({topic:t,payload:o})):oo(o)?(await this.client.core.history.resolve(o),await this.onRelayEventResponse({topic:t,payload:o}),this.client.core.history.delete(t,o.id)):this.onRelayEventUnknownPayload({topic:t,payload:o})}catch(c){this.client.logger.error(c)}})}registerExpirerEvents(){this.client.core.expirer.on(Ar.expired,async e=>{const{topic:t,id:i}=Ll(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,he("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession(t,!0),this.client.events.emit("session_expire",{topic:t})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(gs.create,e=>this.onPairingCreated(e))}isValidPairingTopic(e){if(!kt(e,!1)){const{message:t}=he("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=he("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(On(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=he("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!kt(e,!1)){const{message:t}=he("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(!this.client.session.keys.includes(e)){const{message:t}=he("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(On(this.client.session.get(e).expiry)){await this.deleteSession(e);const{message:t}=he("EXPIRED",`session topic: ${e}`);throw new Error(t)}}async isValidSessionOrPairingTopic(e){if(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(kt(e,!1)){const{message:t}=he("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=he("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!s1(e)){const{message:t}=he("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=he("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(On(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);const{message:t}=he("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class B3 extends co{constructor(e,t){super(e,t,T3,Nc),this.core=e,this.logger=t}}class z3 extends co{constructor(e,t){super(e,t,R3,Nc),this.core=e,this.logger=t}}class K3 extends co{constructor(e,t){super(e,t,$3,Nc,i=>i.id),this.core=e,this.logger=t}}class Lc extends em{constructor(e){super(e),this.protocol=pd,this.version=gd,this.name=$c.name,this.events=new Yt.exports.EventEmitter,this.on=(i,o)=>this.events.on(i,o),this.once=(i,o)=>this.events.once(i,o),this.off=(i,o)=>this.events.off(i,o),this.removeListener=(i,o)=>this.events.removeListener(i,o),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(o){throw this.logger.error(o.message),o}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(o){throw this.logger.error(o.message),o}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(o){throw this.logger.error(o.message),o}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(o){throw this.logger.error(o.message),o}},this.update=async i=>{try{return await this.engine.update(i)}catch(o){throw this.logger.error(o.message),o}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(o){throw this.logger.error(o.message),o}},this.request=async i=>{try{return await this.engine.request(i)}catch(o){throw this.logger.error(o.message),o}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(o){throw this.logger.error(o.message),o}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(o){throw this.logger.error(o.message),o}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(o){throw this.logger.error(o.message),o}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(o){throw this.logger.error(o.message),o}},this.find=i=>{try{return this.engine.find(i)}catch(o){throw this.logger.error(o.message),o}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.name=e?.name||$c.name,this.metadata=e?.metadata||E_();const t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Je.pino(Je.getDefaultLoggerOptions({level:e?.logger||$c.logger}));this.core=e?.core||new A3(e),this.logger=Je.generateChildLogger(t,this.name),this.session=new z3(this.core,this.logger),this.proposal=new B3(this.core,this.logger),this.pendingRequest=new K3(this.core,this.logger),this.engine=new H3(this)}static async init(e){const t=new Lc(e);return await t.initialize(),t}get context(){return Je.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var Uc={exports:{}};(function(n,e){var t=typeof self<"u"?self:Vt,i=function(){function c(){this.fetch=!1,this.DOMException=t.DOMException}return c.prototype=t,new c}();(function(c){(function(u){var f={searchParams:"URLSearchParams"in c,iterable:"Symbol"in c&&"iterator"in Symbol,blob:"FileReader"in c&&"Blob"in c&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in c,arrayBuffer:"ArrayBuffer"in c};function v(m){return m&&DataView.prototype.isPrototypeOf(m)}if(f.arrayBuffer)var p=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],w=ArrayBuffer.isView||function(m){return m&&p.indexOf(Object.prototype.toString.call(m))>-1};function I(m){if(typeof m!="string"&&(m=String(m)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(m))throw new TypeError("Invalid character in header field name");return m.toLowerCase()}function S(m){return typeof m!="string"&&(m=String(m)),m}function C(m){var P={next:function(){var ee=m.shift();return{done:ee===void 0,value:ee}}};return f.iterable&&(P[Symbol.iterator]=function(){return P}),P}function R(m){this.map={},m instanceof R?m.forEach(function(P,ee){this.append(ee,P)},this):Array.isArray(m)?m.forEach(function(P){this.append(P[0],P[1])},this):m&&Object.getOwnPropertyNames(m).forEach(function(P){this.append(P,m[P])},this)}R.prototype.append=function(m,P){m=I(m),P=S(P);var ee=this.map[m];this.map[m]=ee?ee+", "+P:P},R.prototype.delete=function(m){delete this.map[I(m)]},R.prototype.get=function(m){return m=I(m),this.has(m)?this.map[m]:null},R.prototype.has=function(m){return this.map.hasOwnProperty(I(m))},R.prototype.set=function(m,P){this.map[I(m)]=S(P)},R.prototype.forEach=function(m,P){for(var ee in this.map)this.map.hasOwnProperty(ee)&&m.call(P,this.map[ee],ee,this)},R.prototype.keys=function(){var m=[];return this.forEach(function(P,ee){m.push(ee)}),C(m)},R.prototype.values=function(){var m=[];return this.forEach(function(P){m.push(P)}),C(m)},R.prototype.entries=function(){var m=[];return this.forEach(function(P,ee){m.push([ee,P])}),C(m)},f.iterable&&(R.prototype[Symbol.iterator]=R.prototype.entries);function B(m){if(m.bodyUsed)return Promise.reject(new TypeError("Already read"));m.bodyUsed=!0}function K(m){return new Promise(function(P,ee){m.onload=function(){P(m.result)},m.onerror=function(){ee(m.error)}})}function se(m){var P=new FileReader,ee=K(P);return P.readAsArrayBuffer(m),ee}function $(m){var P=new FileReader,ee=K(P);return P.readAsText(m),ee}function U(m){for(var P=new Uint8Array(m),ee=new Array(P.length),Q=0;Q<P.length;Q++)ee[Q]=String.fromCharCode(P[Q]);return ee.join("")}function x(m){if(m.slice)return m.slice(0);var P=new Uint8Array(m.byteLength);return P.set(new Uint8Array(m)),P.buffer}function T(){return this.bodyUsed=!1,this._initBody=function(m){this._bodyInit=m,m?typeof m=="string"?this._bodyText=m:f.blob&&Blob.prototype.isPrototypeOf(m)?this._bodyBlob=m:f.formData&&FormData.prototype.isPrototypeOf(m)?this._bodyFormData=m:f.searchParams&&URLSearchParams.prototype.isPrototypeOf(m)?this._bodyText=m.toString():f.arrayBuffer&&f.blob&&v(m)?(this._bodyArrayBuffer=x(m.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):f.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(m)||w(m))?this._bodyArrayBuffer=x(m):this._bodyText=m=Object.prototype.toString.call(m):this._bodyText="",this.headers.get("content-type")||(typeof m=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):f.searchParams&&URLSearchParams.prototype.isPrototypeOf(m)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},f.blob&&(this.blob=function(){var m=B(this);if(m)return m;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?B(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(se)}),this.text=function(){var m=B(this);if(m)return m;if(this._bodyBlob)return $(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(U(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},f.formData&&(this.formData=function(){return this.text().then(G)}),this.json=function(){return this.text().then(JSON.parse)},this}var E=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function h(m){var P=m.toUpperCase();return E.indexOf(P)>-1?P:m}function b(m,P){P=P||{};var ee=P.body;if(m instanceof b){if(m.bodyUsed)throw new TypeError("Already read");this.url=m.url,this.credentials=m.credentials,P.headers||(this.headers=new R(m.headers)),this.method=m.method,this.mode=m.mode,this.signal=m.signal,!ee&&m._bodyInit!=null&&(ee=m._bodyInit,m.bodyUsed=!0)}else this.url=String(m);if(this.credentials=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new R(P.headers)),this.method=h(P.method||this.method||"GET"),this.mode=P.mode||this.mode||null,this.signal=P.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&ee)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(ee)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})};function G(m){var P=new FormData;return m.trim().split("&").forEach(function(ee){if(ee){var Q=ee.split("="),V=Q.shift().replace(/\+/g," "),k=Q.join("=").replace(/\+/g," ");P.append(decodeURIComponent(V),decodeURIComponent(k))}}),P}function Y(m){var P=new R,ee=m.replace(/\r?\n[\t ]+/g," ");return ee.split(/\r?\n/).forEach(function(Q){var V=Q.split(":"),k=V.shift().trim();if(k){var J=V.join(":").trim();P.append(k,J)}}),P}T.call(b.prototype);function ie(m,P){P||(P={}),this.type="default",this.status=P.status===void 0?200:P.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in P?P.statusText:"OK",this.headers=new R(P.headers),this.url=P.url||"",this._initBody(m)}T.call(ie.prototype),ie.prototype.clone=function(){return new ie(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new R(this.headers),url:this.url})},ie.error=function(){var m=new ie(null,{status:0,statusText:""});return m.type="error",m};var ce=[301,302,303,307,308];ie.redirect=function(m,P){if(ce.indexOf(P)===-1)throw new RangeError("Invalid status code");return new ie(null,{status:P,headers:{location:m}})},u.DOMException=c.DOMException;try{new u.DOMException}catch{u.DOMException=function(P,ee){this.message=P,this.name=ee;var Q=Error(P);this.stack=Q.stack},u.DOMException.prototype=Object.create(Error.prototype),u.DOMException.prototype.constructor=u.DOMException}function de(m,P){return new Promise(function(ee,Q){var V=new b(m,P);if(V.signal&&V.signal.aborted)return Q(new u.DOMException("Aborted","AbortError"));var k=new XMLHttpRequest;function J(){k.abort()}k.onload=function(){var re={status:k.status,statusText:k.statusText,headers:Y(k.getAllResponseHeaders()||"")};re.url="responseURL"in k?k.responseURL:re.headers.get("X-Request-URL");var me="response"in k?k.response:k.responseText;ee(new ie(me,re))},k.onerror=function(){Q(new TypeError("Network request failed"))},k.ontimeout=function(){Q(new TypeError("Network request failed"))},k.onabort=function(){Q(new u.DOMException("Aborted","AbortError"))},k.open(V.method,V.url,!0),V.credentials==="include"?k.withCredentials=!0:V.credentials==="omit"&&(k.withCredentials=!1),"responseType"in k&&f.blob&&(k.responseType="blob"),V.headers.forEach(function(re,me){k.setRequestHeader(me,re)}),V.signal&&(V.signal.addEventListener("abort",J),k.onreadystatechange=function(){k.readyState===4&&V.signal.removeEventListener("abort",J)}),k.send(typeof V._bodyInit>"u"?null:V._bodyInit)})}return de.polyfill=!0,c.fetch||(c.fetch=de,c.Headers=R,c.Request=b,c.Response=ie),u.Headers=R,u.Request=b,u.Response=ie,u.fetch=de,Object.defineProperty(u,"__esModule",{value:!0}),u})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var o=i;e=o.fetch,e.default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,n.exports=e})(Uc,Uc.exports);var wd=Ug(Uc.exports);const Ed={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},Dd=10;class Pn{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new Yt.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!Tf(e))throw new 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 new Error("Connection already closed");this.onClose()}async send(e,t){this.isAvailable||await this.register();try{const i=hs(e),c=await(await wd(this.url,Object.assign(Object.assign({},Ed),{body:i}))).json();this.onPayload({data:c})}catch(i){this.onError(e.id,i)}}async register(e=this.url){if(!Tf(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,o)=>{this.events.once("register_error",c=>{this.resetMaxListeners(),o(c)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return o(new Error("HTTP connection is missing or invalid"));i()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=hs({id:1,jsonrpc:"2.0",method:"test",params:[]});await wd(e,Object.assign(Object.assign({},Ed),{body:t}))}this.onOpen()}catch(t){const i=this.parseError(t);throw this.events.emit("register_error",i),this.onClose(),i}}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;const t=typeof e.data=="string"?gc(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),o=i.message||i.toString(),c=so(e,o);this.events.emit("payload",c)}parseError(e,t=this.url){return Sf(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>Dd&&this.events.setMaxListeners(Dd)}}const Sd="error",V3="wss://relay.walletconnect.com",k3="wc",G3="universal_provider",xd=`${k3}@2:${G3}:`,W3="https://rpc.walletconnect.com/v1/",fn={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var bs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},jc={exports:{}};/**
73
73
  * @license
74
74
  * Lodash <https://lodash.com/>
75
75
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
76
76
  * Released under MIT license <https://lodash.com/license>
77
77
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
78
78
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
79
- */(function(r,e){(function(){var t,i="4.17.21",o=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",u="Expected a function",f="Invalid `variable` option passed into `_.template`",v="__lodash_hash_undefined__",p=500,w="__lodash_placeholder__",I=1,S=2,C=4,R=1,B=2,K=1,se=2,$=4,U=8,x=16,T=32,E=64,h=128,b=256,G=512,Y=30,ie="...",ce=800,de=16,m=1,P=2,ee=3,Q=1/0,V=9007199254740991,k=17976931348623157e292,J=0/0,re=4294967295,me=re-1,oe=re>>>1,we=[["ary",h],["bind",K],["bindKey",se],["curry",U],["curryRight",x],["flip",G],["partial",T],["partialRight",E],["rearg",b]],le="[object Arguments]",_e="[object Array]",H="[object AsyncFunction]",q="[object Boolean]",F="[object Date]",d="[object DOMException]",A="[object Error]",ae="[object Function]",fe="[object GeneratorFunction]",xe="[object Map]",Be="[object Number]",Ve="[object Null]",Ue="[object Object]",vt="[object Promise]",yt="[object Proxy]",Me="[object RegExp]",Oe="[object Set]",$e="[object String]",Fe="[object Symbol]",qe="[object Undefined]",Pe="[object WeakMap]",Le="[object WeakSet]",Se="[object ArrayBuffer]",Ce="[object DataView]",ze="[object Float32Array]",Ie="[object Float64Array]",ke="[object Int8Array]",We="[object Int16Array]",et="[object Int32Array]",tt="[object Uint8Array]",Qe="[object Uint8ClampedArray]",cr="[object Uint16Array]",yr="[object Uint32Array]",en=/\b__p \+= '';/g,ur=/\b(__p \+=) '' \+/g,pn=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Tn=/&(?:amp|lt|gt|quot|#39);/g,Xn=/[&<>"']/g,Dt=RegExp(Tn.source),_t=RegExp(Xn.source),St=/<%-([\s\S]+?)%>/g,xt=/<%([\s\S]+?)%>/g,wt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Lt=/^\w*$/,Ut=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ot=/[\\^$.*+?()[\]{}|]/g,jt=RegExp(Ot.source),It=/^\s+/,Tt=/\s/,Pt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ft=/\{\n\/\* \[wrapped with (.+)\] \*/,Mt=/,? & /,qt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Vc=/[()=,{}\[\]\/\s]/,kc=/\\(\\)?/g,Gc=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Rr=/\w*$/,Wc=/^[-+]0x[0-9a-f]+$/i,Yc=/^0b[01]+$/i,Jc=/^\[object .+?Constructor\]$/,Qc=/^0o[0-7]+$/i,Xc=/^(?:0|[1-9]\d*)$/,gn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Si=/($^)/,Zc=/['\n\r\u2028\u2029\\]/g,xi="\\ud800-\\udfff",eu="\\u0300-\\u036f",tu="\\ufe20-\\ufe2f",Oi="\\u20d0-\\u20ff",_o=eu+tu+Oi,bo="\\u2700-\\u27bf",Vr="a-z\\xdf-\\xf6\\xf8-\\xff",ru="\\xac\\xb1\\xd7\\xf7",nu="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",iu="\\u2000-\\u206f",su=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",mo="A-Z\\xc0-\\xd6\\xd8-\\xde",wo="\\ufe0e\\ufe0f",Zn=ru+nu+iu+su,Es="['\u2019]",ei="["+xi+"]",Ds="["+Zn+"]",ti="["+_o+"]",Eo="\\d+",ou="["+bo+"]",Do="["+Vr+"]",So="[^"+xi+Zn+Eo+bo+Vr+mo+"]",Ii="\\ud83c[\\udffb-\\udfff]",au="(?:"+ti+"|"+Ii+")",xo="[^"+xi+"]",Pi="(?:\\ud83c[\\udde6-\\uddff]){2}",Rn="[\\ud800-\\udbff][\\udc00-\\udfff]",xr="["+mo+"]",Oo="\\u200d",Io="(?:"+Do+"|"+So+")",tn="(?:"+xr+"|"+So+")",Po="(?:"+Es+"(?:d|ll|m|re|s|t|ve))?",Co="(?:"+Es+"(?:D|LL|M|RE|S|T|VE))?",Ao=au+"?",To="["+wo+"]?",cu="(?:"+Oo+"(?:"+[xo,Pi,Rn].join("|")+")"+To+Ao+")*",vn="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ro="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",No=To+Ao+cu,Ci="(?:"+[ou,Pi,Rn].join("|")+")"+No,uu="(?:"+[xo+ti+"?",ti,Pi,Rn,ei].join("|")+")",Ss=RegExp(Es,"g"),hu=RegExp(ti,"g"),Ai=RegExp(Ii+"(?="+Ii+")|"+uu+No,"g"),$o=RegExp([xr+"?"+Do+"+"+Po+"(?="+[Ds,xr,"$"].join("|")+")",tn+"+"+Co+"(?="+[Ds,xr+Io,"$"].join("|")+")",xr+"?"+Io+"+"+Po,xr+"+"+Co,Ro,vn,Eo,Ci].join("|"),"g"),Fo=RegExp("["+Oo+xi+_o+wo+"]"),ri=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Lo=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],lu=-1,at={};at[ze]=at[Ie]=at[ke]=at[We]=at[et]=at[tt]=at[Qe]=at[cr]=at[yr]=!0,at[le]=at[_e]=at[Se]=at[q]=at[Ce]=at[F]=at[A]=at[ae]=at[xe]=at[Be]=at[Ue]=at[Me]=at[Oe]=at[$e]=at[Pe]=!1;var ot={};ot[le]=ot[_e]=ot[Se]=ot[Ce]=ot[q]=ot[F]=ot[ze]=ot[Ie]=ot[ke]=ot[We]=ot[et]=ot[xe]=ot[Be]=ot[Ue]=ot[Me]=ot[Oe]=ot[$e]=ot[Fe]=ot[tt]=ot[Qe]=ot[cr]=ot[yr]=!0,ot[A]=ot[ae]=ot[Pe]=!1;var D={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},L={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},te={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},pe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ct=parseFloat,Te=parseInt,dt=typeof ms=="object"&&ms&&ms.Object===Object&&ms,Ht=typeof self=="object"&&self&&self.Object===Object&&self,Xe=dt||Ht||Function("return this")(),ut=e&&!e.nodeType&&e,Rt=ut&&!0&&r&&!r.nodeType&&r,_r=Rt&&Rt.exports===ut,Bt=_r&&dt.process,pt=function(){try{var j=Rt&&Rt.require&&Rt.require("util").types;return j||Bt&&Bt.binding&&Bt.binding("util")}catch{}}(),hr=pt&&pt.isArrayBuffer,kr=pt&&pt.isDate,Nr=pt&&pt.isMap,rn=pt&&pt.isRegExp,xs=pt&&pt.isSet,ni=pt&&pt.isTypedArray;function Gt(j,W,z){switch(z.length){case 0:return j.call(W);case 1:return j.call(W,z[0]);case 2:return j.call(W,z[0],z[1]);case 3:return j.call(W,z[0],z[1],z[2])}return j.apply(W,z)}function L2(j,W,z,ge){for(var Ae=-1,rt=j==null?0:j.length;++Ae<rt;){var zt=j[Ae];W(ge,zt,z(zt),j)}return ge}function $r(j,W){for(var z=-1,ge=j==null?0:j.length;++z<ge&&W(j[z],z,j)!==!1;);return j}function U2(j,W){for(var z=j==null?0:j.length;z--&&W(j[z],z,j)!==!1;);return j}function Hd(j,W){for(var z=-1,ge=j==null?0:j.length;++z<ge;)if(!W(j[z],z,j))return!1;return!0}function Nn(j,W){for(var z=-1,ge=j==null?0:j.length,Ae=0,rt=[];++z<ge;){var zt=j[z];W(zt,z,j)&&(rt[Ae++]=zt)}return rt}function Uo(j,W){var z=j==null?0:j.length;return!!z&&Ti(j,W,0)>-1}function fu(j,W,z){for(var ge=-1,Ae=j==null?0:j.length;++ge<Ae;)if(z(W,j[ge]))return!0;return!1}function mt(j,W){for(var z=-1,ge=j==null?0:j.length,Ae=Array(ge);++z<ge;)Ae[z]=W(j[z],z,j);return Ae}function $n(j,W){for(var z=-1,ge=W.length,Ae=j.length;++z<ge;)j[Ae+z]=W[z];return j}function du(j,W,z,ge){var Ae=-1,rt=j==null?0:j.length;for(ge&&rt&&(z=j[++Ae]);++Ae<rt;)z=W(z,j[Ae],Ae,j);return z}function j2(j,W,z,ge){var Ae=j==null?0:j.length;for(ge&&Ae&&(z=j[--Ae]);Ae--;)z=W(z,j[Ae],Ae,j);return z}function pu(j,W){for(var z=-1,ge=j==null?0:j.length;++z<ge;)if(W(j[z],z,j))return!0;return!1}var M2=gu("length");function q2(j){return j.split("")}function H2(j){return j.match(qt)||[]}function Bd(j,W,z){var ge;return z(j,function(Ae,rt,zt){if(W(Ae,rt,zt))return ge=rt,!1}),ge}function jo(j,W,z,ge){for(var Ae=j.length,rt=z+(ge?1:-1);ge?rt--:++rt<Ae;)if(W(j[rt],rt,j))return rt;return-1}function Ti(j,W,z){return W===W?Z2(j,W,z):jo(j,zd,z)}function B2(j,W,z,ge){for(var Ae=z-1,rt=j.length;++Ae<rt;)if(ge(j[Ae],W))return Ae;return-1}function zd(j){return j!==j}function Kd(j,W){var z=j==null?0:j.length;return z?yu(j,W)/z:J}function gu(j){return function(W){return W==null?t:W[j]}}function vu(j){return function(W){return j==null?t:j[W]}}function Vd(j,W,z,ge,Ae){return Ae(j,function(rt,zt,ht){z=ge?(ge=!1,rt):W(z,rt,zt,ht)}),z}function z2(j,W){var z=j.length;for(j.sort(W);z--;)j[z]=j[z].value;return j}function yu(j,W){for(var z,ge=-1,Ae=j.length;++ge<Ae;){var rt=W(j[ge]);rt!==t&&(z=z===t?rt:z+rt)}return z}function _u(j,W){for(var z=-1,ge=Array(j);++z<j;)ge[z]=W(z);return ge}function K2(j,W){return mt(W,function(z){return[z,j[z]]})}function kd(j){return j&&j.slice(0,Jd(j)+1).replace(It,"")}function Or(j){return function(W){return j(W)}}function bu(j,W){return mt(W,function(z){return j[z]})}function Os(j,W){return j.has(W)}function Gd(j,W){for(var z=-1,ge=j.length;++z<ge&&Ti(W,j[z],0)>-1;);return z}function Wd(j,W){for(var z=j.length;z--&&Ti(W,j[z],0)>-1;);return z}function V2(j,W){for(var z=j.length,ge=0;z--;)j[z]===W&&++ge;return ge}var k2=vu(D),G2=vu(L);function W2(j){return"\\"+pe[j]}function Y2(j,W){return j==null?t:j[W]}function Ri(j){return Fo.test(j)}function J2(j){return ri.test(j)}function Q2(j){for(var W,z=[];!(W=j.next()).done;)z.push(W.value);return z}function mu(j){var W=-1,z=Array(j.size);return j.forEach(function(ge,Ae){z[++W]=[Ae,ge]}),z}function Yd(j,W){return function(z){return j(W(z))}}function Fn(j,W){for(var z=-1,ge=j.length,Ae=0,rt=[];++z<ge;){var zt=j[z];(zt===W||zt===w)&&(j[z]=w,rt[Ae++]=z)}return rt}function Mo(j){var W=-1,z=Array(j.size);return j.forEach(function(ge){z[++W]=ge}),z}function X2(j){var W=-1,z=Array(j.size);return j.forEach(function(ge){z[++W]=[ge,ge]}),z}function Z2(j,W,z){for(var ge=z-1,Ae=j.length;++ge<Ae;)if(j[ge]===W)return ge;return-1}function e6(j,W,z){for(var ge=z+1;ge--;)if(j[ge]===W)return ge;return ge}function Ni(j){return Ri(j)?r6(j):M2(j)}function Gr(j){return Ri(j)?n6(j):q2(j)}function Jd(j){for(var W=j.length;W--&&Tt.test(j.charAt(W)););return W}var t6=vu(te);function r6(j){for(var W=Ai.lastIndex=0;Ai.test(j);)++W;return W}function n6(j){return j.match(Ai)||[]}function i6(j){return j.match($o)||[]}var s6=function j(W){W=W==null?Xe:$i.defaults(Xe.Object(),W,$i.pick(Xe,Lo));var z=W.Array,ge=W.Date,Ae=W.Error,rt=W.Function,zt=W.Math,ht=W.Object,wu=W.RegExp,o6=W.String,Fr=W.TypeError,qo=z.prototype,a6=rt.prototype,Fi=ht.prototype,Ho=W["__core-js_shared__"],Bo=a6.toString,it=Fi.hasOwnProperty,c6=0,Qd=function(){var n=/[^.]+$/.exec(Ho&&Ho.keys&&Ho.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),zo=Fi.toString,u6=Bo.call(ht),h6=Xe._,l6=wu("^"+Bo.call(it).replace(Ot,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ko=_r?W.Buffer:t,Ln=W.Symbol,Vo=W.Uint8Array,Xd=Ko?Ko.allocUnsafe:t,ko=Yd(ht.getPrototypeOf,ht),Zd=ht.create,ep=Fi.propertyIsEnumerable,Go=qo.splice,tp=Ln?Ln.isConcatSpreadable:t,Is=Ln?Ln.iterator:t,ii=Ln?Ln.toStringTag:t,Wo=function(){try{var n=ui(ht,"defineProperty");return n({},"",{}),n}catch{}}(),f6=W.clearTimeout!==Xe.clearTimeout&&W.clearTimeout,d6=ge&&ge.now!==Xe.Date.now&&ge.now,p6=W.setTimeout!==Xe.setTimeout&&W.setTimeout,Yo=zt.ceil,Jo=zt.floor,Eu=ht.getOwnPropertySymbols,g6=Ko?Ko.isBuffer:t,rp=W.isFinite,v6=qo.join,y6=Yd(ht.keys,ht),Kt=zt.max,tr=zt.min,_6=ge.now,b6=W.parseInt,np=zt.random,m6=qo.reverse,Du=ui(W,"DataView"),Ps=ui(W,"Map"),Su=ui(W,"Promise"),Li=ui(W,"Set"),Cs=ui(W,"WeakMap"),As=ui(ht,"create"),Qo=Cs&&new Cs,Ui={},w6=hi(Du),E6=hi(Ps),D6=hi(Su),S6=hi(Li),x6=hi(Cs),Xo=Ln?Ln.prototype:t,Ts=Xo?Xo.valueOf:t,ip=Xo?Xo.toString:t;function y(n){if(Ct(n)&&!Re(n)&&!(n instanceof Ye)){if(n instanceof Lr)return n;if(it.call(n,"__wrapped__"))return sg(n)}return new Lr(n)}var ji=function(){function n(){}return function(s){if(!Et(s))return{};if(Zd)return Zd(s);n.prototype=s;var c=new n;return n.prototype=t,c}}();function Zo(){}function Lr(n,s){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!s,this.__index__=0,this.__values__=t}y.templateSettings={escape:St,evaluate:xt,interpolate:wt,variable:"",imports:{_:y}},y.prototype=Zo.prototype,y.prototype.constructor=y,Lr.prototype=ji(Zo.prototype),Lr.prototype.constructor=Lr;function Ye(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=re,this.__views__=[]}function O6(){var n=new Ye(this.__wrapped__);return n.__actions__=br(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=br(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=br(this.__views__),n}function I6(){if(this.__filtered__){var n=new Ye(this);n.__dir__=-1,n.__filtered__=!0}else n=this.clone(),n.__dir__*=-1;return n}function P6(){var n=this.__wrapped__.value(),s=this.__dir__,c=Re(n),l=s<0,g=c?n.length:0,_=qD(0,g,this.__views__),O=_.start,N=_.end,M=N-O,X=l?N:O-1,Z=this.__iteratees__,ne=Z.length,ue=0,ve=tr(M,this.__takeCount__);if(!c||!l&&g==M&&ve==M)return Pp(n,this.__actions__);var Ee=[];e:for(;M--&&ue<ve;){X+=s;for(var He=-1,De=n[X];++He<ne;){var Ge=Z[He],Ze=Ge.iteratee,Cr=Ge.type,dr=Ze(De);if(Cr==P)De=dr;else if(!dr){if(Cr==m)continue e;break e}}Ee[ue++]=De}return Ee}Ye.prototype=ji(Zo.prototype),Ye.prototype.constructor=Ye;function si(n){var s=-1,c=n==null?0:n.length;for(this.clear();++s<c;){var l=n[s];this.set(l[0],l[1])}}function C6(){this.__data__=As?As(null):{},this.size=0}function A6(n){var s=this.has(n)&&delete this.__data__[n];return this.size-=s?1:0,s}function T6(n){var s=this.__data__;if(As){var c=s[n];return c===v?t:c}return it.call(s,n)?s[n]:t}function R6(n){var s=this.__data__;return As?s[n]!==t:it.call(s,n)}function N6(n,s){var c=this.__data__;return this.size+=this.has(n)?0:1,c[n]=As&&s===t?v:s,this}si.prototype.clear=C6,si.prototype.delete=A6,si.prototype.get=T6,si.prototype.has=R6,si.prototype.set=N6;function yn(n){var s=-1,c=n==null?0:n.length;for(this.clear();++s<c;){var l=n[s];this.set(l[0],l[1])}}function $6(){this.__data__=[],this.size=0}function F6(n){var s=this.__data__,c=ea(s,n);if(c<0)return!1;var l=s.length-1;return c==l?s.pop():Go.call(s,c,1),--this.size,!0}function L6(n){var s=this.__data__,c=ea(s,n);return c<0?t:s[c][1]}function U6(n){return ea(this.__data__,n)>-1}function j6(n,s){var c=this.__data__,l=ea(c,n);return l<0?(++this.size,c.push([n,s])):c[l][1]=s,this}yn.prototype.clear=$6,yn.prototype.delete=F6,yn.prototype.get=L6,yn.prototype.has=U6,yn.prototype.set=j6;function _n(n){var s=-1,c=n==null?0:n.length;for(this.clear();++s<c;){var l=n[s];this.set(l[0],l[1])}}function M6(){this.size=0,this.__data__={hash:new si,map:new(Ps||yn),string:new si}}function q6(n){var s=fa(this,n).delete(n);return this.size-=s?1:0,s}function H6(n){return fa(this,n).get(n)}function B6(n){return fa(this,n).has(n)}function z6(n,s){var c=fa(this,n),l=c.size;return c.set(n,s),this.size+=c.size==l?0:1,this}_n.prototype.clear=M6,_n.prototype.delete=q6,_n.prototype.get=H6,_n.prototype.has=B6,_n.prototype.set=z6;function oi(n){var s=-1,c=n==null?0:n.length;for(this.__data__=new _n;++s<c;)this.add(n[s])}function K6(n){return this.__data__.set(n,v),this}function V6(n){return this.__data__.has(n)}oi.prototype.add=oi.prototype.push=K6,oi.prototype.has=V6;function Wr(n){var s=this.__data__=new yn(n);this.size=s.size}function k6(){this.__data__=new yn,this.size=0}function G6(n){var s=this.__data__,c=s.delete(n);return this.size=s.size,c}function W6(n){return this.__data__.get(n)}function Y6(n){return this.__data__.has(n)}function J6(n,s){var c=this.__data__;if(c instanceof yn){var l=c.__data__;if(!Ps||l.length<o-1)return l.push([n,s]),this.size=++c.size,this;c=this.__data__=new _n(l)}return c.set(n,s),this.size=c.size,this}Wr.prototype.clear=k6,Wr.prototype.delete=G6,Wr.prototype.get=W6,Wr.prototype.has=Y6,Wr.prototype.set=J6;function sp(n,s){var c=Re(n),l=!c&&li(n),g=!c&&!l&&Hn(n),_=!c&&!l&&!g&&Bi(n),O=c||l||g||_,N=O?_u(n.length,o6):[],M=N.length;for(var X in n)(s||it.call(n,X))&&!(O&&(X=="length"||g&&(X=="offset"||X=="parent")||_&&(X=="buffer"||X=="byteLength"||X=="byteOffset")||En(X,M)))&&N.push(X);return N}function op(n){var s=n.length;return s?n[Fu(0,s-1)]:t}function Q6(n,s){return da(br(n),ai(s,0,n.length))}function X6(n){return da(br(n))}function xu(n,s,c){(c!==t&&!Yr(n[s],c)||c===t&&!(s in n))&&bn(n,s,c)}function Rs(n,s,c){var l=n[s];(!(it.call(n,s)&&Yr(l,c))||c===t&&!(s in n))&&bn(n,s,c)}function ea(n,s){for(var c=n.length;c--;)if(Yr(n[c][0],s))return c;return-1}function Z6(n,s,c,l){return Un(n,function(g,_,O){s(l,g,c(g),O)}),l}function ap(n,s){return n&&sn(s,Wt(s),n)}function eD(n,s){return n&&sn(s,wr(s),n)}function bn(n,s,c){s=="__proto__"&&Wo?Wo(n,s,{configurable:!0,enumerable:!0,value:c,writable:!0}):n[s]=c}function Ou(n,s){for(var c=-1,l=s.length,g=z(l),_=n==null;++c<l;)g[c]=_?t:oh(n,s[c]);return g}function ai(n,s,c){return n===n&&(c!==t&&(n=n<=c?n:c),s!==t&&(n=n>=s?n:s)),n}function Ur(n,s,c,l,g,_){var O,N=s&I,M=s&S,X=s&C;if(c&&(O=g?c(n,l,g,_):c(n)),O!==t)return O;if(!Et(n))return n;var Z=Re(n);if(Z){if(O=BD(n),!N)return br(n,O)}else{var ne=rr(n),ue=ne==ae||ne==fe;if(Hn(n))return Tp(n,N);if(ne==Ue||ne==le||ue&&!g){if(O=M||ue?{}:Jp(n),!N)return M?TD(n,eD(O,n)):AD(n,ap(O,n))}else{if(!ot[ne])return g?n:{};O=zD(n,ne,N)}}_||(_=new Wr);var ve=_.get(n);if(ve)return ve;_.set(n,O),xg(n)?n.forEach(function(De){O.add(Ur(De,s,c,De,n,_))}):Dg(n)&&n.forEach(function(De,Ge){O.set(Ge,Ur(De,s,c,Ge,n,_))});var Ee=X?M?ku:Vu:M?wr:Wt,He=Z?t:Ee(n);return $r(He||n,function(De,Ge){He&&(Ge=De,De=n[Ge]),Rs(O,Ge,Ur(De,s,c,Ge,n,_))}),O}function tD(n){var s=Wt(n);return function(c){return cp(c,n,s)}}function cp(n,s,c){var l=c.length;if(n==null)return!l;for(n=ht(n);l--;){var g=c[l],_=s[g],O=n[g];if(O===t&&!(g in n)||!_(O))return!1}return!0}function up(n,s,c){if(typeof n!="function")throw new Fr(u);return Ms(function(){n.apply(t,c)},s)}function Ns(n,s,c,l){var g=-1,_=Uo,O=!0,N=n.length,M=[],X=s.length;if(!N)return M;c&&(s=mt(s,Or(c))),l?(_=fu,O=!1):s.length>=o&&(_=Os,O=!1,s=new oi(s));e:for(;++g<N;){var Z=n[g],ne=c==null?Z:c(Z);if(Z=l||Z!==0?Z:0,O&&ne===ne){for(var ue=X;ue--;)if(s[ue]===ne)continue e;M.push(Z)}else _(s,ne,l)||M.push(Z)}return M}var Un=Lp(nn),hp=Lp(Pu,!0);function rD(n,s){var c=!0;return Un(n,function(l,g,_){return c=!!s(l,g,_),c}),c}function ta(n,s,c){for(var l=-1,g=n.length;++l<g;){var _=n[l],O=s(_);if(O!=null&&(N===t?O===O&&!Pr(O):c(O,N)))var N=O,M=_}return M}function nD(n,s,c,l){var g=n.length;for(c=je(c),c<0&&(c=-c>g?0:g+c),l=l===t||l>g?g:je(l),l<0&&(l+=g),l=c>l?0:Ig(l);c<l;)n[c++]=s;return n}function lp(n,s){var c=[];return Un(n,function(l,g,_){s(l,g,_)&&c.push(l)}),c}function Xt(n,s,c,l,g){var _=-1,O=n.length;for(c||(c=VD),g||(g=[]);++_<O;){var N=n[_];s>0&&c(N)?s>1?Xt(N,s-1,c,l,g):$n(g,N):l||(g[g.length]=N)}return g}var Iu=Up(),fp=Up(!0);function nn(n,s){return n&&Iu(n,s,Wt)}function Pu(n,s){return n&&fp(n,s,Wt)}function ra(n,s){return Nn(s,function(c){return Dn(n[c])})}function ci(n,s){s=Mn(s,n);for(var c=0,l=s.length;n!=null&&c<l;)n=n[on(s[c++])];return c&&c==l?n:t}function dp(n,s,c){var l=s(n);return Re(n)?l:$n(l,c(n))}function lr(n){return n==null?n===t?qe:Ve:ii&&ii in ht(n)?MD(n):XD(n)}function Cu(n,s){return n>s}function iD(n,s){return n!=null&&it.call(n,s)}function sD(n,s){return n!=null&&s in ht(n)}function oD(n,s,c){return n>=tr(s,c)&&n<Kt(s,c)}function Au(n,s,c){for(var l=c?fu:Uo,g=n[0].length,_=n.length,O=_,N=z(_),M=1/0,X=[];O--;){var Z=n[O];O&&s&&(Z=mt(Z,Or(s))),M=tr(Z.length,M),N[O]=!c&&(s||g>=120&&Z.length>=120)?new oi(O&&Z):t}Z=n[0];var ne=-1,ue=N[0];e:for(;++ne<g&&X.length<M;){var ve=Z[ne],Ee=s?s(ve):ve;if(ve=c||ve!==0?ve:0,!(ue?Os(ue,Ee):l(X,Ee,c))){for(O=_;--O;){var He=N[O];if(!(He?Os(He,Ee):l(n[O],Ee,c)))continue e}ue&&ue.push(Ee),X.push(ve)}}return X}function aD(n,s,c,l){return nn(n,function(g,_,O){s(l,c(g),_,O)}),l}function $s(n,s,c){s=Mn(s,n),n=eg(n,s);var l=n==null?n:n[on(Mr(s))];return l==null?t:Gt(l,n,c)}function pp(n){return Ct(n)&&lr(n)==le}function cD(n){return Ct(n)&&lr(n)==Se}function uD(n){return Ct(n)&&lr(n)==F}function Fs(n,s,c,l,g){return n===s?!0:n==null||s==null||!Ct(n)&&!Ct(s)?n!==n&&s!==s:hD(n,s,c,l,Fs,g)}function hD(n,s,c,l,g,_){var O=Re(n),N=Re(s),M=O?_e:rr(n),X=N?_e:rr(s);M=M==le?Ue:M,X=X==le?Ue:X;var Z=M==Ue,ne=X==Ue,ue=M==X;if(ue&&Hn(n)){if(!Hn(s))return!1;O=!0,Z=!1}if(ue&&!Z)return _||(_=new Wr),O||Bi(n)?Gp(n,s,c,l,g,_):UD(n,s,M,c,l,g,_);if(!(c&R)){var ve=Z&&it.call(n,"__wrapped__"),Ee=ne&&it.call(s,"__wrapped__");if(ve||Ee){var He=ve?n.value():n,De=Ee?s.value():s;return _||(_=new Wr),g(He,De,c,l,_)}}return ue?(_||(_=new Wr),jD(n,s,c,l,g,_)):!1}function lD(n){return Ct(n)&&rr(n)==xe}function Tu(n,s,c,l){var g=c.length,_=g,O=!l;if(n==null)return!_;for(n=ht(n);g--;){var N=c[g];if(O&&N[2]?N[1]!==n[N[0]]:!(N[0]in n))return!1}for(;++g<_;){N=c[g];var M=N[0],X=n[M],Z=N[1];if(O&&N[2]){if(X===t&&!(M in n))return!1}else{var ne=new Wr;if(l)var ue=l(X,Z,M,n,s,ne);if(!(ue===t?Fs(Z,X,R|B,l,ne):ue))return!1}}return!0}function gp(n){if(!Et(n)||GD(n))return!1;var s=Dn(n)?l6:Jc;return s.test(hi(n))}function fD(n){return Ct(n)&&lr(n)==Me}function dD(n){return Ct(n)&&rr(n)==Oe}function pD(n){return Ct(n)&&ba(n.length)&&!!at[lr(n)]}function vp(n){return typeof n=="function"?n:n==null?Er:typeof n=="object"?Re(n)?bp(n[0],n[1]):_p(n):jg(n)}function Ru(n){if(!js(n))return y6(n);var s=[];for(var c in ht(n))it.call(n,c)&&c!="constructor"&&s.push(c);return s}function gD(n){if(!Et(n))return QD(n);var s=js(n),c=[];for(var l in n)l=="constructor"&&(s||!it.call(n,l))||c.push(l);return c}function Nu(n,s){return n<s}function yp(n,s){var c=-1,l=mr(n)?z(n.length):[];return Un(n,function(g,_,O){l[++c]=s(g,_,O)}),l}function _p(n){var s=Wu(n);return s.length==1&&s[0][2]?Xp(s[0][0],s[0][1]):function(c){return c===n||Tu(c,n,s)}}function bp(n,s){return Ju(n)&&Qp(s)?Xp(on(n),s):function(c){var l=oh(c,n);return l===t&&l===s?ah(c,n):Fs(s,l,R|B)}}function na(n,s,c,l,g){n!==s&&Iu(s,function(_,O){if(g||(g=new Wr),Et(_))vD(n,s,O,c,na,l,g);else{var N=l?l(Xu(n,O),_,O+"",n,s,g):t;N===t&&(N=_),xu(n,O,N)}},wr)}function vD(n,s,c,l,g,_,O){var N=Xu(n,c),M=Xu(s,c),X=O.get(M);if(X){xu(n,c,X);return}var Z=_?_(N,M,c+"",n,s,O):t,ne=Z===t;if(ne){var ue=Re(M),ve=!ue&&Hn(M),Ee=!ue&&!ve&&Bi(M);Z=M,ue||ve||Ee?Re(N)?Z=N:Nt(N)?Z=br(N):ve?(ne=!1,Z=Tp(M,!0)):Ee?(ne=!1,Z=Rp(M,!0)):Z=[]:qs(M)||li(M)?(Z=N,li(N)?Z=Pg(N):(!Et(N)||Dn(N))&&(Z=Jp(M))):ne=!1}ne&&(O.set(M,Z),g(Z,M,l,_,O),O.delete(M)),xu(n,c,Z)}function mp(n,s){var c=n.length;if(c)return s+=s<0?c:0,En(s,c)?n[s]:t}function wp(n,s,c){s.length?s=mt(s,function(_){return Re(_)?function(O){return ci(O,_.length===1?_[0]:_)}:_}):s=[Er];var l=-1;s=mt(s,Or(be()));var g=yp(n,function(_,O,N){var M=mt(s,function(X){return X(_)});return{criteria:M,index:++l,value:_}});return z2(g,function(_,O){return CD(_,O,c)})}function yD(n,s){return Ep(n,s,function(c,l){return ah(n,l)})}function Ep(n,s,c){for(var l=-1,g=s.length,_={};++l<g;){var O=s[l],N=ci(n,O);c(N,O)&&Ls(_,Mn(O,n),N)}return _}function _D(n){return function(s){return ci(s,n)}}function $u(n,s,c,l){var g=l?B2:Ti,_=-1,O=s.length,N=n;for(n===s&&(s=br(s)),c&&(N=mt(n,Or(c)));++_<O;)for(var M=0,X=s[_],Z=c?c(X):X;(M=g(N,Z,M,l))>-1;)N!==n&&Go.call(N,M,1),Go.call(n,M,1);return n}function Dp(n,s){for(var c=n?s.length:0,l=c-1;c--;){var g=s[c];if(c==l||g!==_){var _=g;En(g)?Go.call(n,g,1):ju(n,g)}}return n}function Fu(n,s){return n+Jo(np()*(s-n+1))}function bD(n,s,c,l){for(var g=-1,_=Kt(Yo((s-n)/(c||1)),0),O=z(_);_--;)O[l?_:++g]=n,n+=c;return O}function Lu(n,s){var c="";if(!n||s<1||s>V)return c;do s%2&&(c+=n),s=Jo(s/2),s&&(n+=n);while(s);return c}function Ke(n,s){return Zu(Zp(n,s,Er),n+"")}function mD(n){return op(zi(n))}function wD(n,s){var c=zi(n);return da(c,ai(s,0,c.length))}function Ls(n,s,c,l){if(!Et(n))return n;s=Mn(s,n);for(var g=-1,_=s.length,O=_-1,N=n;N!=null&&++g<_;){var M=on(s[g]),X=c;if(M==="__proto__"||M==="constructor"||M==="prototype")return n;if(g!=O){var Z=N[M];X=l?l(Z,M,N):t,X===t&&(X=Et(Z)?Z:En(s[g+1])?[]:{})}Rs(N,M,X),N=N[M]}return n}var Sp=Qo?function(n,s){return Qo.set(n,s),n}:Er,ED=Wo?function(n,s){return Wo(n,"toString",{configurable:!0,enumerable:!1,value:uh(s),writable:!0})}:Er;function DD(n){return da(zi(n))}function jr(n,s,c){var l=-1,g=n.length;s<0&&(s=-s>g?0:g+s),c=c>g?g:c,c<0&&(c+=g),g=s>c?0:c-s>>>0,s>>>=0;for(var _=z(g);++l<g;)_[l]=n[l+s];return _}function SD(n,s){var c;return Un(n,function(l,g,_){return c=s(l,g,_),!c}),!!c}function ia(n,s,c){var l=0,g=n==null?l:n.length;if(typeof s=="number"&&s===s&&g<=oe){for(;l<g;){var _=l+g>>>1,O=n[_];O!==null&&!Pr(O)&&(c?O<=s:O<s)?l=_+1:g=_}return g}return Uu(n,s,Er,c)}function Uu(n,s,c,l){var g=0,_=n==null?0:n.length;if(_===0)return 0;s=c(s);for(var O=s!==s,N=s===null,M=Pr(s),X=s===t;g<_;){var Z=Jo((g+_)/2),ne=c(n[Z]),ue=ne!==t,ve=ne===null,Ee=ne===ne,He=Pr(ne);if(O)var De=l||Ee;else X?De=Ee&&(l||ue):N?De=Ee&&ue&&(l||!ve):M?De=Ee&&ue&&!ve&&(l||!He):ve||He?De=!1:De=l?ne<=s:ne<s;De?g=Z+1:_=Z}return tr(_,me)}function xp(n,s){for(var c=-1,l=n.length,g=0,_=[];++c<l;){var O=n[c],N=s?s(O):O;if(!c||!Yr(N,M)){var M=N;_[g++]=O===0?0:O}}return _}function Op(n){return typeof n=="number"?n:Pr(n)?J:+n}function Ir(n){if(typeof n=="string")return n;if(Re(n))return mt(n,Ir)+"";if(Pr(n))return ip?ip.call(n):"";var s=n+"";return s=="0"&&1/n==-Q?"-0":s}function jn(n,s,c){var l=-1,g=Uo,_=n.length,O=!0,N=[],M=N;if(c)O=!1,g=fu;else if(_>=o){var X=s?null:FD(n);if(X)return Mo(X);O=!1,g=Os,M=new oi}else M=s?[]:N;e:for(;++l<_;){var Z=n[l],ne=s?s(Z):Z;if(Z=c||Z!==0?Z:0,O&&ne===ne){for(var ue=M.length;ue--;)if(M[ue]===ne)continue e;s&&M.push(ne),N.push(Z)}else g(M,ne,c)||(M!==N&&M.push(ne),N.push(Z))}return N}function ju(n,s){return s=Mn(s,n),n=eg(n,s),n==null||delete n[on(Mr(s))]}function Ip(n,s,c,l){return Ls(n,s,c(ci(n,s)),l)}function sa(n,s,c,l){for(var g=n.length,_=l?g:-1;(l?_--:++_<g)&&s(n[_],_,n););return c?jr(n,l?0:_,l?_+1:g):jr(n,l?_+1:0,l?g:_)}function Pp(n,s){var c=n;return c instanceof Ye&&(c=c.value()),du(s,function(l,g){return g.func.apply(g.thisArg,$n([l],g.args))},c)}function Mu(n,s,c){var l=n.length;if(l<2)return l?jn(n[0]):[];for(var g=-1,_=z(l);++g<l;)for(var O=n[g],N=-1;++N<l;)N!=g&&(_[g]=Ns(_[g]||O,n[N],s,c));return jn(Xt(_,1),s,c)}function Cp(n,s,c){for(var l=-1,g=n.length,_=s.length,O={};++l<g;){var N=l<_?s[l]:t;c(O,n[l],N)}return O}function qu(n){return Nt(n)?n:[]}function Hu(n){return typeof n=="function"?n:Er}function Mn(n,s){return Re(n)?n:Ju(n,s)?[n]:ig(nt(n))}var xD=Ke;function qn(n,s,c){var l=n.length;return c=c===t?l:c,!s&&c>=l?n:jr(n,s,c)}var Ap=f6||function(n){return Xe.clearTimeout(n)};function Tp(n,s){if(s)return n.slice();var c=n.length,l=Xd?Xd(c):new n.constructor(c);return n.copy(l),l}function Bu(n){var s=new n.constructor(n.byteLength);return new Vo(s).set(new Vo(n)),s}function OD(n,s){var c=s?Bu(n.buffer):n.buffer;return new n.constructor(c,n.byteOffset,n.byteLength)}function ID(n){var s=new n.constructor(n.source,Rr.exec(n));return s.lastIndex=n.lastIndex,s}function PD(n){return Ts?ht(Ts.call(n)):{}}function Rp(n,s){var c=s?Bu(n.buffer):n.buffer;return new n.constructor(c,n.byteOffset,n.length)}function Np(n,s){if(n!==s){var c=n!==t,l=n===null,g=n===n,_=Pr(n),O=s!==t,N=s===null,M=s===s,X=Pr(s);if(!N&&!X&&!_&&n>s||_&&O&&M&&!N&&!X||l&&O&&M||!c&&M||!g)return 1;if(!l&&!_&&!X&&n<s||X&&c&&g&&!l&&!_||N&&c&&g||!O&&g||!M)return-1}return 0}function CD(n,s,c){for(var l=-1,g=n.criteria,_=s.criteria,O=g.length,N=c.length;++l<O;){var M=Np(g[l],_[l]);if(M){if(l>=N)return M;var X=c[l];return M*(X=="desc"?-1:1)}}return n.index-s.index}function $p(n,s,c,l){for(var g=-1,_=n.length,O=c.length,N=-1,M=s.length,X=Kt(_-O,0),Z=z(M+X),ne=!l;++N<M;)Z[N]=s[N];for(;++g<O;)(ne||g<_)&&(Z[c[g]]=n[g]);for(;X--;)Z[N++]=n[g++];return Z}function Fp(n,s,c,l){for(var g=-1,_=n.length,O=-1,N=c.length,M=-1,X=s.length,Z=Kt(_-N,0),ne=z(Z+X),ue=!l;++g<Z;)ne[g]=n[g];for(var ve=g;++M<X;)ne[ve+M]=s[M];for(;++O<N;)(ue||g<_)&&(ne[ve+c[O]]=n[g++]);return ne}function br(n,s){var c=-1,l=n.length;for(s||(s=z(l));++c<l;)s[c]=n[c];return s}function sn(n,s,c,l){var g=!c;c||(c={});for(var _=-1,O=s.length;++_<O;){var N=s[_],M=l?l(c[N],n[N],N,c,n):t;M===t&&(M=n[N]),g?bn(c,N,M):Rs(c,N,M)}return c}function AD(n,s){return sn(n,Yu(n),s)}function TD(n,s){return sn(n,Wp(n),s)}function oa(n,s){return function(c,l){var g=Re(c)?L2:Z6,_=s?s():{};return g(c,n,be(l,2),_)}}function Mi(n){return Ke(function(s,c){var l=-1,g=c.length,_=g>1?c[g-1]:t,O=g>2?c[2]:t;for(_=n.length>3&&typeof _=="function"?(g--,_):t,O&&fr(c[0],c[1],O)&&(_=g<3?t:_,g=1),s=ht(s);++l<g;){var N=c[l];N&&n(s,N,l,_)}return s})}function Lp(n,s){return function(c,l){if(c==null)return c;if(!mr(c))return n(c,l);for(var g=c.length,_=s?g:-1,O=ht(c);(s?_--:++_<g)&&l(O[_],_,O)!==!1;);return c}}function Up(n){return function(s,c,l){for(var g=-1,_=ht(s),O=l(s),N=O.length;N--;){var M=O[n?N:++g];if(c(_[M],M,_)===!1)break}return s}}function RD(n,s,c){var l=s&K,g=Us(n);function _(){var O=this&&this!==Xe&&this instanceof _?g:n;return O.apply(l?c:this,arguments)}return _}function jp(n){return function(s){s=nt(s);var c=Ri(s)?Gr(s):t,l=c?c[0]:s.charAt(0),g=c?qn(c,1).join(""):s.slice(1);return l[n]()+g}}function qi(n){return function(s){return du(Lg(Fg(s).replace(Ss,"")),n,"")}}function Us(n){return function(){var s=arguments;switch(s.length){case 0:return new n;case 1:return new n(s[0]);case 2:return new n(s[0],s[1]);case 3:return new n(s[0],s[1],s[2]);case 4:return new n(s[0],s[1],s[2],s[3]);case 5:return new n(s[0],s[1],s[2],s[3],s[4]);case 6:return new n(s[0],s[1],s[2],s[3],s[4],s[5]);case 7:return new n(s[0],s[1],s[2],s[3],s[4],s[5],s[6])}var c=ji(n.prototype),l=n.apply(c,s);return Et(l)?l:c}}function ND(n,s,c){var l=Us(n);function g(){for(var _=arguments.length,O=z(_),N=_,M=Hi(g);N--;)O[N]=arguments[N];var X=_<3&&O[0]!==M&&O[_-1]!==M?[]:Fn(O,M);if(_-=X.length,_<c)return zp(n,s,aa,g.placeholder,t,O,X,t,t,c-_);var Z=this&&this!==Xe&&this instanceof g?l:n;return Gt(Z,this,O)}return g}function Mp(n){return function(s,c,l){var g=ht(s);if(!mr(s)){var _=be(c,3);s=Wt(s),c=function(N){return _(g[N],N,g)}}var O=n(s,c,l);return O>-1?g[_?s[O]:O]:t}}function qp(n){return wn(function(s){var c=s.length,l=c,g=Lr.prototype.thru;for(n&&s.reverse();l--;){var _=s[l];if(typeof _!="function")throw new Fr(u);if(g&&!O&&la(_)=="wrapper")var O=new Lr([],!0)}for(l=O?l:c;++l<c;){_=s[l];var N=la(_),M=N=="wrapper"?Gu(_):t;M&&Qu(M[0])&&M[1]==(h|U|T|b)&&!M[4].length&&M[9]==1?O=O[la(M[0])].apply(O,M[3]):O=_.length==1&&Qu(_)?O[N]():O.thru(_)}return function(){var X=arguments,Z=X[0];if(O&&X.length==1&&Re(Z))return O.plant(Z).value();for(var ne=0,ue=c?s[ne].apply(this,X):Z;++ne<c;)ue=s[ne].call(this,ue);return ue}})}function aa(n,s,c,l,g,_,O,N,M,X){var Z=s&h,ne=s&K,ue=s&se,ve=s&(U|x),Ee=s&G,He=ue?t:Us(n);function De(){for(var Ge=arguments.length,Ze=z(Ge),Cr=Ge;Cr--;)Ze[Cr]=arguments[Cr];if(ve)var dr=Hi(De),Ar=V2(Ze,dr);if(l&&(Ze=$p(Ze,l,g,ve)),_&&(Ze=Fp(Ze,_,O,ve)),Ge-=Ar,ve&&Ge<X){var $t=Fn(Ze,dr);return zp(n,s,aa,De.placeholder,c,Ze,$t,N,M,X-Ge)}var Jr=ne?c:this,xn=ue?Jr[n]:n;return Ge=Ze.length,N?Ze=ZD(Ze,N):Ee&&Ge>1&&Ze.reverse(),Z&&M<Ge&&(Ze.length=M),this&&this!==Xe&&this instanceof De&&(xn=He||Us(xn)),xn.apply(Jr,Ze)}return De}function Hp(n,s){return function(c,l){return aD(c,n,s(l),{})}}function ca(n,s){return function(c,l){var g;if(c===t&&l===t)return s;if(c!==t&&(g=c),l!==t){if(g===t)return l;typeof c=="string"||typeof l=="string"?(c=Ir(c),l=Ir(l)):(c=Op(c),l=Op(l)),g=n(c,l)}return g}}function zu(n){return wn(function(s){return s=mt(s,Or(be())),Ke(function(c){var l=this;return n(s,function(g){return Gt(g,l,c)})})})}function ua(n,s){s=s===t?" ":Ir(s);var c=s.length;if(c<2)return c?Lu(s,n):s;var l=Lu(s,Yo(n/Ni(s)));return Ri(s)?qn(Gr(l),0,n).join(""):l.slice(0,n)}function $D(n,s,c,l){var g=s&K,_=Us(n);function O(){for(var N=-1,M=arguments.length,X=-1,Z=l.length,ne=z(Z+M),ue=this&&this!==Xe&&this instanceof O?_:n;++X<Z;)ne[X]=l[X];for(;M--;)ne[X++]=arguments[++N];return Gt(ue,g?c:this,ne)}return O}function Bp(n){return function(s,c,l){return l&&typeof l!="number"&&fr(s,c,l)&&(c=l=t),s=Sn(s),c===t?(c=s,s=0):c=Sn(c),l=l===t?s<c?1:-1:Sn(l),bD(s,c,l,n)}}function ha(n){return function(s,c){return typeof s=="string"&&typeof c=="string"||(s=qr(s),c=qr(c)),n(s,c)}}function zp(n,s,c,l,g,_,O,N,M,X){var Z=s&U,ne=Z?O:t,ue=Z?t:O,ve=Z?_:t,Ee=Z?t:_;s|=Z?T:E,s&=~(Z?E:T),s&$||(s&=~(K|se));var He=[n,s,g,ve,ne,Ee,ue,N,M,X],De=c.apply(t,He);return Qu(n)&&tg(De,He),De.placeholder=l,rg(De,n,s)}function Ku(n){var s=zt[n];return function(c,l){if(c=qr(c),l=l==null?0:tr(je(l),292),l&&rp(c)){var g=(nt(c)+"e").split("e"),_=s(g[0]+"e"+(+g[1]+l));return g=(nt(_)+"e").split("e"),+(g[0]+"e"+(+g[1]-l))}return s(c)}}var FD=Li&&1/Mo(new Li([,-0]))[1]==Q?function(n){return new Li(n)}:fh;function Kp(n){return function(s){var c=rr(s);return c==xe?mu(s):c==Oe?X2(s):K2(s,n(s))}}function mn(n,s,c,l,g,_,O,N){var M=s&se;if(!M&&typeof n!="function")throw new Fr(u);var X=l?l.length:0;if(X||(s&=~(T|E),l=g=t),O=O===t?O:Kt(je(O),0),N=N===t?N:je(N),X-=g?g.length:0,s&E){var Z=l,ne=g;l=g=t}var ue=M?t:Gu(n),ve=[n,s,c,l,g,Z,ne,_,O,N];if(ue&&JD(ve,ue),n=ve[0],s=ve[1],c=ve[2],l=ve[3],g=ve[4],N=ve[9]=ve[9]===t?M?0:n.length:Kt(ve[9]-X,0),!N&&s&(U|x)&&(s&=~(U|x)),!s||s==K)var Ee=RD(n,s,c);else s==U||s==x?Ee=ND(n,s,N):(s==T||s==(K|T))&&!g.length?Ee=$D(n,s,c,l):Ee=aa.apply(t,ve);var He=ue?Sp:tg;return rg(He(Ee,ve),n,s)}function Vp(n,s,c,l){return n===t||Yr(n,Fi[c])&&!it.call(l,c)?s:n}function kp(n,s,c,l,g,_){return Et(n)&&Et(s)&&(_.set(s,n),na(n,s,t,kp,_),_.delete(s)),n}function LD(n){return qs(n)?t:n}function Gp(n,s,c,l,g,_){var O=c&R,N=n.length,M=s.length;if(N!=M&&!(O&&M>N))return!1;var X=_.get(n),Z=_.get(s);if(X&&Z)return X==s&&Z==n;var ne=-1,ue=!0,ve=c&B?new oi:t;for(_.set(n,s),_.set(s,n);++ne<N;){var Ee=n[ne],He=s[ne];if(l)var De=O?l(He,Ee,ne,s,n,_):l(Ee,He,ne,n,s,_);if(De!==t){if(De)continue;ue=!1;break}if(ve){if(!pu(s,function(Ge,Ze){if(!Os(ve,Ze)&&(Ee===Ge||g(Ee,Ge,c,l,_)))return ve.push(Ze)})){ue=!1;break}}else if(!(Ee===He||g(Ee,He,c,l,_))){ue=!1;break}}return _.delete(n),_.delete(s),ue}function UD(n,s,c,l,g,_,O){switch(c){case Ce:if(n.byteLength!=s.byteLength||n.byteOffset!=s.byteOffset)return!1;n=n.buffer,s=s.buffer;case Se:return!(n.byteLength!=s.byteLength||!_(new Vo(n),new Vo(s)));case q:case F:case Be:return Yr(+n,+s);case A:return n.name==s.name&&n.message==s.message;case Me:case $e:return n==s+"";case xe:var N=mu;case Oe:var M=l&R;if(N||(N=Mo),n.size!=s.size&&!M)return!1;var X=O.get(n);if(X)return X==s;l|=B,O.set(n,s);var Z=Gp(N(n),N(s),l,g,_,O);return O.delete(n),Z;case Fe:if(Ts)return Ts.call(n)==Ts.call(s)}return!1}function jD(n,s,c,l,g,_){var O=c&R,N=Vu(n),M=N.length,X=Vu(s),Z=X.length;if(M!=Z&&!O)return!1;for(var ne=M;ne--;){var ue=N[ne];if(!(O?ue in s:it.call(s,ue)))return!1}var ve=_.get(n),Ee=_.get(s);if(ve&&Ee)return ve==s&&Ee==n;var He=!0;_.set(n,s),_.set(s,n);for(var De=O;++ne<M;){ue=N[ne];var Ge=n[ue],Ze=s[ue];if(l)var Cr=O?l(Ze,Ge,ue,s,n,_):l(Ge,Ze,ue,n,s,_);if(!(Cr===t?Ge===Ze||g(Ge,Ze,c,l,_):Cr)){He=!1;break}De||(De=ue=="constructor")}if(He&&!De){var dr=n.constructor,Ar=s.constructor;dr!=Ar&&"constructor"in n&&"constructor"in s&&!(typeof dr=="function"&&dr instanceof dr&&typeof Ar=="function"&&Ar instanceof Ar)&&(He=!1)}return _.delete(n),_.delete(s),He}function wn(n){return Zu(Zp(n,t,cg),n+"")}function Vu(n){return dp(n,Wt,Yu)}function ku(n){return dp(n,wr,Wp)}var Gu=Qo?function(n){return Qo.get(n)}:fh;function la(n){for(var s=n.name+"",c=Ui[s],l=it.call(Ui,s)?c.length:0;l--;){var g=c[l],_=g.func;if(_==null||_==n)return g.name}return s}function Hi(n){var s=it.call(y,"placeholder")?y:n;return s.placeholder}function be(){var n=y.iteratee||hh;return n=n===hh?vp:n,arguments.length?n(arguments[0],arguments[1]):n}function fa(n,s){var c=n.__data__;return kD(s)?c[typeof s=="string"?"string":"hash"]:c.map}function Wu(n){for(var s=Wt(n),c=s.length;c--;){var l=s[c],g=n[l];s[c]=[l,g,Qp(g)]}return s}function ui(n,s){var c=Y2(n,s);return gp(c)?c:t}function MD(n){var s=it.call(n,ii),c=n[ii];try{n[ii]=t;var l=!0}catch{}var g=zo.call(n);return l&&(s?n[ii]=c:delete n[ii]),g}var Yu=Eu?function(n){return n==null?[]:(n=ht(n),Nn(Eu(n),function(s){return ep.call(n,s)}))}:dh,Wp=Eu?function(n){for(var s=[];n;)$n(s,Yu(n)),n=ko(n);return s}:dh,rr=lr;(Du&&rr(new Du(new ArrayBuffer(1)))!=Ce||Ps&&rr(new Ps)!=xe||Su&&rr(Su.resolve())!=vt||Li&&rr(new Li)!=Oe||Cs&&rr(new Cs)!=Pe)&&(rr=function(n){var s=lr(n),c=s==Ue?n.constructor:t,l=c?hi(c):"";if(l)switch(l){case w6:return Ce;case E6:return xe;case D6:return vt;case S6:return Oe;case x6:return Pe}return s});function qD(n,s,c){for(var l=-1,g=c.length;++l<g;){var _=c[l],O=_.size;switch(_.type){case"drop":n+=O;break;case"dropRight":s-=O;break;case"take":s=tr(s,n+O);break;case"takeRight":n=Kt(n,s-O);break}}return{start:n,end:s}}function HD(n){var s=n.match(ft);return s?s[1].split(Mt):[]}function Yp(n,s,c){s=Mn(s,n);for(var l=-1,g=s.length,_=!1;++l<g;){var O=on(s[l]);if(!(_=n!=null&&c(n,O)))break;n=n[O]}return _||++l!=g?_:(g=n==null?0:n.length,!!g&&ba(g)&&En(O,g)&&(Re(n)||li(n)))}function BD(n){var s=n.length,c=new n.constructor(s);return s&&typeof n[0]=="string"&&it.call(n,"index")&&(c.index=n.index,c.input=n.input),c}function Jp(n){return typeof n.constructor=="function"&&!js(n)?ji(ko(n)):{}}function zD(n,s,c){var l=n.constructor;switch(s){case Se:return Bu(n);case q:case F:return new l(+n);case Ce:return OD(n,c);case ze:case Ie:case ke:case We:case et:case tt:case Qe:case cr:case yr:return Rp(n,c);case xe:return new l;case Be:case $e:return new l(n);case Me:return ID(n);case Oe:return new l;case Fe:return PD(n)}}function KD(n,s){var c=s.length;if(!c)return n;var l=c-1;return s[l]=(c>1?"& ":"")+s[l],s=s.join(c>2?", ":" "),n.replace(Pt,`{
79
+ */(function(n,e){(function(){var t,i="4.17.21",o=200,c="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",u="Expected a function",f="Invalid `variable` option passed into `_.template`",v="__lodash_hash_undefined__",p=500,w="__lodash_placeholder__",I=1,S=2,C=4,R=1,B=2,K=1,se=2,$=4,U=8,x=16,T=32,E=64,h=128,b=256,G=512,Y=30,ie="...",ce=800,de=16,m=1,P=2,ee=3,Q=1/0,V=9007199254740991,k=17976931348623157e292,J=0/0,re=4294967295,me=re-1,oe=re>>>1,we=[["ary",h],["bind",K],["bindKey",se],["curry",U],["curryRight",x],["flip",G],["partial",T],["partialRight",E],["rearg",b]],le="[object Arguments]",_e="[object Array]",H="[object AsyncFunction]",q="[object Boolean]",F="[object Date]",d="[object DOMException]",A="[object Error]",ae="[object Function]",fe="[object GeneratorFunction]",xe="[object Map]",Be="[object Number]",Ve="[object Null]",Ue="[object Object]",vt="[object Promise]",yt="[object Proxy]",Me="[object RegExp]",Oe="[object Set]",$e="[object String]",Fe="[object Symbol]",qe="[object Undefined]",Pe="[object WeakMap]",Le="[object WeakSet]",Se="[object ArrayBuffer]",Ce="[object DataView]",ze="[object Float32Array]",Ie="[object Float64Array]",ke="[object Int8Array]",We="[object Int16Array]",et="[object Int32Array]",tt="[object Uint8Array]",Qe="[object Uint8ClampedArray]",ar="[object Uint16Array]",vr="[object Uint32Array]",Zr=/\b__p \+= '';/g,cr=/\b(__p \+=) '' \+/g,dn=/(__e\(.*?\)|\b__t\)) \+\n'';/g,An=/&(?:amp|lt|gt|quot|#39);/g,Qn=/[&<>"']/g,Dt=RegExp(An.source),_t=RegExp(Qn.source),St=/<%-([\s\S]+?)%>/g,xt=/<%([\s\S]+?)%>/g,wt=/<%=([\s\S]+?)%>/g,bt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Lt=/^\w*$/,Ut=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ot=/[\\^$.*+?()[\]{}|]/g,jt=RegExp(Ot.source),It=/^\s+/,Tt=/\s/,Pt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ft=/\{\n\/\* \[wrapped with (.+)\] \*/,Mt=/,? & /,qt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Kc=/[()=,{}\[\]\/\s]/,Vc=/\\(\\)?/g,kc=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Tr=/\w*$/,Gc=/^[-+]0x[0-9a-f]+$/i,Wc=/^0b[01]+$/i,Yc=/^\[object .+?Constructor\]$/,Jc=/^0o[0-7]+$/i,Qc=/^(?:0|[1-9]\d*)$/,pn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Di=/($^)/,Xc=/['\n\r\u2028\u2029\\]/g,Si="\\ud800-\\udfff",Zc="\\u0300-\\u036f",eu="\\ufe20-\\ufe2f",xi="\\u20d0-\\u20ff",yo=Zc+eu+xi,_o="\\u2700-\\u27bf",Kr="a-z\\xdf-\\xf6\\xf8-\\xff",tu="\\xac\\xb1\\xd7\\xf7",ru="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",nu="\\u2000-\\u206f",iu=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",bo="A-Z\\xc0-\\xd6\\xd8-\\xde",mo="\\ufe0e\\ufe0f",Xn=tu+ru+nu+iu,ws="['\u2019]",Zn="["+Si+"]",Es="["+Xn+"]",ei="["+yo+"]",wo="\\d+",su="["+_o+"]",Eo="["+Kr+"]",Do="[^"+Si+Xn+wo+_o+Kr+bo+"]",Oi="\\ud83c[\\udffb-\\udfff]",ou="(?:"+ei+"|"+Oi+")",So="[^"+Si+"]",Ii="(?:\\ud83c[\\udde6-\\uddff]){2}",Tn="[\\ud800-\\udbff][\\udc00-\\udfff]",Sr="["+bo+"]",xo="\\u200d",Oo="(?:"+Eo+"|"+Do+")",en="(?:"+Sr+"|"+Do+")",Io="(?:"+ws+"(?:d|ll|m|re|s|t|ve))?",Po="(?:"+ws+"(?:D|LL|M|RE|S|T|VE))?",Co=ou+"?",Ao="["+mo+"]?",au="(?:"+xo+"(?:"+[So,Ii,Tn].join("|")+")"+Ao+Co+")*",gn="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",To="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ro=Ao+Co+au,Pi="(?:"+[su,Ii,Tn].join("|")+")"+Ro,cu="(?:"+[So+ei+"?",ei,Ii,Tn,Zn].join("|")+")",Ds=RegExp(ws,"g"),uu=RegExp(ei,"g"),Ci=RegExp(Oi+"(?="+Oi+")|"+cu+Ro,"g"),No=RegExp([Sr+"?"+Eo+"+"+Io+"(?="+[Es,Sr,"$"].join("|")+")",en+"+"+Po+"(?="+[Es,Sr+Oo,"$"].join("|")+")",Sr+"?"+Oo+"+"+Io,Sr+"+"+Po,To,gn,wo,Pi].join("|"),"g"),$o=RegExp("["+xo+Si+yo+mo+"]"),ti=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Fo=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],hu=-1,at={};at[ze]=at[Ie]=at[ke]=at[We]=at[et]=at[tt]=at[Qe]=at[ar]=at[vr]=!0,at[le]=at[_e]=at[Se]=at[q]=at[Ce]=at[F]=at[A]=at[ae]=at[xe]=at[Be]=at[Ue]=at[Me]=at[Oe]=at[$e]=at[Pe]=!1;var ot={};ot[le]=ot[_e]=ot[Se]=ot[Ce]=ot[q]=ot[F]=ot[ze]=ot[Ie]=ot[ke]=ot[We]=ot[et]=ot[xe]=ot[Be]=ot[Ue]=ot[Me]=ot[Oe]=ot[$e]=ot[Fe]=ot[tt]=ot[Qe]=ot[ar]=ot[vr]=!0,ot[A]=ot[ae]=ot[Pe]=!1;var D={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},L={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},te={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},pe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ct=parseFloat,Te=parseInt,dt=typeof bs=="object"&&bs&&bs.Object===Object&&bs,Ht=typeof self=="object"&&self&&self.Object===Object&&self,Xe=dt||Ht||Function("return this")(),ut=e&&!e.nodeType&&e,Rt=ut&&!0&&n&&!n.nodeType&&n,yr=Rt&&Rt.exports===ut,Bt=yr&&dt.process,pt=function(){try{var j=Rt&&Rt.require&&Rt.require("util").types;return j||Bt&&Bt.binding&&Bt.binding("util")}catch{}}(),ur=pt&&pt.isArrayBuffer,Vr=pt&&pt.isDate,Rr=pt&&pt.isMap,tn=pt&&pt.isRegExp,Ss=pt&&pt.isSet,ri=pt&&pt.isTypedArray;function Gt(j,W,z){switch(z.length){case 0:return j.call(W);case 1:return j.call(W,z[0]);case 2:return j.call(W,z[0],z[1]);case 3:return j.call(W,z[0],z[1],z[2])}return j.apply(W,z)}function A2(j,W,z,ge){for(var Ae=-1,rt=j==null?0:j.length;++Ae<rt;){var zt=j[Ae];W(ge,zt,z(zt),j)}return ge}function Nr(j,W){for(var z=-1,ge=j==null?0:j.length;++z<ge&&W(j[z],z,j)!==!1;);return j}function T2(j,W){for(var z=j==null?0:j.length;z--&&W(j[z],z,j)!==!1;);return j}function jd(j,W){for(var z=-1,ge=j==null?0:j.length;++z<ge;)if(!W(j[z],z,j))return!1;return!0}function Rn(j,W){for(var z=-1,ge=j==null?0:j.length,Ae=0,rt=[];++z<ge;){var zt=j[z];W(zt,z,j)&&(rt[Ae++]=zt)}return rt}function Lo(j,W){var z=j==null?0:j.length;return!!z&&Ai(j,W,0)>-1}function lu(j,W,z){for(var ge=-1,Ae=j==null?0:j.length;++ge<Ae;)if(z(W,j[ge]))return!0;return!1}function mt(j,W){for(var z=-1,ge=j==null?0:j.length,Ae=Array(ge);++z<ge;)Ae[z]=W(j[z],z,j);return Ae}function Nn(j,W){for(var z=-1,ge=W.length,Ae=j.length;++z<ge;)j[Ae+z]=W[z];return j}function fu(j,W,z,ge){var Ae=-1,rt=j==null?0:j.length;for(ge&&rt&&(z=j[++Ae]);++Ae<rt;)z=W(z,j[Ae],Ae,j);return z}function R2(j,W,z,ge){var Ae=j==null?0:j.length;for(ge&&Ae&&(z=j[--Ae]);Ae--;)z=W(z,j[Ae],Ae,j);return z}function du(j,W){for(var z=-1,ge=j==null?0:j.length;++z<ge;)if(W(j[z],z,j))return!0;return!1}var N2=pu("length");function $2(j){return j.split("")}function F2(j){return j.match(qt)||[]}function Md(j,W,z){var ge;return z(j,function(Ae,rt,zt){if(W(Ae,rt,zt))return ge=rt,!1}),ge}function Uo(j,W,z,ge){for(var Ae=j.length,rt=z+(ge?1:-1);ge?rt--:++rt<Ae;)if(W(j[rt],rt,j))return rt;return-1}function Ai(j,W,z){return W===W?G2(j,W,z):Uo(j,qd,z)}function L2(j,W,z,ge){for(var Ae=z-1,rt=j.length;++Ae<rt;)if(ge(j[Ae],W))return Ae;return-1}function qd(j){return j!==j}function Hd(j,W){var z=j==null?0:j.length;return z?vu(j,W)/z:J}function pu(j){return function(W){return W==null?t:W[j]}}function gu(j){return function(W){return j==null?t:j[W]}}function Bd(j,W,z,ge,Ae){return Ae(j,function(rt,zt,ht){z=ge?(ge=!1,rt):W(z,rt,zt,ht)}),z}function U2(j,W){var z=j.length;for(j.sort(W);z--;)j[z]=j[z].value;return j}function vu(j,W){for(var z,ge=-1,Ae=j.length;++ge<Ae;){var rt=W(j[ge]);rt!==t&&(z=z===t?rt:z+rt)}return z}function yu(j,W){for(var z=-1,ge=Array(j);++z<j;)ge[z]=W(z);return ge}function j2(j,W){return mt(W,function(z){return[z,j[z]]})}function zd(j){return j&&j.slice(0,Gd(j)+1).replace(It,"")}function xr(j){return function(W){return j(W)}}function _u(j,W){return mt(W,function(z){return j[z]})}function xs(j,W){return j.has(W)}function Kd(j,W){for(var z=-1,ge=j.length;++z<ge&&Ai(W,j[z],0)>-1;);return z}function Vd(j,W){for(var z=j.length;z--&&Ai(W,j[z],0)>-1;);return z}function M2(j,W){for(var z=j.length,ge=0;z--;)j[z]===W&&++ge;return ge}var q2=gu(D),H2=gu(L);function B2(j){return"\\"+pe[j]}function z2(j,W){return j==null?t:j[W]}function Ti(j){return $o.test(j)}function K2(j){return ti.test(j)}function V2(j){for(var W,z=[];!(W=j.next()).done;)z.push(W.value);return z}function bu(j){var W=-1,z=Array(j.size);return j.forEach(function(ge,Ae){z[++W]=[Ae,ge]}),z}function kd(j,W){return function(z){return j(W(z))}}function $n(j,W){for(var z=-1,ge=j.length,Ae=0,rt=[];++z<ge;){var zt=j[z];(zt===W||zt===w)&&(j[z]=w,rt[Ae++]=z)}return rt}function jo(j){var W=-1,z=Array(j.size);return j.forEach(function(ge){z[++W]=ge}),z}function k2(j){var W=-1,z=Array(j.size);return j.forEach(function(ge){z[++W]=[ge,ge]}),z}function G2(j,W,z){for(var ge=z-1,Ae=j.length;++ge<Ae;)if(j[ge]===W)return ge;return-1}function W2(j,W,z){for(var ge=z+1;ge--;)if(j[ge]===W)return ge;return ge}function Ri(j){return Ti(j)?J2(j):N2(j)}function kr(j){return Ti(j)?Q2(j):$2(j)}function Gd(j){for(var W=j.length;W--&&Tt.test(j.charAt(W)););return W}var Y2=gu(te);function J2(j){for(var W=Ci.lastIndex=0;Ci.test(j);)++W;return W}function Q2(j){return j.match(Ci)||[]}function X2(j){return j.match(No)||[]}var Z2=function j(W){W=W==null?Xe:Ni.defaults(Xe.Object(),W,Ni.pick(Xe,Fo));var z=W.Array,ge=W.Date,Ae=W.Error,rt=W.Function,zt=W.Math,ht=W.Object,mu=W.RegExp,e6=W.String,$r=W.TypeError,Mo=z.prototype,t6=rt.prototype,$i=ht.prototype,qo=W["__core-js_shared__"],Ho=t6.toString,it=$i.hasOwnProperty,r6=0,Wd=function(){var r=/[^.]+$/.exec(qo&&qo.keys&&qo.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Bo=$i.toString,n6=Ho.call(ht),i6=Xe._,s6=mu("^"+Ho.call(it).replace(Ot,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),zo=yr?W.Buffer:t,Fn=W.Symbol,Ko=W.Uint8Array,Yd=zo?zo.allocUnsafe:t,Vo=kd(ht.getPrototypeOf,ht),Jd=ht.create,Qd=$i.propertyIsEnumerable,ko=Mo.splice,Xd=Fn?Fn.isConcatSpreadable:t,Os=Fn?Fn.iterator:t,ni=Fn?Fn.toStringTag:t,Go=function(){try{var r=ci(ht,"defineProperty");return r({},"",{}),r}catch{}}(),o6=W.clearTimeout!==Xe.clearTimeout&&W.clearTimeout,a6=ge&&ge.now!==Xe.Date.now&&ge.now,c6=W.setTimeout!==Xe.setTimeout&&W.setTimeout,Wo=zt.ceil,Yo=zt.floor,wu=ht.getOwnPropertySymbols,u6=zo?zo.isBuffer:t,Zd=W.isFinite,h6=Mo.join,l6=kd(ht.keys,ht),Kt=zt.max,tr=zt.min,f6=ge.now,d6=W.parseInt,ep=zt.random,p6=Mo.reverse,Eu=ci(W,"DataView"),Is=ci(W,"Map"),Du=ci(W,"Promise"),Fi=ci(W,"Set"),Ps=ci(W,"WeakMap"),Cs=ci(ht,"create"),Jo=Ps&&new Ps,Li={},g6=ui(Eu),v6=ui(Is),y6=ui(Du),_6=ui(Fi),b6=ui(Ps),Qo=Fn?Fn.prototype:t,As=Qo?Qo.valueOf:t,tp=Qo?Qo.toString:t;function y(r){if(Ct(r)&&!Re(r)&&!(r instanceof Ye)){if(r instanceof Fr)return r;if(it.call(r,"__wrapped__"))return rg(r)}return new Fr(r)}var Ui=function(){function r(){}return function(s){if(!Et(s))return{};if(Jd)return Jd(s);r.prototype=s;var a=new r;return r.prototype=t,a}}();function Xo(){}function Fr(r,s){this.__wrapped__=r,this.__actions__=[],this.__chain__=!!s,this.__index__=0,this.__values__=t}y.templateSettings={escape:St,evaluate:xt,interpolate:wt,variable:"",imports:{_:y}},y.prototype=Xo.prototype,y.prototype.constructor=y,Fr.prototype=Ui(Xo.prototype),Fr.prototype.constructor=Fr;function Ye(r){this.__wrapped__=r,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=re,this.__views__=[]}function m6(){var r=new Ye(this.__wrapped__);return r.__actions__=_r(this.__actions__),r.__dir__=this.__dir__,r.__filtered__=this.__filtered__,r.__iteratees__=_r(this.__iteratees__),r.__takeCount__=this.__takeCount__,r.__views__=_r(this.__views__),r}function w6(){if(this.__filtered__){var r=new Ye(this);r.__dir__=-1,r.__filtered__=!0}else r=this.clone(),r.__dir__*=-1;return r}function E6(){var r=this.__wrapped__.value(),s=this.__dir__,a=Re(r),l=s<0,g=a?r.length:0,_=$D(0,g,this.__views__),O=_.start,N=_.end,M=N-O,X=l?N:O-1,Z=this.__iteratees__,ne=Z.length,ue=0,ve=tr(M,this.__takeCount__);if(!a||!l&&g==M&&ve==M)return xp(r,this.__actions__);var Ee=[];e:for(;M--&&ue<ve;){X+=s;for(var He=-1,De=r[X];++He<ne;){var Ge=Z[He],Ze=Ge.iteratee,Pr=Ge.type,fr=Ze(De);if(Pr==P)De=fr;else if(!fr){if(Pr==m)continue e;break e}}Ee[ue++]=De}return Ee}Ye.prototype=Ui(Xo.prototype),Ye.prototype.constructor=Ye;function ii(r){var s=-1,a=r==null?0:r.length;for(this.clear();++s<a;){var l=r[s];this.set(l[0],l[1])}}function D6(){this.__data__=Cs?Cs(null):{},this.size=0}function S6(r){var s=this.has(r)&&delete this.__data__[r];return this.size-=s?1:0,s}function x6(r){var s=this.__data__;if(Cs){var a=s[r];return a===v?t:a}return it.call(s,r)?s[r]:t}function O6(r){var s=this.__data__;return Cs?s[r]!==t:it.call(s,r)}function I6(r,s){var a=this.__data__;return this.size+=this.has(r)?0:1,a[r]=Cs&&s===t?v:s,this}ii.prototype.clear=D6,ii.prototype.delete=S6,ii.prototype.get=x6,ii.prototype.has=O6,ii.prototype.set=I6;function vn(r){var s=-1,a=r==null?0:r.length;for(this.clear();++s<a;){var l=r[s];this.set(l[0],l[1])}}function P6(){this.__data__=[],this.size=0}function C6(r){var s=this.__data__,a=Zo(s,r);if(a<0)return!1;var l=s.length-1;return a==l?s.pop():ko.call(s,a,1),--this.size,!0}function A6(r){var s=this.__data__,a=Zo(s,r);return a<0?t:s[a][1]}function T6(r){return Zo(this.__data__,r)>-1}function R6(r,s){var a=this.__data__,l=Zo(a,r);return l<0?(++this.size,a.push([r,s])):a[l][1]=s,this}vn.prototype.clear=P6,vn.prototype.delete=C6,vn.prototype.get=A6,vn.prototype.has=T6,vn.prototype.set=R6;function yn(r){var s=-1,a=r==null?0:r.length;for(this.clear();++s<a;){var l=r[s];this.set(l[0],l[1])}}function N6(){this.size=0,this.__data__={hash:new ii,map:new(Is||vn),string:new ii}}function $6(r){var s=la(this,r).delete(r);return this.size-=s?1:0,s}function F6(r){return la(this,r).get(r)}function L6(r){return la(this,r).has(r)}function U6(r,s){var a=la(this,r),l=a.size;return a.set(r,s),this.size+=a.size==l?0:1,this}yn.prototype.clear=N6,yn.prototype.delete=$6,yn.prototype.get=F6,yn.prototype.has=L6,yn.prototype.set=U6;function si(r){var s=-1,a=r==null?0:r.length;for(this.__data__=new yn;++s<a;)this.add(r[s])}function j6(r){return this.__data__.set(r,v),this}function M6(r){return this.__data__.has(r)}si.prototype.add=si.prototype.push=j6,si.prototype.has=M6;function Gr(r){var s=this.__data__=new vn(r);this.size=s.size}function q6(){this.__data__=new vn,this.size=0}function H6(r){var s=this.__data__,a=s.delete(r);return this.size=s.size,a}function B6(r){return this.__data__.get(r)}function z6(r){return this.__data__.has(r)}function K6(r,s){var a=this.__data__;if(a instanceof vn){var l=a.__data__;if(!Is||l.length<o-1)return l.push([r,s]),this.size=++a.size,this;a=this.__data__=new yn(l)}return a.set(r,s),this.size=a.size,this}Gr.prototype.clear=q6,Gr.prototype.delete=H6,Gr.prototype.get=B6,Gr.prototype.has=z6,Gr.prototype.set=K6;function rp(r,s){var a=Re(r),l=!a&&hi(r),g=!a&&!l&&qn(r),_=!a&&!l&&!g&&Hi(r),O=a||l||g||_,N=O?yu(r.length,e6):[],M=N.length;for(var X in r)(s||it.call(r,X))&&!(O&&(X=="length"||g&&(X=="offset"||X=="parent")||_&&(X=="buffer"||X=="byteLength"||X=="byteOffset")||wn(X,M)))&&N.push(X);return N}function np(r){var s=r.length;return s?r[$u(0,s-1)]:t}function V6(r,s){return fa(_r(r),oi(s,0,r.length))}function k6(r){return fa(_r(r))}function Su(r,s,a){(a!==t&&!Wr(r[s],a)||a===t&&!(s in r))&&_n(r,s,a)}function Ts(r,s,a){var l=r[s];(!(it.call(r,s)&&Wr(l,a))||a===t&&!(s in r))&&_n(r,s,a)}function Zo(r,s){for(var a=r.length;a--;)if(Wr(r[a][0],s))return a;return-1}function G6(r,s,a,l){return Ln(r,function(g,_,O){s(l,g,a(g),O)}),l}function ip(r,s){return r&&nn(s,Wt(s),r)}function W6(r,s){return r&&nn(s,mr(s),r)}function _n(r,s,a){s=="__proto__"&&Go?Go(r,s,{configurable:!0,enumerable:!0,value:a,writable:!0}):r[s]=a}function xu(r,s){for(var a=-1,l=s.length,g=z(l),_=r==null;++a<l;)g[a]=_?t:sh(r,s[a]);return g}function oi(r,s,a){return r===r&&(a!==t&&(r=r<=a?r:a),s!==t&&(r=r>=s?r:s)),r}function Lr(r,s,a,l,g,_){var O,N=s&I,M=s&S,X=s&C;if(a&&(O=g?a(r,l,g,_):a(r)),O!==t)return O;if(!Et(r))return r;var Z=Re(r);if(Z){if(O=LD(r),!N)return _r(r,O)}else{var ne=rr(r),ue=ne==ae||ne==fe;if(qn(r))return Pp(r,N);if(ne==Ue||ne==le||ue&&!g){if(O=M||ue?{}:Gp(r),!N)return M?xD(r,W6(O,r)):SD(r,ip(O,r))}else{if(!ot[ne])return g?r:{};O=UD(r,ne,N)}}_||(_=new Gr);var ve=_.get(r);if(ve)return ve;_.set(r,O),Eg(r)?r.forEach(function(De){O.add(Lr(De,s,a,De,r,_))}):mg(r)&&r.forEach(function(De,Ge){O.set(Ge,Lr(De,s,a,Ge,r,_))});var Ee=X?M?Vu:Ku:M?mr:Wt,He=Z?t:Ee(r);return Nr(He||r,function(De,Ge){He&&(Ge=De,De=r[Ge]),Ts(O,Ge,Lr(De,s,a,Ge,r,_))}),O}function Y6(r){var s=Wt(r);return function(a){return sp(a,r,s)}}function sp(r,s,a){var l=a.length;if(r==null)return!l;for(r=ht(r);l--;){var g=a[l],_=s[g],O=r[g];if(O===t&&!(g in r)||!_(O))return!1}return!0}function op(r,s,a){if(typeof r!="function")throw new $r(u);return js(function(){r.apply(t,a)},s)}function Rs(r,s,a,l){var g=-1,_=Lo,O=!0,N=r.length,M=[],X=s.length;if(!N)return M;a&&(s=mt(s,xr(a))),l?(_=lu,O=!1):s.length>=o&&(_=xs,O=!1,s=new si(s));e:for(;++g<N;){var Z=r[g],ne=a==null?Z:a(Z);if(Z=l||Z!==0?Z:0,O&&ne===ne){for(var ue=X;ue--;)if(s[ue]===ne)continue e;M.push(Z)}else _(s,ne,l)||M.push(Z)}return M}var Ln=Np(rn),ap=Np(Iu,!0);function J6(r,s){var a=!0;return Ln(r,function(l,g,_){return a=!!s(l,g,_),a}),a}function ea(r,s,a){for(var l=-1,g=r.length;++l<g;){var _=r[l],O=s(_);if(O!=null&&(N===t?O===O&&!Ir(O):a(O,N)))var N=O,M=_}return M}function Q6(r,s,a,l){var g=r.length;for(a=je(a),a<0&&(a=-a>g?0:g+a),l=l===t||l>g?g:je(l),l<0&&(l+=g),l=a>l?0:Sg(l);a<l;)r[a++]=s;return r}function cp(r,s){var a=[];return Ln(r,function(l,g,_){s(l,g,_)&&a.push(l)}),a}function Xt(r,s,a,l,g){var _=-1,O=r.length;for(a||(a=MD),g||(g=[]);++_<O;){var N=r[_];s>0&&a(N)?s>1?Xt(N,s-1,a,l,g):Nn(g,N):l||(g[g.length]=N)}return g}var Ou=$p(),up=$p(!0);function rn(r,s){return r&&Ou(r,s,Wt)}function Iu(r,s){return r&&up(r,s,Wt)}function ta(r,s){return Rn(s,function(a){return En(r[a])})}function ai(r,s){s=jn(s,r);for(var a=0,l=s.length;r!=null&&a<l;)r=r[sn(s[a++])];return a&&a==l?r:t}function hp(r,s,a){var l=s(r);return Re(r)?l:Nn(l,a(r))}function hr(r){return r==null?r===t?qe:Ve:ni&&ni in ht(r)?ND(r):kD(r)}function Pu(r,s){return r>s}function X6(r,s){return r!=null&&it.call(r,s)}function Z6(r,s){return r!=null&&s in ht(r)}function eD(r,s,a){return r>=tr(s,a)&&r<Kt(s,a)}function Cu(r,s,a){for(var l=a?lu:Lo,g=r[0].length,_=r.length,O=_,N=z(_),M=1/0,X=[];O--;){var Z=r[O];O&&s&&(Z=mt(Z,xr(s))),M=tr(Z.length,M),N[O]=!a&&(s||g>=120&&Z.length>=120)?new si(O&&Z):t}Z=r[0];var ne=-1,ue=N[0];e:for(;++ne<g&&X.length<M;){var ve=Z[ne],Ee=s?s(ve):ve;if(ve=a||ve!==0?ve:0,!(ue?xs(ue,Ee):l(X,Ee,a))){for(O=_;--O;){var He=N[O];if(!(He?xs(He,Ee):l(r[O],Ee,a)))continue e}ue&&ue.push(Ee),X.push(ve)}}return X}function tD(r,s,a,l){return rn(r,function(g,_,O){s(l,a(g),_,O)}),l}function Ns(r,s,a){s=jn(s,r),r=Qp(r,s);var l=r==null?r:r[sn(jr(s))];return l==null?t:Gt(l,r,a)}function lp(r){return Ct(r)&&hr(r)==le}function rD(r){return Ct(r)&&hr(r)==Se}function nD(r){return Ct(r)&&hr(r)==F}function $s(r,s,a,l,g){return r===s?!0:r==null||s==null||!Ct(r)&&!Ct(s)?r!==r&&s!==s:iD(r,s,a,l,$s,g)}function iD(r,s,a,l,g,_){var O=Re(r),N=Re(s),M=O?_e:rr(r),X=N?_e:rr(s);M=M==le?Ue:M,X=X==le?Ue:X;var Z=M==Ue,ne=X==Ue,ue=M==X;if(ue&&qn(r)){if(!qn(s))return!1;O=!0,Z=!1}if(ue&&!Z)return _||(_=new Gr),O||Hi(r)?Kp(r,s,a,l,g,_):TD(r,s,M,a,l,g,_);if(!(a&R)){var ve=Z&&it.call(r,"__wrapped__"),Ee=ne&&it.call(s,"__wrapped__");if(ve||Ee){var He=ve?r.value():r,De=Ee?s.value():s;return _||(_=new Gr),g(He,De,a,l,_)}}return ue?(_||(_=new Gr),RD(r,s,a,l,g,_)):!1}function sD(r){return Ct(r)&&rr(r)==xe}function Au(r,s,a,l){var g=a.length,_=g,O=!l;if(r==null)return!_;for(r=ht(r);g--;){var N=a[g];if(O&&N[2]?N[1]!==r[N[0]]:!(N[0]in r))return!1}for(;++g<_;){N=a[g];var M=N[0],X=r[M],Z=N[1];if(O&&N[2]){if(X===t&&!(M in r))return!1}else{var ne=new Gr;if(l)var ue=l(X,Z,M,r,s,ne);if(!(ue===t?$s(Z,X,R|B,l,ne):ue))return!1}}return!0}function fp(r){if(!Et(r)||HD(r))return!1;var s=En(r)?s6:Yc;return s.test(ui(r))}function oD(r){return Ct(r)&&hr(r)==Me}function aD(r){return Ct(r)&&rr(r)==Oe}function cD(r){return Ct(r)&&_a(r.length)&&!!at[hr(r)]}function dp(r){return typeof r=="function"?r:r==null?wr:typeof r=="object"?Re(r)?vp(r[0],r[1]):gp(r):Fg(r)}function Tu(r){if(!Us(r))return l6(r);var s=[];for(var a in ht(r))it.call(r,a)&&a!="constructor"&&s.push(a);return s}function uD(r){if(!Et(r))return VD(r);var s=Us(r),a=[];for(var l in r)l=="constructor"&&(s||!it.call(r,l))||a.push(l);return a}function Ru(r,s){return r<s}function pp(r,s){var a=-1,l=br(r)?z(r.length):[];return Ln(r,function(g,_,O){l[++a]=s(g,_,O)}),l}function gp(r){var s=Gu(r);return s.length==1&&s[0][2]?Yp(s[0][0],s[0][1]):function(a){return a===r||Au(a,r,s)}}function vp(r,s){return Yu(r)&&Wp(s)?Yp(sn(r),s):function(a){var l=sh(a,r);return l===t&&l===s?oh(a,r):$s(s,l,R|B)}}function ra(r,s,a,l,g){r!==s&&Ou(s,function(_,O){if(g||(g=new Gr),Et(_))hD(r,s,O,a,ra,l,g);else{var N=l?l(Qu(r,O),_,O+"",r,s,g):t;N===t&&(N=_),Su(r,O,N)}},mr)}function hD(r,s,a,l,g,_,O){var N=Qu(r,a),M=Qu(s,a),X=O.get(M);if(X){Su(r,a,X);return}var Z=_?_(N,M,a+"",r,s,O):t,ne=Z===t;if(ne){var ue=Re(M),ve=!ue&&qn(M),Ee=!ue&&!ve&&Hi(M);Z=M,ue||ve||Ee?Re(N)?Z=N:Nt(N)?Z=_r(N):ve?(ne=!1,Z=Pp(M,!0)):Ee?(ne=!1,Z=Cp(M,!0)):Z=[]:Ms(M)||hi(M)?(Z=N,hi(N)?Z=xg(N):(!Et(N)||En(N))&&(Z=Gp(M))):ne=!1}ne&&(O.set(M,Z),g(Z,M,l,_,O),O.delete(M)),Su(r,a,Z)}function yp(r,s){var a=r.length;if(a)return s+=s<0?a:0,wn(s,a)?r[s]:t}function _p(r,s,a){s.length?s=mt(s,function(_){return Re(_)?function(O){return ai(O,_.length===1?_[0]:_)}:_}):s=[wr];var l=-1;s=mt(s,xr(be()));var g=pp(r,function(_,O,N){var M=mt(s,function(X){return X(_)});return{criteria:M,index:++l,value:_}});return U2(g,function(_,O){return DD(_,O,a)})}function lD(r,s){return bp(r,s,function(a,l){return oh(r,l)})}function bp(r,s,a){for(var l=-1,g=s.length,_={};++l<g;){var O=s[l],N=ai(r,O);a(N,O)&&Fs(_,jn(O,r),N)}return _}function fD(r){return function(s){return ai(s,r)}}function Nu(r,s,a,l){var g=l?L2:Ai,_=-1,O=s.length,N=r;for(r===s&&(s=_r(s)),a&&(N=mt(r,xr(a)));++_<O;)for(var M=0,X=s[_],Z=a?a(X):X;(M=g(N,Z,M,l))>-1;)N!==r&&ko.call(N,M,1),ko.call(r,M,1);return r}function mp(r,s){for(var a=r?s.length:0,l=a-1;a--;){var g=s[a];if(a==l||g!==_){var _=g;wn(g)?ko.call(r,g,1):Uu(r,g)}}return r}function $u(r,s){return r+Yo(ep()*(s-r+1))}function dD(r,s,a,l){for(var g=-1,_=Kt(Wo((s-r)/(a||1)),0),O=z(_);_--;)O[l?_:++g]=r,r+=a;return O}function Fu(r,s){var a="";if(!r||s<1||s>V)return a;do s%2&&(a+=r),s=Yo(s/2),s&&(r+=r);while(s);return a}function Ke(r,s){return Xu(Jp(r,s,wr),r+"")}function pD(r){return np(Bi(r))}function gD(r,s){var a=Bi(r);return fa(a,oi(s,0,a.length))}function Fs(r,s,a,l){if(!Et(r))return r;s=jn(s,r);for(var g=-1,_=s.length,O=_-1,N=r;N!=null&&++g<_;){var M=sn(s[g]),X=a;if(M==="__proto__"||M==="constructor"||M==="prototype")return r;if(g!=O){var Z=N[M];X=l?l(Z,M,N):t,X===t&&(X=Et(Z)?Z:wn(s[g+1])?[]:{})}Ts(N,M,X),N=N[M]}return r}var wp=Jo?function(r,s){return Jo.set(r,s),r}:wr,vD=Go?function(r,s){return Go(r,"toString",{configurable:!0,enumerable:!1,value:ch(s),writable:!0})}:wr;function yD(r){return fa(Bi(r))}function Ur(r,s,a){var l=-1,g=r.length;s<0&&(s=-s>g?0:g+s),a=a>g?g:a,a<0&&(a+=g),g=s>a?0:a-s>>>0,s>>>=0;for(var _=z(g);++l<g;)_[l]=r[l+s];return _}function _D(r,s){var a;return Ln(r,function(l,g,_){return a=s(l,g,_),!a}),!!a}function na(r,s,a){var l=0,g=r==null?l:r.length;if(typeof s=="number"&&s===s&&g<=oe){for(;l<g;){var _=l+g>>>1,O=r[_];O!==null&&!Ir(O)&&(a?O<=s:O<s)?l=_+1:g=_}return g}return Lu(r,s,wr,a)}function Lu(r,s,a,l){var g=0,_=r==null?0:r.length;if(_===0)return 0;s=a(s);for(var O=s!==s,N=s===null,M=Ir(s),X=s===t;g<_;){var Z=Yo((g+_)/2),ne=a(r[Z]),ue=ne!==t,ve=ne===null,Ee=ne===ne,He=Ir(ne);if(O)var De=l||Ee;else X?De=Ee&&(l||ue):N?De=Ee&&ue&&(l||!ve):M?De=Ee&&ue&&!ve&&(l||!He):ve||He?De=!1:De=l?ne<=s:ne<s;De?g=Z+1:_=Z}return tr(_,me)}function Ep(r,s){for(var a=-1,l=r.length,g=0,_=[];++a<l;){var O=r[a],N=s?s(O):O;if(!a||!Wr(N,M)){var M=N;_[g++]=O===0?0:O}}return _}function Dp(r){return typeof r=="number"?r:Ir(r)?J:+r}function Or(r){if(typeof r=="string")return r;if(Re(r))return mt(r,Or)+"";if(Ir(r))return tp?tp.call(r):"";var s=r+"";return s=="0"&&1/r==-Q?"-0":s}function Un(r,s,a){var l=-1,g=Lo,_=r.length,O=!0,N=[],M=N;if(a)O=!1,g=lu;else if(_>=o){var X=s?null:CD(r);if(X)return jo(X);O=!1,g=xs,M=new si}else M=s?[]:N;e:for(;++l<_;){var Z=r[l],ne=s?s(Z):Z;if(Z=a||Z!==0?Z:0,O&&ne===ne){for(var ue=M.length;ue--;)if(M[ue]===ne)continue e;s&&M.push(ne),N.push(Z)}else g(M,ne,a)||(M!==N&&M.push(ne),N.push(Z))}return N}function Uu(r,s){return s=jn(s,r),r=Qp(r,s),r==null||delete r[sn(jr(s))]}function Sp(r,s,a,l){return Fs(r,s,a(ai(r,s)),l)}function ia(r,s,a,l){for(var g=r.length,_=l?g:-1;(l?_--:++_<g)&&s(r[_],_,r););return a?Ur(r,l?0:_,l?_+1:g):Ur(r,l?_+1:0,l?g:_)}function xp(r,s){var a=r;return a instanceof Ye&&(a=a.value()),fu(s,function(l,g){return g.func.apply(g.thisArg,Nn([l],g.args))},a)}function ju(r,s,a){var l=r.length;if(l<2)return l?Un(r[0]):[];for(var g=-1,_=z(l);++g<l;)for(var O=r[g],N=-1;++N<l;)N!=g&&(_[g]=Rs(_[g]||O,r[N],s,a));return Un(Xt(_,1),s,a)}function Op(r,s,a){for(var l=-1,g=r.length,_=s.length,O={};++l<g;){var N=l<_?s[l]:t;a(O,r[l],N)}return O}function Mu(r){return Nt(r)?r:[]}function qu(r){return typeof r=="function"?r:wr}function jn(r,s){return Re(r)?r:Yu(r,s)?[r]:tg(nt(r))}var bD=Ke;function Mn(r,s,a){var l=r.length;return a=a===t?l:a,!s&&a>=l?r:Ur(r,s,a)}var Ip=o6||function(r){return Xe.clearTimeout(r)};function Pp(r,s){if(s)return r.slice();var a=r.length,l=Yd?Yd(a):new r.constructor(a);return r.copy(l),l}function Hu(r){var s=new r.constructor(r.byteLength);return new Ko(s).set(new Ko(r)),s}function mD(r,s){var a=s?Hu(r.buffer):r.buffer;return new r.constructor(a,r.byteOffset,r.byteLength)}function wD(r){var s=new r.constructor(r.source,Tr.exec(r));return s.lastIndex=r.lastIndex,s}function ED(r){return As?ht(As.call(r)):{}}function Cp(r,s){var a=s?Hu(r.buffer):r.buffer;return new r.constructor(a,r.byteOffset,r.length)}function Ap(r,s){if(r!==s){var a=r!==t,l=r===null,g=r===r,_=Ir(r),O=s!==t,N=s===null,M=s===s,X=Ir(s);if(!N&&!X&&!_&&r>s||_&&O&&M&&!N&&!X||l&&O&&M||!a&&M||!g)return 1;if(!l&&!_&&!X&&r<s||X&&a&&g&&!l&&!_||N&&a&&g||!O&&g||!M)return-1}return 0}function DD(r,s,a){for(var l=-1,g=r.criteria,_=s.criteria,O=g.length,N=a.length;++l<O;){var M=Ap(g[l],_[l]);if(M){if(l>=N)return M;var X=a[l];return M*(X=="desc"?-1:1)}}return r.index-s.index}function Tp(r,s,a,l){for(var g=-1,_=r.length,O=a.length,N=-1,M=s.length,X=Kt(_-O,0),Z=z(M+X),ne=!l;++N<M;)Z[N]=s[N];for(;++g<O;)(ne||g<_)&&(Z[a[g]]=r[g]);for(;X--;)Z[N++]=r[g++];return Z}function Rp(r,s,a,l){for(var g=-1,_=r.length,O=-1,N=a.length,M=-1,X=s.length,Z=Kt(_-N,0),ne=z(Z+X),ue=!l;++g<Z;)ne[g]=r[g];for(var ve=g;++M<X;)ne[ve+M]=s[M];for(;++O<N;)(ue||g<_)&&(ne[ve+a[O]]=r[g++]);return ne}function _r(r,s){var a=-1,l=r.length;for(s||(s=z(l));++a<l;)s[a]=r[a];return s}function nn(r,s,a,l){var g=!a;a||(a={});for(var _=-1,O=s.length;++_<O;){var N=s[_],M=l?l(a[N],r[N],N,a,r):t;M===t&&(M=r[N]),g?_n(a,N,M):Ts(a,N,M)}return a}function SD(r,s){return nn(r,Wu(r),s)}function xD(r,s){return nn(r,Vp(r),s)}function sa(r,s){return function(a,l){var g=Re(a)?A2:G6,_=s?s():{};return g(a,r,be(l,2),_)}}function ji(r){return Ke(function(s,a){var l=-1,g=a.length,_=g>1?a[g-1]:t,O=g>2?a[2]:t;for(_=r.length>3&&typeof _=="function"?(g--,_):t,O&&lr(a[0],a[1],O)&&(_=g<3?t:_,g=1),s=ht(s);++l<g;){var N=a[l];N&&r(s,N,l,_)}return s})}function Np(r,s){return function(a,l){if(a==null)return a;if(!br(a))return r(a,l);for(var g=a.length,_=s?g:-1,O=ht(a);(s?_--:++_<g)&&l(O[_],_,O)!==!1;);return a}}function $p(r){return function(s,a,l){for(var g=-1,_=ht(s),O=l(s),N=O.length;N--;){var M=O[r?N:++g];if(a(_[M],M,_)===!1)break}return s}}function OD(r,s,a){var l=s&K,g=Ls(r);function _(){var O=this&&this!==Xe&&this instanceof _?g:r;return O.apply(l?a:this,arguments)}return _}function Fp(r){return function(s){s=nt(s);var a=Ti(s)?kr(s):t,l=a?a[0]:s.charAt(0),g=a?Mn(a,1).join(""):s.slice(1);return l[r]()+g}}function Mi(r){return function(s){return fu(Ng(Rg(s).replace(Ds,"")),r,"")}}function Ls(r){return function(){var s=arguments;switch(s.length){case 0:return new r;case 1:return new r(s[0]);case 2:return new r(s[0],s[1]);case 3:return new r(s[0],s[1],s[2]);case 4:return new r(s[0],s[1],s[2],s[3]);case 5:return new r(s[0],s[1],s[2],s[3],s[4]);case 6:return new r(s[0],s[1],s[2],s[3],s[4],s[5]);case 7:return new r(s[0],s[1],s[2],s[3],s[4],s[5],s[6])}var a=Ui(r.prototype),l=r.apply(a,s);return Et(l)?l:a}}function ID(r,s,a){var l=Ls(r);function g(){for(var _=arguments.length,O=z(_),N=_,M=qi(g);N--;)O[N]=arguments[N];var X=_<3&&O[0]!==M&&O[_-1]!==M?[]:$n(O,M);if(_-=X.length,_<a)return qp(r,s,oa,g.placeholder,t,O,X,t,t,a-_);var Z=this&&this!==Xe&&this instanceof g?l:r;return Gt(Z,this,O)}return g}function Lp(r){return function(s,a,l){var g=ht(s);if(!br(s)){var _=be(a,3);s=Wt(s),a=function(N){return _(g[N],N,g)}}var O=r(s,a,l);return O>-1?g[_?s[O]:O]:t}}function Up(r){return mn(function(s){var a=s.length,l=a,g=Fr.prototype.thru;for(r&&s.reverse();l--;){var _=s[l];if(typeof _!="function")throw new $r(u);if(g&&!O&&ha(_)=="wrapper")var O=new Fr([],!0)}for(l=O?l:a;++l<a;){_=s[l];var N=ha(_),M=N=="wrapper"?ku(_):t;M&&Ju(M[0])&&M[1]==(h|U|T|b)&&!M[4].length&&M[9]==1?O=O[ha(M[0])].apply(O,M[3]):O=_.length==1&&Ju(_)?O[N]():O.thru(_)}return function(){var X=arguments,Z=X[0];if(O&&X.length==1&&Re(Z))return O.plant(Z).value();for(var ne=0,ue=a?s[ne].apply(this,X):Z;++ne<a;)ue=s[ne].call(this,ue);return ue}})}function oa(r,s,a,l,g,_,O,N,M,X){var Z=s&h,ne=s&K,ue=s&se,ve=s&(U|x),Ee=s&G,He=ue?t:Ls(r);function De(){for(var Ge=arguments.length,Ze=z(Ge),Pr=Ge;Pr--;)Ze[Pr]=arguments[Pr];if(ve)var fr=qi(De),Cr=M2(Ze,fr);if(l&&(Ze=Tp(Ze,l,g,ve)),_&&(Ze=Rp(Ze,_,O,ve)),Ge-=Cr,ve&&Ge<X){var $t=$n(Ze,fr);return qp(r,s,oa,De.placeholder,a,Ze,$t,N,M,X-Ge)}var Yr=ne?a:this,Sn=ue?Yr[r]:r;return Ge=Ze.length,N?Ze=GD(Ze,N):Ee&&Ge>1&&Ze.reverse(),Z&&M<Ge&&(Ze.length=M),this&&this!==Xe&&this instanceof De&&(Sn=He||Ls(Sn)),Sn.apply(Yr,Ze)}return De}function jp(r,s){return function(a,l){return tD(a,r,s(l),{})}}function aa(r,s){return function(a,l){var g;if(a===t&&l===t)return s;if(a!==t&&(g=a),l!==t){if(g===t)return l;typeof a=="string"||typeof l=="string"?(a=Or(a),l=Or(l)):(a=Dp(a),l=Dp(l)),g=r(a,l)}return g}}function Bu(r){return mn(function(s){return s=mt(s,xr(be())),Ke(function(a){var l=this;return r(s,function(g){return Gt(g,l,a)})})})}function ca(r,s){s=s===t?" ":Or(s);var a=s.length;if(a<2)return a?Fu(s,r):s;var l=Fu(s,Wo(r/Ri(s)));return Ti(s)?Mn(kr(l),0,r).join(""):l.slice(0,r)}function PD(r,s,a,l){var g=s&K,_=Ls(r);function O(){for(var N=-1,M=arguments.length,X=-1,Z=l.length,ne=z(Z+M),ue=this&&this!==Xe&&this instanceof O?_:r;++X<Z;)ne[X]=l[X];for(;M--;)ne[X++]=arguments[++N];return Gt(ue,g?a:this,ne)}return O}function Mp(r){return function(s,a,l){return l&&typeof l!="number"&&lr(s,a,l)&&(a=l=t),s=Dn(s),a===t?(a=s,s=0):a=Dn(a),l=l===t?s<a?1:-1:Dn(l),dD(s,a,l,r)}}function ua(r){return function(s,a){return typeof s=="string"&&typeof a=="string"||(s=Mr(s),a=Mr(a)),r(s,a)}}function qp(r,s,a,l,g,_,O,N,M,X){var Z=s&U,ne=Z?O:t,ue=Z?t:O,ve=Z?_:t,Ee=Z?t:_;s|=Z?T:E,s&=~(Z?E:T),s&$||(s&=~(K|se));var He=[r,s,g,ve,ne,Ee,ue,N,M,X],De=a.apply(t,He);return Ju(r)&&Xp(De,He),De.placeholder=l,Zp(De,r,s)}function zu(r){var s=zt[r];return function(a,l){if(a=Mr(a),l=l==null?0:tr(je(l),292),l&&Zd(a)){var g=(nt(a)+"e").split("e"),_=s(g[0]+"e"+(+g[1]+l));return g=(nt(_)+"e").split("e"),+(g[0]+"e"+(+g[1]-l))}return s(a)}}var CD=Fi&&1/jo(new Fi([,-0]))[1]==Q?function(r){return new Fi(r)}:lh;function Hp(r){return function(s){var a=rr(s);return a==xe?bu(s):a==Oe?k2(s):j2(s,r(s))}}function bn(r,s,a,l,g,_,O,N){var M=s&se;if(!M&&typeof r!="function")throw new $r(u);var X=l?l.length:0;if(X||(s&=~(T|E),l=g=t),O=O===t?O:Kt(je(O),0),N=N===t?N:je(N),X-=g?g.length:0,s&E){var Z=l,ne=g;l=g=t}var ue=M?t:ku(r),ve=[r,s,a,l,g,Z,ne,_,O,N];if(ue&&KD(ve,ue),r=ve[0],s=ve[1],a=ve[2],l=ve[3],g=ve[4],N=ve[9]=ve[9]===t?M?0:r.length:Kt(ve[9]-X,0),!N&&s&(U|x)&&(s&=~(U|x)),!s||s==K)var Ee=OD(r,s,a);else s==U||s==x?Ee=ID(r,s,N):(s==T||s==(K|T))&&!g.length?Ee=PD(r,s,a,l):Ee=oa.apply(t,ve);var He=ue?wp:Xp;return Zp(He(Ee,ve),r,s)}function Bp(r,s,a,l){return r===t||Wr(r,$i[a])&&!it.call(l,a)?s:r}function zp(r,s,a,l,g,_){return Et(r)&&Et(s)&&(_.set(s,r),ra(r,s,t,zp,_),_.delete(s)),r}function AD(r){return Ms(r)?t:r}function Kp(r,s,a,l,g,_){var O=a&R,N=r.length,M=s.length;if(N!=M&&!(O&&M>N))return!1;var X=_.get(r),Z=_.get(s);if(X&&Z)return X==s&&Z==r;var ne=-1,ue=!0,ve=a&B?new si:t;for(_.set(r,s),_.set(s,r);++ne<N;){var Ee=r[ne],He=s[ne];if(l)var De=O?l(He,Ee,ne,s,r,_):l(Ee,He,ne,r,s,_);if(De!==t){if(De)continue;ue=!1;break}if(ve){if(!du(s,function(Ge,Ze){if(!xs(ve,Ze)&&(Ee===Ge||g(Ee,Ge,a,l,_)))return ve.push(Ze)})){ue=!1;break}}else if(!(Ee===He||g(Ee,He,a,l,_))){ue=!1;break}}return _.delete(r),_.delete(s),ue}function TD(r,s,a,l,g,_,O){switch(a){case Ce:if(r.byteLength!=s.byteLength||r.byteOffset!=s.byteOffset)return!1;r=r.buffer,s=s.buffer;case Se:return!(r.byteLength!=s.byteLength||!_(new Ko(r),new Ko(s)));case q:case F:case Be:return Wr(+r,+s);case A:return r.name==s.name&&r.message==s.message;case Me:case $e:return r==s+"";case xe:var N=bu;case Oe:var M=l&R;if(N||(N=jo),r.size!=s.size&&!M)return!1;var X=O.get(r);if(X)return X==s;l|=B,O.set(r,s);var Z=Kp(N(r),N(s),l,g,_,O);return O.delete(r),Z;case Fe:if(As)return As.call(r)==As.call(s)}return!1}function RD(r,s,a,l,g,_){var O=a&R,N=Ku(r),M=N.length,X=Ku(s),Z=X.length;if(M!=Z&&!O)return!1;for(var ne=M;ne--;){var ue=N[ne];if(!(O?ue in s:it.call(s,ue)))return!1}var ve=_.get(r),Ee=_.get(s);if(ve&&Ee)return ve==s&&Ee==r;var He=!0;_.set(r,s),_.set(s,r);for(var De=O;++ne<M;){ue=N[ne];var Ge=r[ue],Ze=s[ue];if(l)var Pr=O?l(Ze,Ge,ue,s,r,_):l(Ge,Ze,ue,r,s,_);if(!(Pr===t?Ge===Ze||g(Ge,Ze,a,l,_):Pr)){He=!1;break}De||(De=ue=="constructor")}if(He&&!De){var fr=r.constructor,Cr=s.constructor;fr!=Cr&&"constructor"in r&&"constructor"in s&&!(typeof fr=="function"&&fr instanceof fr&&typeof Cr=="function"&&Cr instanceof Cr)&&(He=!1)}return _.delete(r),_.delete(s),He}function mn(r){return Xu(Jp(r,t,sg),r+"")}function Ku(r){return hp(r,Wt,Wu)}function Vu(r){return hp(r,mr,Vp)}var ku=Jo?function(r){return Jo.get(r)}:lh;function ha(r){for(var s=r.name+"",a=Li[s],l=it.call(Li,s)?a.length:0;l--;){var g=a[l],_=g.func;if(_==null||_==r)return g.name}return s}function qi(r){var s=it.call(y,"placeholder")?y:r;return s.placeholder}function be(){var r=y.iteratee||uh;return r=r===uh?dp:r,arguments.length?r(arguments[0],arguments[1]):r}function la(r,s){var a=r.__data__;return qD(s)?a[typeof s=="string"?"string":"hash"]:a.map}function Gu(r){for(var s=Wt(r),a=s.length;a--;){var l=s[a],g=r[l];s[a]=[l,g,Wp(g)]}return s}function ci(r,s){var a=z2(r,s);return fp(a)?a:t}function ND(r){var s=it.call(r,ni),a=r[ni];try{r[ni]=t;var l=!0}catch{}var g=Bo.call(r);return l&&(s?r[ni]=a:delete r[ni]),g}var Wu=wu?function(r){return r==null?[]:(r=ht(r),Rn(wu(r),function(s){return Qd.call(r,s)}))}:fh,Vp=wu?function(r){for(var s=[];r;)Nn(s,Wu(r)),r=Vo(r);return s}:fh,rr=hr;(Eu&&rr(new Eu(new ArrayBuffer(1)))!=Ce||Is&&rr(new Is)!=xe||Du&&rr(Du.resolve())!=vt||Fi&&rr(new Fi)!=Oe||Ps&&rr(new Ps)!=Pe)&&(rr=function(r){var s=hr(r),a=s==Ue?r.constructor:t,l=a?ui(a):"";if(l)switch(l){case g6:return Ce;case v6:return xe;case y6:return vt;case _6:return Oe;case b6:return Pe}return s});function $D(r,s,a){for(var l=-1,g=a.length;++l<g;){var _=a[l],O=_.size;switch(_.type){case"drop":r+=O;break;case"dropRight":s-=O;break;case"take":s=tr(s,r+O);break;case"takeRight":r=Kt(r,s-O);break}}return{start:r,end:s}}function FD(r){var s=r.match(ft);return s?s[1].split(Mt):[]}function kp(r,s,a){s=jn(s,r);for(var l=-1,g=s.length,_=!1;++l<g;){var O=sn(s[l]);if(!(_=r!=null&&a(r,O)))break;r=r[O]}return _||++l!=g?_:(g=r==null?0:r.length,!!g&&_a(g)&&wn(O,g)&&(Re(r)||hi(r)))}function LD(r){var s=r.length,a=new r.constructor(s);return s&&typeof r[0]=="string"&&it.call(r,"index")&&(a.index=r.index,a.input=r.input),a}function Gp(r){return typeof r.constructor=="function"&&!Us(r)?Ui(Vo(r)):{}}function UD(r,s,a){var l=r.constructor;switch(s){case Se:return Hu(r);case q:case F:return new l(+r);case Ce:return mD(r,a);case ze:case Ie:case ke:case We:case et:case tt:case Qe:case ar:case vr:return Cp(r,a);case xe:return new l;case Be:case $e:return new l(r);case Me:return wD(r);case Oe:return new l;case Fe:return ED(r)}}function jD(r,s){var a=s.length;if(!a)return r;var l=a-1;return s[l]=(a>1?"& ":"")+s[l],s=s.join(a>2?", ":" "),r.replace(Pt,`{
80
80
  /* [wrapped with `+s+`] */
81
- `)}function VD(n){return Re(n)||li(n)||!!(tp&&n&&n[tp])}function En(n,s){var c=typeof n;return s=s??V,!!s&&(c=="number"||c!="symbol"&&Xc.test(n))&&n>-1&&n%1==0&&n<s}function fr(n,s,c){if(!Et(c))return!1;var l=typeof s;return(l=="number"?mr(c)&&En(s,c.length):l=="string"&&s in c)?Yr(c[s],n):!1}function Ju(n,s){if(Re(n))return!1;var c=typeof n;return c=="number"||c=="symbol"||c=="boolean"||n==null||Pr(n)?!0:Lt.test(n)||!bt.test(n)||s!=null&&n in ht(s)}function kD(n){var s=typeof n;return s=="string"||s=="number"||s=="symbol"||s=="boolean"?n!=="__proto__":n===null}function Qu(n){var s=la(n),c=y[s];if(typeof c!="function"||!(s in Ye.prototype))return!1;if(n===c)return!0;var l=Gu(c);return!!l&&n===l[0]}function GD(n){return!!Qd&&Qd in n}var WD=Ho?Dn:ph;function js(n){var s=n&&n.constructor,c=typeof s=="function"&&s.prototype||Fi;return n===c}function Qp(n){return n===n&&!Et(n)}function Xp(n,s){return function(c){return c==null?!1:c[n]===s&&(s!==t||n in ht(c))}}function YD(n){var s=ya(n,function(l){return c.size===p&&c.clear(),l}),c=s.cache;return s}function JD(n,s){var c=n[1],l=s[1],g=c|l,_=g<(K|se|h),O=l==h&&c==U||l==h&&c==b&&n[7].length<=s[8]||l==(h|b)&&s[7].length<=s[8]&&c==U;if(!(_||O))return n;l&K&&(n[2]=s[2],g|=c&K?0:$);var N=s[3];if(N){var M=n[3];n[3]=M?$p(M,N,s[4]):N,n[4]=M?Fn(n[3],w):s[4]}return N=s[5],N&&(M=n[5],n[5]=M?Fp(M,N,s[6]):N,n[6]=M?Fn(n[5],w):s[6]),N=s[7],N&&(n[7]=N),l&h&&(n[8]=n[8]==null?s[8]:tr(n[8],s[8])),n[9]==null&&(n[9]=s[9]),n[0]=s[0],n[1]=g,n}function QD(n){var s=[];if(n!=null)for(var c in ht(n))s.push(c);return s}function XD(n){return zo.call(n)}function Zp(n,s,c){return s=Kt(s===t?n.length-1:s,0),function(){for(var l=arguments,g=-1,_=Kt(l.length-s,0),O=z(_);++g<_;)O[g]=l[s+g];g=-1;for(var N=z(s+1);++g<s;)N[g]=l[g];return N[s]=c(O),Gt(n,this,N)}}function eg(n,s){return s.length<2?n:ci(n,jr(s,0,-1))}function ZD(n,s){for(var c=n.length,l=tr(s.length,c),g=br(n);l--;){var _=s[l];n[l]=En(_,c)?g[_]:t}return n}function Xu(n,s){if(!(s==="constructor"&&typeof n[s]=="function")&&s!="__proto__")return n[s]}var tg=ng(Sp),Ms=p6||function(n,s){return Xe.setTimeout(n,s)},Zu=ng(ED);function rg(n,s,c){var l=s+"";return Zu(n,KD(l,eS(HD(l),c)))}function ng(n){var s=0,c=0;return function(){var l=_6(),g=de-(l-c);if(c=l,g>0){if(++s>=ce)return arguments[0]}else s=0;return n.apply(t,arguments)}}function da(n,s){var c=-1,l=n.length,g=l-1;for(s=s===t?l:s;++c<s;){var _=Fu(c,g),O=n[_];n[_]=n[c],n[c]=O}return n.length=s,n}var ig=YD(function(n){var s=[];return n.charCodeAt(0)===46&&s.push(""),n.replace(Ut,function(c,l,g,_){s.push(g?_.replace(kc,"$1"):l||c)}),s});function on(n){if(typeof n=="string"||Pr(n))return n;var s=n+"";return s=="0"&&1/n==-Q?"-0":s}function hi(n){if(n!=null){try{return Bo.call(n)}catch{}try{return n+""}catch{}}return""}function eS(n,s){return $r(we,function(c){var l="_."+c[0];s&c[1]&&!Uo(n,l)&&n.push(l)}),n.sort()}function sg(n){if(n instanceof Ye)return n.clone();var s=new Lr(n.__wrapped__,n.__chain__);return s.__actions__=br(n.__actions__),s.__index__=n.__index__,s.__values__=n.__values__,s}function tS(n,s,c){(c?fr(n,s,c):s===t)?s=1:s=Kt(je(s),0);var l=n==null?0:n.length;if(!l||s<1)return[];for(var g=0,_=0,O=z(Yo(l/s));g<l;)O[_++]=jr(n,g,g+=s);return O}function rS(n){for(var s=-1,c=n==null?0:n.length,l=0,g=[];++s<c;){var _=n[s];_&&(g[l++]=_)}return g}function nS(){var n=arguments.length;if(!n)return[];for(var s=z(n-1),c=arguments[0],l=n;l--;)s[l-1]=arguments[l];return $n(Re(c)?br(c):[c],Xt(s,1))}var iS=Ke(function(n,s){return Nt(n)?Ns(n,Xt(s,1,Nt,!0)):[]}),sS=Ke(function(n,s){var c=Mr(s);return Nt(c)&&(c=t),Nt(n)?Ns(n,Xt(s,1,Nt,!0),be(c,2)):[]}),oS=Ke(function(n,s){var c=Mr(s);return Nt(c)&&(c=t),Nt(n)?Ns(n,Xt(s,1,Nt,!0),t,c):[]});function aS(n,s,c){var l=n==null?0:n.length;return l?(s=c||s===t?1:je(s),jr(n,s<0?0:s,l)):[]}function cS(n,s,c){var l=n==null?0:n.length;return l?(s=c||s===t?1:je(s),s=l-s,jr(n,0,s<0?0:s)):[]}function uS(n,s){return n&&n.length?sa(n,be(s,3),!0,!0):[]}function hS(n,s){return n&&n.length?sa(n,be(s,3),!0):[]}function lS(n,s,c,l){var g=n==null?0:n.length;return g?(c&&typeof c!="number"&&fr(n,s,c)&&(c=0,l=g),nD(n,s,c,l)):[]}function og(n,s,c){var l=n==null?0:n.length;if(!l)return-1;var g=c==null?0:je(c);return g<0&&(g=Kt(l+g,0)),jo(n,be(s,3),g)}function ag(n,s,c){var l=n==null?0:n.length;if(!l)return-1;var g=l-1;return c!==t&&(g=je(c),g=c<0?Kt(l+g,0):tr(g,l-1)),jo(n,be(s,3),g,!0)}function cg(n){var s=n==null?0:n.length;return s?Xt(n,1):[]}function fS(n){var s=n==null?0:n.length;return s?Xt(n,Q):[]}function dS(n,s){var c=n==null?0:n.length;return c?(s=s===t?1:je(s),Xt(n,s)):[]}function pS(n){for(var s=-1,c=n==null?0:n.length,l={};++s<c;){var g=n[s];l[g[0]]=g[1]}return l}function ug(n){return n&&n.length?n[0]:t}function gS(n,s,c){var l=n==null?0:n.length;if(!l)return-1;var g=c==null?0:je(c);return g<0&&(g=Kt(l+g,0)),Ti(n,s,g)}function vS(n){var s=n==null?0:n.length;return s?jr(n,0,-1):[]}var yS=Ke(function(n){var s=mt(n,qu);return s.length&&s[0]===n[0]?Au(s):[]}),_S=Ke(function(n){var s=Mr(n),c=mt(n,qu);return s===Mr(c)?s=t:c.pop(),c.length&&c[0]===n[0]?Au(c,be(s,2)):[]}),bS=Ke(function(n){var s=Mr(n),c=mt(n,qu);return s=typeof s=="function"?s:t,s&&c.pop(),c.length&&c[0]===n[0]?Au(c,t,s):[]});function mS(n,s){return n==null?"":v6.call(n,s)}function Mr(n){var s=n==null?0:n.length;return s?n[s-1]:t}function wS(n,s,c){var l=n==null?0:n.length;if(!l)return-1;var g=l;return c!==t&&(g=je(c),g=g<0?Kt(l+g,0):tr(g,l-1)),s===s?e6(n,s,g):jo(n,zd,g,!0)}function ES(n,s){return n&&n.length?mp(n,je(s)):t}var DS=Ke(hg);function hg(n,s){return n&&n.length&&s&&s.length?$u(n,s):n}function SS(n,s,c){return n&&n.length&&s&&s.length?$u(n,s,be(c,2)):n}function xS(n,s,c){return n&&n.length&&s&&s.length?$u(n,s,t,c):n}var OS=wn(function(n,s){var c=n==null?0:n.length,l=Ou(n,s);return Dp(n,mt(s,function(g){return En(g,c)?+g:g}).sort(Np)),l});function IS(n,s){var c=[];if(!(n&&n.length))return c;var l=-1,g=[],_=n.length;for(s=be(s,3);++l<_;){var O=n[l];s(O,l,n)&&(c.push(O),g.push(l))}return Dp(n,g),c}function eh(n){return n==null?n:m6.call(n)}function PS(n,s,c){var l=n==null?0:n.length;return l?(c&&typeof c!="number"&&fr(n,s,c)?(s=0,c=l):(s=s==null?0:je(s),c=c===t?l:je(c)),jr(n,s,c)):[]}function CS(n,s){return ia(n,s)}function AS(n,s,c){return Uu(n,s,be(c,2))}function TS(n,s){var c=n==null?0:n.length;if(c){var l=ia(n,s);if(l<c&&Yr(n[l],s))return l}return-1}function RS(n,s){return ia(n,s,!0)}function NS(n,s,c){return Uu(n,s,be(c,2),!0)}function $S(n,s){var c=n==null?0:n.length;if(c){var l=ia(n,s,!0)-1;if(Yr(n[l],s))return l}return-1}function FS(n){return n&&n.length?xp(n):[]}function LS(n,s){return n&&n.length?xp(n,be(s,2)):[]}function US(n){var s=n==null?0:n.length;return s?jr(n,1,s):[]}function jS(n,s,c){return n&&n.length?(s=c||s===t?1:je(s),jr(n,0,s<0?0:s)):[]}function MS(n,s,c){var l=n==null?0:n.length;return l?(s=c||s===t?1:je(s),s=l-s,jr(n,s<0?0:s,l)):[]}function qS(n,s){return n&&n.length?sa(n,be(s,3),!1,!0):[]}function HS(n,s){return n&&n.length?sa(n,be(s,3)):[]}var BS=Ke(function(n){return jn(Xt(n,1,Nt,!0))}),zS=Ke(function(n){var s=Mr(n);return Nt(s)&&(s=t),jn(Xt(n,1,Nt,!0),be(s,2))}),KS=Ke(function(n){var s=Mr(n);return s=typeof s=="function"?s:t,jn(Xt(n,1,Nt,!0),t,s)});function VS(n){return n&&n.length?jn(n):[]}function kS(n,s){return n&&n.length?jn(n,be(s,2)):[]}function GS(n,s){return s=typeof s=="function"?s:t,n&&n.length?jn(n,t,s):[]}function th(n){if(!(n&&n.length))return[];var s=0;return n=Nn(n,function(c){if(Nt(c))return s=Kt(c.length,s),!0}),_u(s,function(c){return mt(n,gu(c))})}function lg(n,s){if(!(n&&n.length))return[];var c=th(n);return s==null?c:mt(c,function(l){return Gt(s,t,l)})}var WS=Ke(function(n,s){return Nt(n)?Ns(n,s):[]}),YS=Ke(function(n){return Mu(Nn(n,Nt))}),JS=Ke(function(n){var s=Mr(n);return Nt(s)&&(s=t),Mu(Nn(n,Nt),be(s,2))}),QS=Ke(function(n){var s=Mr(n);return s=typeof s=="function"?s:t,Mu(Nn(n,Nt),t,s)}),XS=Ke(th);function ZS(n,s){return Cp(n||[],s||[],Rs)}function e5(n,s){return Cp(n||[],s||[],Ls)}var t5=Ke(function(n){var s=n.length,c=s>1?n[s-1]:t;return c=typeof c=="function"?(n.pop(),c):t,lg(n,c)});function fg(n){var s=y(n);return s.__chain__=!0,s}function r5(n,s){return s(n),n}function pa(n,s){return s(n)}var n5=wn(function(n){var s=n.length,c=s?n[0]:0,l=this.__wrapped__,g=function(_){return Ou(_,n)};return s>1||this.__actions__.length||!(l instanceof Ye)||!En(c)?this.thru(g):(l=l.slice(c,+c+(s?1:0)),l.__actions__.push({func:pa,args:[g],thisArg:t}),new Lr(l,this.__chain__).thru(function(_){return s&&!_.length&&_.push(t),_}))});function i5(){return fg(this)}function s5(){return new Lr(this.value(),this.__chain__)}function o5(){this.__values__===t&&(this.__values__=Og(this.value()));var n=this.__index__>=this.__values__.length,s=n?t:this.__values__[this.__index__++];return{done:n,value:s}}function a5(){return this}function c5(n){for(var s,c=this;c instanceof Zo;){var l=sg(c);l.__index__=0,l.__values__=t,s?g.__wrapped__=l:s=l;var g=l;c=c.__wrapped__}return g.__wrapped__=n,s}function u5(){var n=this.__wrapped__;if(n instanceof Ye){var s=n;return this.__actions__.length&&(s=new Ye(this)),s=s.reverse(),s.__actions__.push({func:pa,args:[eh],thisArg:t}),new Lr(s,this.__chain__)}return this.thru(eh)}function h5(){return Pp(this.__wrapped__,this.__actions__)}var l5=oa(function(n,s,c){it.call(n,c)?++n[c]:bn(n,c,1)});function f5(n,s,c){var l=Re(n)?Hd:rD;return c&&fr(n,s,c)&&(s=t),l(n,be(s,3))}function d5(n,s){var c=Re(n)?Nn:lp;return c(n,be(s,3))}var p5=Mp(og),g5=Mp(ag);function v5(n,s){return Xt(ga(n,s),1)}function y5(n,s){return Xt(ga(n,s),Q)}function _5(n,s,c){return c=c===t?1:je(c),Xt(ga(n,s),c)}function dg(n,s){var c=Re(n)?$r:Un;return c(n,be(s,3))}function pg(n,s){var c=Re(n)?U2:hp;return c(n,be(s,3))}var b5=oa(function(n,s,c){it.call(n,c)?n[c].push(s):bn(n,c,[s])});function m5(n,s,c,l){n=mr(n)?n:zi(n),c=c&&!l?je(c):0;var g=n.length;return c<0&&(c=Kt(g+c,0)),ma(n)?c<=g&&n.indexOf(s,c)>-1:!!g&&Ti(n,s,c)>-1}var w5=Ke(function(n,s,c){var l=-1,g=typeof s=="function",_=mr(n)?z(n.length):[];return Un(n,function(O){_[++l]=g?Gt(s,O,c):$s(O,s,c)}),_}),E5=oa(function(n,s,c){bn(n,c,s)});function ga(n,s){var c=Re(n)?mt:yp;return c(n,be(s,3))}function D5(n,s,c,l){return n==null?[]:(Re(s)||(s=s==null?[]:[s]),c=l?t:c,Re(c)||(c=c==null?[]:[c]),wp(n,s,c))}var S5=oa(function(n,s,c){n[c?0:1].push(s)},function(){return[[],[]]});function x5(n,s,c){var l=Re(n)?du:Vd,g=arguments.length<3;return l(n,be(s,4),c,g,Un)}function O5(n,s,c){var l=Re(n)?j2:Vd,g=arguments.length<3;return l(n,be(s,4),c,g,hp)}function I5(n,s){var c=Re(n)?Nn:lp;return c(n,_a(be(s,3)))}function P5(n){var s=Re(n)?op:mD;return s(n)}function C5(n,s,c){(c?fr(n,s,c):s===t)?s=1:s=je(s);var l=Re(n)?Q6:wD;return l(n,s)}function A5(n){var s=Re(n)?X6:DD;return s(n)}function T5(n){if(n==null)return 0;if(mr(n))return ma(n)?Ni(n):n.length;var s=rr(n);return s==xe||s==Oe?n.size:Ru(n).length}function R5(n,s,c){var l=Re(n)?pu:SD;return c&&fr(n,s,c)&&(s=t),l(n,be(s,3))}var N5=Ke(function(n,s){if(n==null)return[];var c=s.length;return c>1&&fr(n,s[0],s[1])?s=[]:c>2&&fr(s[0],s[1],s[2])&&(s=[s[0]]),wp(n,Xt(s,1),[])}),va=d6||function(){return Xe.Date.now()};function $5(n,s){if(typeof s!="function")throw new Fr(u);return n=je(n),function(){if(--n<1)return s.apply(this,arguments)}}function gg(n,s,c){return s=c?t:s,s=n&&s==null?n.length:s,mn(n,h,t,t,t,t,s)}function vg(n,s){var c;if(typeof s!="function")throw new Fr(u);return n=je(n),function(){return--n>0&&(c=s.apply(this,arguments)),n<=1&&(s=t),c}}var rh=Ke(function(n,s,c){var l=K;if(c.length){var g=Fn(c,Hi(rh));l|=T}return mn(n,l,s,c,g)}),yg=Ke(function(n,s,c){var l=K|se;if(c.length){var g=Fn(c,Hi(yg));l|=T}return mn(s,l,n,c,g)});function _g(n,s,c){s=c?t:s;var l=mn(n,U,t,t,t,t,t,s);return l.placeholder=_g.placeholder,l}function bg(n,s,c){s=c?t:s;var l=mn(n,x,t,t,t,t,t,s);return l.placeholder=bg.placeholder,l}function mg(n,s,c){var l,g,_,O,N,M,X=0,Z=!1,ne=!1,ue=!0;if(typeof n!="function")throw new Fr(u);s=qr(s)||0,Et(c)&&(Z=!!c.leading,ne="maxWait"in c,_=ne?Kt(qr(c.maxWait)||0,s):_,ue="trailing"in c?!!c.trailing:ue);function ve($t){var Jr=l,xn=g;return l=g=t,X=$t,O=n.apply(xn,Jr),O}function Ee($t){return X=$t,N=Ms(Ge,s),Z?ve($t):O}function He($t){var Jr=$t-M,xn=$t-X,Mg=s-Jr;return ne?tr(Mg,_-xn):Mg}function De($t){var Jr=$t-M,xn=$t-X;return M===t||Jr>=s||Jr<0||ne&&xn>=_}function Ge(){var $t=va();if(De($t))return Ze($t);N=Ms(Ge,He($t))}function Ze($t){return N=t,ue&&l?ve($t):(l=g=t,O)}function Cr(){N!==t&&Ap(N),X=0,l=M=g=N=t}function dr(){return N===t?O:Ze(va())}function Ar(){var $t=va(),Jr=De($t);if(l=arguments,g=this,M=$t,Jr){if(N===t)return Ee(M);if(ne)return Ap(N),N=Ms(Ge,s),ve(M)}return N===t&&(N=Ms(Ge,s)),O}return Ar.cancel=Cr,Ar.flush=dr,Ar}var F5=Ke(function(n,s){return up(n,1,s)}),L5=Ke(function(n,s,c){return up(n,qr(s)||0,c)});function U5(n){return mn(n,G)}function ya(n,s){if(typeof n!="function"||s!=null&&typeof s!="function")throw new Fr(u);var c=function(){var l=arguments,g=s?s.apply(this,l):l[0],_=c.cache;if(_.has(g))return _.get(g);var O=n.apply(this,l);return c.cache=_.set(g,O)||_,O};return c.cache=new(ya.Cache||_n),c}ya.Cache=_n;function _a(n){if(typeof n!="function")throw new Fr(u);return function(){var s=arguments;switch(s.length){case 0:return!n.call(this);case 1:return!n.call(this,s[0]);case 2:return!n.call(this,s[0],s[1]);case 3:return!n.call(this,s[0],s[1],s[2])}return!n.apply(this,s)}}function j5(n){return vg(2,n)}var M5=xD(function(n,s){s=s.length==1&&Re(s[0])?mt(s[0],Or(be())):mt(Xt(s,1),Or(be()));var c=s.length;return Ke(function(l){for(var g=-1,_=tr(l.length,c);++g<_;)l[g]=s[g].call(this,l[g]);return Gt(n,this,l)})}),nh=Ke(function(n,s){var c=Fn(s,Hi(nh));return mn(n,T,t,s,c)}),wg=Ke(function(n,s){var c=Fn(s,Hi(wg));return mn(n,E,t,s,c)}),q5=wn(function(n,s){return mn(n,b,t,t,t,s)});function H5(n,s){if(typeof n!="function")throw new Fr(u);return s=s===t?s:je(s),Ke(n,s)}function B5(n,s){if(typeof n!="function")throw new Fr(u);return s=s==null?0:Kt(je(s),0),Ke(function(c){var l=c[s],g=qn(c,0,s);return l&&$n(g,l),Gt(n,this,g)})}function z5(n,s,c){var l=!0,g=!0;if(typeof n!="function")throw new Fr(u);return Et(c)&&(l="leading"in c?!!c.leading:l,g="trailing"in c?!!c.trailing:g),mg(n,s,{leading:l,maxWait:s,trailing:g})}function K5(n){return gg(n,1)}function V5(n,s){return nh(Hu(s),n)}function k5(){if(!arguments.length)return[];var n=arguments[0];return Re(n)?n:[n]}function G5(n){return Ur(n,C)}function W5(n,s){return s=typeof s=="function"?s:t,Ur(n,C,s)}function Y5(n){return Ur(n,I|C)}function J5(n,s){return s=typeof s=="function"?s:t,Ur(n,I|C,s)}function Q5(n,s){return s==null||cp(n,s,Wt(s))}function Yr(n,s){return n===s||n!==n&&s!==s}var X5=ha(Cu),Z5=ha(function(n,s){return n>=s}),li=pp(function(){return arguments}())?pp:function(n){return Ct(n)&&it.call(n,"callee")&&!ep.call(n,"callee")},Re=z.isArray,ex=hr?Or(hr):cD;function mr(n){return n!=null&&ba(n.length)&&!Dn(n)}function Nt(n){return Ct(n)&&mr(n)}function tx(n){return n===!0||n===!1||Ct(n)&&lr(n)==q}var Hn=g6||ph,rx=kr?Or(kr):uD;function nx(n){return Ct(n)&&n.nodeType===1&&!qs(n)}function ix(n){if(n==null)return!0;if(mr(n)&&(Re(n)||typeof n=="string"||typeof n.splice=="function"||Hn(n)||Bi(n)||li(n)))return!n.length;var s=rr(n);if(s==xe||s==Oe)return!n.size;if(js(n))return!Ru(n).length;for(var c in n)if(it.call(n,c))return!1;return!0}function sx(n,s){return Fs(n,s)}function ox(n,s,c){c=typeof c=="function"?c:t;var l=c?c(n,s):t;return l===t?Fs(n,s,t,c):!!l}function ih(n){if(!Ct(n))return!1;var s=lr(n);return s==A||s==d||typeof n.message=="string"&&typeof n.name=="string"&&!qs(n)}function ax(n){return typeof n=="number"&&rp(n)}function Dn(n){if(!Et(n))return!1;var s=lr(n);return s==ae||s==fe||s==H||s==yt}function Eg(n){return typeof n=="number"&&n==je(n)}function ba(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=V}function Et(n){var s=typeof n;return n!=null&&(s=="object"||s=="function")}function Ct(n){return n!=null&&typeof n=="object"}var Dg=Nr?Or(Nr):lD;function cx(n,s){return n===s||Tu(n,s,Wu(s))}function ux(n,s,c){return c=typeof c=="function"?c:t,Tu(n,s,Wu(s),c)}function hx(n){return Sg(n)&&n!=+n}function lx(n){if(WD(n))throw new Ae(a);return gp(n)}function fx(n){return n===null}function dx(n){return n==null}function Sg(n){return typeof n=="number"||Ct(n)&&lr(n)==Be}function qs(n){if(!Ct(n)||lr(n)!=Ue)return!1;var s=ko(n);if(s===null)return!0;var c=it.call(s,"constructor")&&s.constructor;return typeof c=="function"&&c instanceof c&&Bo.call(c)==u6}var sh=rn?Or(rn):fD;function px(n){return Eg(n)&&n>=-V&&n<=V}var xg=xs?Or(xs):dD;function ma(n){return typeof n=="string"||!Re(n)&&Ct(n)&&lr(n)==$e}function Pr(n){return typeof n=="symbol"||Ct(n)&&lr(n)==Fe}var Bi=ni?Or(ni):pD;function gx(n){return n===t}function vx(n){return Ct(n)&&rr(n)==Pe}function yx(n){return Ct(n)&&lr(n)==Le}var _x=ha(Nu),bx=ha(function(n,s){return n<=s});function Og(n){if(!n)return[];if(mr(n))return ma(n)?Gr(n):br(n);if(Is&&n[Is])return Q2(n[Is]());var s=rr(n),c=s==xe?mu:s==Oe?Mo:zi;return c(n)}function Sn(n){if(!n)return n===0?n:0;if(n=qr(n),n===Q||n===-Q){var s=n<0?-1:1;return s*k}return n===n?n:0}function je(n){var s=Sn(n),c=s%1;return s===s?c?s-c:s:0}function Ig(n){return n?ai(je(n),0,re):0}function qr(n){if(typeof n=="number")return n;if(Pr(n))return J;if(Et(n)){var s=typeof n.valueOf=="function"?n.valueOf():n;n=Et(s)?s+"":s}if(typeof n!="string")return n===0?n:+n;n=kd(n);var c=Yc.test(n);return c||Qc.test(n)?Te(n.slice(2),c?2:8):Wc.test(n)?J:+n}function Pg(n){return sn(n,wr(n))}function mx(n){return n?ai(je(n),-V,V):n===0?n:0}function nt(n){return n==null?"":Ir(n)}var wx=Mi(function(n,s){if(js(s)||mr(s)){sn(s,Wt(s),n);return}for(var c in s)it.call(s,c)&&Rs(n,c,s[c])}),Cg=Mi(function(n,s){sn(s,wr(s),n)}),wa=Mi(function(n,s,c,l){sn(s,wr(s),n,l)}),Ex=Mi(function(n,s,c,l){sn(s,Wt(s),n,l)}),Dx=wn(Ou);function Sx(n,s){var c=ji(n);return s==null?c:ap(c,s)}var xx=Ke(function(n,s){n=ht(n);var c=-1,l=s.length,g=l>2?s[2]:t;for(g&&fr(s[0],s[1],g)&&(l=1);++c<l;)for(var _=s[c],O=wr(_),N=-1,M=O.length;++N<M;){var X=O[N],Z=n[X];(Z===t||Yr(Z,Fi[X])&&!it.call(n,X))&&(n[X]=_[X])}return n}),Ox=Ke(function(n){return n.push(t,kp),Gt(Ag,t,n)});function Ix(n,s){return Bd(n,be(s,3),nn)}function Px(n,s){return Bd(n,be(s,3),Pu)}function Cx(n,s){return n==null?n:Iu(n,be(s,3),wr)}function Ax(n,s){return n==null?n:fp(n,be(s,3),wr)}function Tx(n,s){return n&&nn(n,be(s,3))}function Rx(n,s){return n&&Pu(n,be(s,3))}function Nx(n){return n==null?[]:ra(n,Wt(n))}function $x(n){return n==null?[]:ra(n,wr(n))}function oh(n,s,c){var l=n==null?t:ci(n,s);return l===t?c:l}function Fx(n,s){return n!=null&&Yp(n,s,iD)}function ah(n,s){return n!=null&&Yp(n,s,sD)}var Lx=Hp(function(n,s,c){s!=null&&typeof s.toString!="function"&&(s=zo.call(s)),n[s]=c},uh(Er)),Ux=Hp(function(n,s,c){s!=null&&typeof s.toString!="function"&&(s=zo.call(s)),it.call(n,s)?n[s].push(c):n[s]=[c]},be),jx=Ke($s);function Wt(n){return mr(n)?sp(n):Ru(n)}function wr(n){return mr(n)?sp(n,!0):gD(n)}function Mx(n,s){var c={};return s=be(s,3),nn(n,function(l,g,_){bn(c,s(l,g,_),l)}),c}function qx(n,s){var c={};return s=be(s,3),nn(n,function(l,g,_){bn(c,g,s(l,g,_))}),c}var Hx=Mi(function(n,s,c){na(n,s,c)}),Ag=Mi(function(n,s,c,l){na(n,s,c,l)}),Bx=wn(function(n,s){var c={};if(n==null)return c;var l=!1;s=mt(s,function(_){return _=Mn(_,n),l||(l=_.length>1),_}),sn(n,ku(n),c),l&&(c=Ur(c,I|S|C,LD));for(var g=s.length;g--;)ju(c,s[g]);return c});function zx(n,s){return Tg(n,_a(be(s)))}var Kx=wn(function(n,s){return n==null?{}:yD(n,s)});function Tg(n,s){if(n==null)return{};var c=mt(ku(n),function(l){return[l]});return s=be(s),Ep(n,c,function(l,g){return s(l,g[0])})}function Vx(n,s,c){s=Mn(s,n);var l=-1,g=s.length;for(g||(g=1,n=t);++l<g;){var _=n==null?t:n[on(s[l])];_===t&&(l=g,_=c),n=Dn(_)?_.call(n):_}return n}function kx(n,s,c){return n==null?n:Ls(n,s,c)}function Gx(n,s,c,l){return l=typeof l=="function"?l:t,n==null?n:Ls(n,s,c,l)}var Rg=Kp(Wt),Ng=Kp(wr);function Wx(n,s,c){var l=Re(n),g=l||Hn(n)||Bi(n);if(s=be(s,4),c==null){var _=n&&n.constructor;g?c=l?new _:[]:Et(n)?c=Dn(_)?ji(ko(n)):{}:c={}}return(g?$r:nn)(n,function(O,N,M){return s(c,O,N,M)}),c}function Yx(n,s){return n==null?!0:ju(n,s)}function Jx(n,s,c){return n==null?n:Ip(n,s,Hu(c))}function Qx(n,s,c,l){return l=typeof l=="function"?l:t,n==null?n:Ip(n,s,Hu(c),l)}function zi(n){return n==null?[]:bu(n,Wt(n))}function Xx(n){return n==null?[]:bu(n,wr(n))}function Zx(n,s,c){return c===t&&(c=s,s=t),c!==t&&(c=qr(c),c=c===c?c:0),s!==t&&(s=qr(s),s=s===s?s:0),ai(qr(n),s,c)}function eO(n,s,c){return s=Sn(s),c===t?(c=s,s=0):c=Sn(c),n=qr(n),oD(n,s,c)}function tO(n,s,c){if(c&&typeof c!="boolean"&&fr(n,s,c)&&(s=c=t),c===t&&(typeof s=="boolean"?(c=s,s=t):typeof n=="boolean"&&(c=n,n=t)),n===t&&s===t?(n=0,s=1):(n=Sn(n),s===t?(s=n,n=0):s=Sn(s)),n>s){var l=n;n=s,s=l}if(c||n%1||s%1){var g=np();return tr(n+g*(s-n+ct("1e-"+((g+"").length-1))),s)}return Fu(n,s)}var rO=qi(function(n,s,c){return s=s.toLowerCase(),n+(c?$g(s):s)});function $g(n){return ch(nt(n).toLowerCase())}function Fg(n){return n=nt(n),n&&n.replace(gn,k2).replace(hu,"")}function nO(n,s,c){n=nt(n),s=Ir(s);var l=n.length;c=c===t?l:ai(je(c),0,l);var g=c;return c-=s.length,c>=0&&n.slice(c,g)==s}function iO(n){return n=nt(n),n&&_t.test(n)?n.replace(Xn,G2):n}function sO(n){return n=nt(n),n&&jt.test(n)?n.replace(Ot,"\\$&"):n}var oO=qi(function(n,s,c){return n+(c?"-":"")+s.toLowerCase()}),aO=qi(function(n,s,c){return n+(c?" ":"")+s.toLowerCase()}),cO=jp("toLowerCase");function uO(n,s,c){n=nt(n),s=je(s);var l=s?Ni(n):0;if(!s||l>=s)return n;var g=(s-l)/2;return ua(Jo(g),c)+n+ua(Yo(g),c)}function hO(n,s,c){n=nt(n),s=je(s);var l=s?Ni(n):0;return s&&l<s?n+ua(s-l,c):n}function lO(n,s,c){n=nt(n),s=je(s);var l=s?Ni(n):0;return s&&l<s?ua(s-l,c)+n:n}function fO(n,s,c){return c||s==null?s=0:s&&(s=+s),b6(nt(n).replace(It,""),s||0)}function dO(n,s,c){return(c?fr(n,s,c):s===t)?s=1:s=je(s),Lu(nt(n),s)}function pO(){var n=arguments,s=nt(n[0]);return n.length<3?s:s.replace(n[1],n[2])}var gO=qi(function(n,s,c){return n+(c?"_":"")+s.toLowerCase()});function vO(n,s,c){return c&&typeof c!="number"&&fr(n,s,c)&&(s=c=t),c=c===t?re:c>>>0,c?(n=nt(n),n&&(typeof s=="string"||s!=null&&!sh(s))&&(s=Ir(s),!s&&Ri(n))?qn(Gr(n),0,c):n.split(s,c)):[]}var yO=qi(function(n,s,c){return n+(c?" ":"")+ch(s)});function _O(n,s,c){return n=nt(n),c=c==null?0:ai(je(c),0,n.length),s=Ir(s),n.slice(c,c+s.length)==s}function bO(n,s,c){var l=y.templateSettings;c&&fr(n,s,c)&&(s=t),n=nt(n),s=wa({},s,l,Vp);var g=wa({},s.imports,l.imports,Vp),_=Wt(g),O=bu(g,_),N,M,X=0,Z=s.interpolate||Si,ne="__p += '",ue=wu((s.escape||Si).source+"|"+Z.source+"|"+(Z===wt?Gc:Si).source+"|"+(s.evaluate||Si).source+"|$","g"),ve="//# sourceURL="+(it.call(s,"sourceURL")?(s.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++lu+"]")+`
82
- `;n.replace(ue,function(De,Ge,Ze,Cr,dr,Ar){return Ze||(Ze=Cr),ne+=n.slice(X,Ar).replace(Zc,W2),Ge&&(N=!0,ne+=`' +
81
+ `)}function MD(r){return Re(r)||hi(r)||!!(Xd&&r&&r[Xd])}function wn(r,s){var a=typeof r;return s=s??V,!!s&&(a=="number"||a!="symbol"&&Qc.test(r))&&r>-1&&r%1==0&&r<s}function lr(r,s,a){if(!Et(a))return!1;var l=typeof s;return(l=="number"?br(a)&&wn(s,a.length):l=="string"&&s in a)?Wr(a[s],r):!1}function Yu(r,s){if(Re(r))return!1;var a=typeof r;return a=="number"||a=="symbol"||a=="boolean"||r==null||Ir(r)?!0:Lt.test(r)||!bt.test(r)||s!=null&&r in ht(s)}function qD(r){var s=typeof r;return s=="string"||s=="number"||s=="symbol"||s=="boolean"?r!=="__proto__":r===null}function Ju(r){var s=ha(r),a=y[s];if(typeof a!="function"||!(s in Ye.prototype))return!1;if(r===a)return!0;var l=ku(a);return!!l&&r===l[0]}function HD(r){return!!Wd&&Wd in r}var BD=qo?En:dh;function Us(r){var s=r&&r.constructor,a=typeof s=="function"&&s.prototype||$i;return r===a}function Wp(r){return r===r&&!Et(r)}function Yp(r,s){return function(a){return a==null?!1:a[r]===s&&(s!==t||r in ht(a))}}function zD(r){var s=va(r,function(l){return a.size===p&&a.clear(),l}),a=s.cache;return s}function KD(r,s){var a=r[1],l=s[1],g=a|l,_=g<(K|se|h),O=l==h&&a==U||l==h&&a==b&&r[7].length<=s[8]||l==(h|b)&&s[7].length<=s[8]&&a==U;if(!(_||O))return r;l&K&&(r[2]=s[2],g|=a&K?0:$);var N=s[3];if(N){var M=r[3];r[3]=M?Tp(M,N,s[4]):N,r[4]=M?$n(r[3],w):s[4]}return N=s[5],N&&(M=r[5],r[5]=M?Rp(M,N,s[6]):N,r[6]=M?$n(r[5],w):s[6]),N=s[7],N&&(r[7]=N),l&h&&(r[8]=r[8]==null?s[8]:tr(r[8],s[8])),r[9]==null&&(r[9]=s[9]),r[0]=s[0],r[1]=g,r}function VD(r){var s=[];if(r!=null)for(var a in ht(r))s.push(a);return s}function kD(r){return Bo.call(r)}function Jp(r,s,a){return s=Kt(s===t?r.length-1:s,0),function(){for(var l=arguments,g=-1,_=Kt(l.length-s,0),O=z(_);++g<_;)O[g]=l[s+g];g=-1;for(var N=z(s+1);++g<s;)N[g]=l[g];return N[s]=a(O),Gt(r,this,N)}}function Qp(r,s){return s.length<2?r:ai(r,Ur(s,0,-1))}function GD(r,s){for(var a=r.length,l=tr(s.length,a),g=_r(r);l--;){var _=s[l];r[l]=wn(_,a)?g[_]:t}return r}function Qu(r,s){if(!(s==="constructor"&&typeof r[s]=="function")&&s!="__proto__")return r[s]}var Xp=eg(wp),js=c6||function(r,s){return Xe.setTimeout(r,s)},Xu=eg(vD);function Zp(r,s,a){var l=s+"";return Xu(r,jD(l,WD(FD(l),a)))}function eg(r){var s=0,a=0;return function(){var l=f6(),g=de-(l-a);if(a=l,g>0){if(++s>=ce)return arguments[0]}else s=0;return r.apply(t,arguments)}}function fa(r,s){var a=-1,l=r.length,g=l-1;for(s=s===t?l:s;++a<s;){var _=$u(a,g),O=r[_];r[_]=r[a],r[a]=O}return r.length=s,r}var tg=zD(function(r){var s=[];return r.charCodeAt(0)===46&&s.push(""),r.replace(Ut,function(a,l,g,_){s.push(g?_.replace(Vc,"$1"):l||a)}),s});function sn(r){if(typeof r=="string"||Ir(r))return r;var s=r+"";return s=="0"&&1/r==-Q?"-0":s}function ui(r){if(r!=null){try{return Ho.call(r)}catch{}try{return r+""}catch{}}return""}function WD(r,s){return Nr(we,function(a){var l="_."+a[0];s&a[1]&&!Lo(r,l)&&r.push(l)}),r.sort()}function rg(r){if(r instanceof Ye)return r.clone();var s=new Fr(r.__wrapped__,r.__chain__);return s.__actions__=_r(r.__actions__),s.__index__=r.__index__,s.__values__=r.__values__,s}function YD(r,s,a){(a?lr(r,s,a):s===t)?s=1:s=Kt(je(s),0);var l=r==null?0:r.length;if(!l||s<1)return[];for(var g=0,_=0,O=z(Wo(l/s));g<l;)O[_++]=Ur(r,g,g+=s);return O}function JD(r){for(var s=-1,a=r==null?0:r.length,l=0,g=[];++s<a;){var _=r[s];_&&(g[l++]=_)}return g}function QD(){var r=arguments.length;if(!r)return[];for(var s=z(r-1),a=arguments[0],l=r;l--;)s[l-1]=arguments[l];return Nn(Re(a)?_r(a):[a],Xt(s,1))}var XD=Ke(function(r,s){return Nt(r)?Rs(r,Xt(s,1,Nt,!0)):[]}),ZD=Ke(function(r,s){var a=jr(s);return Nt(a)&&(a=t),Nt(r)?Rs(r,Xt(s,1,Nt,!0),be(a,2)):[]}),eS=Ke(function(r,s){var a=jr(s);return Nt(a)&&(a=t),Nt(r)?Rs(r,Xt(s,1,Nt,!0),t,a):[]});function tS(r,s,a){var l=r==null?0:r.length;return l?(s=a||s===t?1:je(s),Ur(r,s<0?0:s,l)):[]}function rS(r,s,a){var l=r==null?0:r.length;return l?(s=a||s===t?1:je(s),s=l-s,Ur(r,0,s<0?0:s)):[]}function nS(r,s){return r&&r.length?ia(r,be(s,3),!0,!0):[]}function iS(r,s){return r&&r.length?ia(r,be(s,3),!0):[]}function sS(r,s,a,l){var g=r==null?0:r.length;return g?(a&&typeof a!="number"&&lr(r,s,a)&&(a=0,l=g),Q6(r,s,a,l)):[]}function ng(r,s,a){var l=r==null?0:r.length;if(!l)return-1;var g=a==null?0:je(a);return g<0&&(g=Kt(l+g,0)),Uo(r,be(s,3),g)}function ig(r,s,a){var l=r==null?0:r.length;if(!l)return-1;var g=l-1;return a!==t&&(g=je(a),g=a<0?Kt(l+g,0):tr(g,l-1)),Uo(r,be(s,3),g,!0)}function sg(r){var s=r==null?0:r.length;return s?Xt(r,1):[]}function oS(r){var s=r==null?0:r.length;return s?Xt(r,Q):[]}function aS(r,s){var a=r==null?0:r.length;return a?(s=s===t?1:je(s),Xt(r,s)):[]}function cS(r){for(var s=-1,a=r==null?0:r.length,l={};++s<a;){var g=r[s];l[g[0]]=g[1]}return l}function og(r){return r&&r.length?r[0]:t}function uS(r,s,a){var l=r==null?0:r.length;if(!l)return-1;var g=a==null?0:je(a);return g<0&&(g=Kt(l+g,0)),Ai(r,s,g)}function hS(r){var s=r==null?0:r.length;return s?Ur(r,0,-1):[]}var lS=Ke(function(r){var s=mt(r,Mu);return s.length&&s[0]===r[0]?Cu(s):[]}),fS=Ke(function(r){var s=jr(r),a=mt(r,Mu);return s===jr(a)?s=t:a.pop(),a.length&&a[0]===r[0]?Cu(a,be(s,2)):[]}),dS=Ke(function(r){var s=jr(r),a=mt(r,Mu);return s=typeof s=="function"?s:t,s&&a.pop(),a.length&&a[0]===r[0]?Cu(a,t,s):[]});function pS(r,s){return r==null?"":h6.call(r,s)}function jr(r){var s=r==null?0:r.length;return s?r[s-1]:t}function gS(r,s,a){var l=r==null?0:r.length;if(!l)return-1;var g=l;return a!==t&&(g=je(a),g=g<0?Kt(l+g,0):tr(g,l-1)),s===s?W2(r,s,g):Uo(r,qd,g,!0)}function vS(r,s){return r&&r.length?yp(r,je(s)):t}var yS=Ke(ag);function ag(r,s){return r&&r.length&&s&&s.length?Nu(r,s):r}function _S(r,s,a){return r&&r.length&&s&&s.length?Nu(r,s,be(a,2)):r}function bS(r,s,a){return r&&r.length&&s&&s.length?Nu(r,s,t,a):r}var mS=mn(function(r,s){var a=r==null?0:r.length,l=xu(r,s);return mp(r,mt(s,function(g){return wn(g,a)?+g:g}).sort(Ap)),l});function wS(r,s){var a=[];if(!(r&&r.length))return a;var l=-1,g=[],_=r.length;for(s=be(s,3);++l<_;){var O=r[l];s(O,l,r)&&(a.push(O),g.push(l))}return mp(r,g),a}function Zu(r){return r==null?r:p6.call(r)}function ES(r,s,a){var l=r==null?0:r.length;return l?(a&&typeof a!="number"&&lr(r,s,a)?(s=0,a=l):(s=s==null?0:je(s),a=a===t?l:je(a)),Ur(r,s,a)):[]}function DS(r,s){return na(r,s)}function SS(r,s,a){return Lu(r,s,be(a,2))}function xS(r,s){var a=r==null?0:r.length;if(a){var l=na(r,s);if(l<a&&Wr(r[l],s))return l}return-1}function OS(r,s){return na(r,s,!0)}function IS(r,s,a){return Lu(r,s,be(a,2),!0)}function PS(r,s){var a=r==null?0:r.length;if(a){var l=na(r,s,!0)-1;if(Wr(r[l],s))return l}return-1}function CS(r){return r&&r.length?Ep(r):[]}function AS(r,s){return r&&r.length?Ep(r,be(s,2)):[]}function TS(r){var s=r==null?0:r.length;return s?Ur(r,1,s):[]}function RS(r,s,a){return r&&r.length?(s=a||s===t?1:je(s),Ur(r,0,s<0?0:s)):[]}function NS(r,s,a){var l=r==null?0:r.length;return l?(s=a||s===t?1:je(s),s=l-s,Ur(r,s<0?0:s,l)):[]}function $S(r,s){return r&&r.length?ia(r,be(s,3),!1,!0):[]}function FS(r,s){return r&&r.length?ia(r,be(s,3)):[]}var LS=Ke(function(r){return Un(Xt(r,1,Nt,!0))}),US=Ke(function(r){var s=jr(r);return Nt(s)&&(s=t),Un(Xt(r,1,Nt,!0),be(s,2))}),jS=Ke(function(r){var s=jr(r);return s=typeof s=="function"?s:t,Un(Xt(r,1,Nt,!0),t,s)});function MS(r){return r&&r.length?Un(r):[]}function qS(r,s){return r&&r.length?Un(r,be(s,2)):[]}function HS(r,s){return s=typeof s=="function"?s:t,r&&r.length?Un(r,t,s):[]}function eh(r){if(!(r&&r.length))return[];var s=0;return r=Rn(r,function(a){if(Nt(a))return s=Kt(a.length,s),!0}),yu(s,function(a){return mt(r,pu(a))})}function cg(r,s){if(!(r&&r.length))return[];var a=eh(r);return s==null?a:mt(a,function(l){return Gt(s,t,l)})}var BS=Ke(function(r,s){return Nt(r)?Rs(r,s):[]}),zS=Ke(function(r){return ju(Rn(r,Nt))}),KS=Ke(function(r){var s=jr(r);return Nt(s)&&(s=t),ju(Rn(r,Nt),be(s,2))}),VS=Ke(function(r){var s=jr(r);return s=typeof s=="function"?s:t,ju(Rn(r,Nt),t,s)}),kS=Ke(eh);function GS(r,s){return Op(r||[],s||[],Ts)}function WS(r,s){return Op(r||[],s||[],Fs)}var YS=Ke(function(r){var s=r.length,a=s>1?r[s-1]:t;return a=typeof a=="function"?(r.pop(),a):t,cg(r,a)});function ug(r){var s=y(r);return s.__chain__=!0,s}function JS(r,s){return s(r),r}function da(r,s){return s(r)}var QS=mn(function(r){var s=r.length,a=s?r[0]:0,l=this.__wrapped__,g=function(_){return xu(_,r)};return s>1||this.__actions__.length||!(l instanceof Ye)||!wn(a)?this.thru(g):(l=l.slice(a,+a+(s?1:0)),l.__actions__.push({func:da,args:[g],thisArg:t}),new Fr(l,this.__chain__).thru(function(_){return s&&!_.length&&_.push(t),_}))});function XS(){return ug(this)}function ZS(){return new Fr(this.value(),this.__chain__)}function e5(){this.__values__===t&&(this.__values__=Dg(this.value()));var r=this.__index__>=this.__values__.length,s=r?t:this.__values__[this.__index__++];return{done:r,value:s}}function t5(){return this}function r5(r){for(var s,a=this;a instanceof Xo;){var l=rg(a);l.__index__=0,l.__values__=t,s?g.__wrapped__=l:s=l;var g=l;a=a.__wrapped__}return g.__wrapped__=r,s}function n5(){var r=this.__wrapped__;if(r instanceof Ye){var s=r;return this.__actions__.length&&(s=new Ye(this)),s=s.reverse(),s.__actions__.push({func:da,args:[Zu],thisArg:t}),new Fr(s,this.__chain__)}return this.thru(Zu)}function i5(){return xp(this.__wrapped__,this.__actions__)}var s5=sa(function(r,s,a){it.call(r,a)?++r[a]:_n(r,a,1)});function o5(r,s,a){var l=Re(r)?jd:J6;return a&&lr(r,s,a)&&(s=t),l(r,be(s,3))}function a5(r,s){var a=Re(r)?Rn:cp;return a(r,be(s,3))}var c5=Lp(ng),u5=Lp(ig);function h5(r,s){return Xt(pa(r,s),1)}function l5(r,s){return Xt(pa(r,s),Q)}function f5(r,s,a){return a=a===t?1:je(a),Xt(pa(r,s),a)}function hg(r,s){var a=Re(r)?Nr:Ln;return a(r,be(s,3))}function lg(r,s){var a=Re(r)?T2:ap;return a(r,be(s,3))}var d5=sa(function(r,s,a){it.call(r,a)?r[a].push(s):_n(r,a,[s])});function p5(r,s,a,l){r=br(r)?r:Bi(r),a=a&&!l?je(a):0;var g=r.length;return a<0&&(a=Kt(g+a,0)),ba(r)?a<=g&&r.indexOf(s,a)>-1:!!g&&Ai(r,s,a)>-1}var g5=Ke(function(r,s,a){var l=-1,g=typeof s=="function",_=br(r)?z(r.length):[];return Ln(r,function(O){_[++l]=g?Gt(s,O,a):Ns(O,s,a)}),_}),v5=sa(function(r,s,a){_n(r,a,s)});function pa(r,s){var a=Re(r)?mt:pp;return a(r,be(s,3))}function y5(r,s,a,l){return r==null?[]:(Re(s)||(s=s==null?[]:[s]),a=l?t:a,Re(a)||(a=a==null?[]:[a]),_p(r,s,a))}var _5=sa(function(r,s,a){r[a?0:1].push(s)},function(){return[[],[]]});function b5(r,s,a){var l=Re(r)?fu:Bd,g=arguments.length<3;return l(r,be(s,4),a,g,Ln)}function m5(r,s,a){var l=Re(r)?R2:Bd,g=arguments.length<3;return l(r,be(s,4),a,g,ap)}function w5(r,s){var a=Re(r)?Rn:cp;return a(r,ya(be(s,3)))}function E5(r){var s=Re(r)?np:pD;return s(r)}function D5(r,s,a){(a?lr(r,s,a):s===t)?s=1:s=je(s);var l=Re(r)?V6:gD;return l(r,s)}function S5(r){var s=Re(r)?k6:yD;return s(r)}function x5(r){if(r==null)return 0;if(br(r))return ba(r)?Ri(r):r.length;var s=rr(r);return s==xe||s==Oe?r.size:Tu(r).length}function O5(r,s,a){var l=Re(r)?du:_D;return a&&lr(r,s,a)&&(s=t),l(r,be(s,3))}var I5=Ke(function(r,s){if(r==null)return[];var a=s.length;return a>1&&lr(r,s[0],s[1])?s=[]:a>2&&lr(s[0],s[1],s[2])&&(s=[s[0]]),_p(r,Xt(s,1),[])}),ga=a6||function(){return Xe.Date.now()};function P5(r,s){if(typeof s!="function")throw new $r(u);return r=je(r),function(){if(--r<1)return s.apply(this,arguments)}}function fg(r,s,a){return s=a?t:s,s=r&&s==null?r.length:s,bn(r,h,t,t,t,t,s)}function dg(r,s){var a;if(typeof s!="function")throw new $r(u);return r=je(r),function(){return--r>0&&(a=s.apply(this,arguments)),r<=1&&(s=t),a}}var th=Ke(function(r,s,a){var l=K;if(a.length){var g=$n(a,qi(th));l|=T}return bn(r,l,s,a,g)}),pg=Ke(function(r,s,a){var l=K|se;if(a.length){var g=$n(a,qi(pg));l|=T}return bn(s,l,r,a,g)});function gg(r,s,a){s=a?t:s;var l=bn(r,U,t,t,t,t,t,s);return l.placeholder=gg.placeholder,l}function vg(r,s,a){s=a?t:s;var l=bn(r,x,t,t,t,t,t,s);return l.placeholder=vg.placeholder,l}function yg(r,s,a){var l,g,_,O,N,M,X=0,Z=!1,ne=!1,ue=!0;if(typeof r!="function")throw new $r(u);s=Mr(s)||0,Et(a)&&(Z=!!a.leading,ne="maxWait"in a,_=ne?Kt(Mr(a.maxWait)||0,s):_,ue="trailing"in a?!!a.trailing:ue);function ve($t){var Yr=l,Sn=g;return l=g=t,X=$t,O=r.apply(Sn,Yr),O}function Ee($t){return X=$t,N=js(Ge,s),Z?ve($t):O}function He($t){var Yr=$t-M,Sn=$t-X,Lg=s-Yr;return ne?tr(Lg,_-Sn):Lg}function De($t){var Yr=$t-M,Sn=$t-X;return M===t||Yr>=s||Yr<0||ne&&Sn>=_}function Ge(){var $t=ga();if(De($t))return Ze($t);N=js(Ge,He($t))}function Ze($t){return N=t,ue&&l?ve($t):(l=g=t,O)}function Pr(){N!==t&&Ip(N),X=0,l=M=g=N=t}function fr(){return N===t?O:Ze(ga())}function Cr(){var $t=ga(),Yr=De($t);if(l=arguments,g=this,M=$t,Yr){if(N===t)return Ee(M);if(ne)return Ip(N),N=js(Ge,s),ve(M)}return N===t&&(N=js(Ge,s)),O}return Cr.cancel=Pr,Cr.flush=fr,Cr}var C5=Ke(function(r,s){return op(r,1,s)}),A5=Ke(function(r,s,a){return op(r,Mr(s)||0,a)});function T5(r){return bn(r,G)}function va(r,s){if(typeof r!="function"||s!=null&&typeof s!="function")throw new $r(u);var a=function(){var l=arguments,g=s?s.apply(this,l):l[0],_=a.cache;if(_.has(g))return _.get(g);var O=r.apply(this,l);return a.cache=_.set(g,O)||_,O};return a.cache=new(va.Cache||yn),a}va.Cache=yn;function ya(r){if(typeof r!="function")throw new $r(u);return function(){var s=arguments;switch(s.length){case 0:return!r.call(this);case 1:return!r.call(this,s[0]);case 2:return!r.call(this,s[0],s[1]);case 3:return!r.call(this,s[0],s[1],s[2])}return!r.apply(this,s)}}function R5(r){return dg(2,r)}var N5=bD(function(r,s){s=s.length==1&&Re(s[0])?mt(s[0],xr(be())):mt(Xt(s,1),xr(be()));var a=s.length;return Ke(function(l){for(var g=-1,_=tr(l.length,a);++g<_;)l[g]=s[g].call(this,l[g]);return Gt(r,this,l)})}),rh=Ke(function(r,s){var a=$n(s,qi(rh));return bn(r,T,t,s,a)}),_g=Ke(function(r,s){var a=$n(s,qi(_g));return bn(r,E,t,s,a)}),$5=mn(function(r,s){return bn(r,b,t,t,t,s)});function F5(r,s){if(typeof r!="function")throw new $r(u);return s=s===t?s:je(s),Ke(r,s)}function L5(r,s){if(typeof r!="function")throw new $r(u);return s=s==null?0:Kt(je(s),0),Ke(function(a){var l=a[s],g=Mn(a,0,s);return l&&Nn(g,l),Gt(r,this,g)})}function U5(r,s,a){var l=!0,g=!0;if(typeof r!="function")throw new $r(u);return Et(a)&&(l="leading"in a?!!a.leading:l,g="trailing"in a?!!a.trailing:g),yg(r,s,{leading:l,maxWait:s,trailing:g})}function j5(r){return fg(r,1)}function M5(r,s){return rh(qu(s),r)}function q5(){if(!arguments.length)return[];var r=arguments[0];return Re(r)?r:[r]}function H5(r){return Lr(r,C)}function B5(r,s){return s=typeof s=="function"?s:t,Lr(r,C,s)}function z5(r){return Lr(r,I|C)}function K5(r,s){return s=typeof s=="function"?s:t,Lr(r,I|C,s)}function V5(r,s){return s==null||sp(r,s,Wt(s))}function Wr(r,s){return r===s||r!==r&&s!==s}var k5=ua(Pu),G5=ua(function(r,s){return r>=s}),hi=lp(function(){return arguments}())?lp:function(r){return Ct(r)&&it.call(r,"callee")&&!Qd.call(r,"callee")},Re=z.isArray,W5=ur?xr(ur):rD;function br(r){return r!=null&&_a(r.length)&&!En(r)}function Nt(r){return Ct(r)&&br(r)}function Y5(r){return r===!0||r===!1||Ct(r)&&hr(r)==q}var qn=u6||dh,J5=Vr?xr(Vr):nD;function Q5(r){return Ct(r)&&r.nodeType===1&&!Ms(r)}function X5(r){if(r==null)return!0;if(br(r)&&(Re(r)||typeof r=="string"||typeof r.splice=="function"||qn(r)||Hi(r)||hi(r)))return!r.length;var s=rr(r);if(s==xe||s==Oe)return!r.size;if(Us(r))return!Tu(r).length;for(var a in r)if(it.call(r,a))return!1;return!0}function Z5(r,s){return $s(r,s)}function ex(r,s,a){a=typeof a=="function"?a:t;var l=a?a(r,s):t;return l===t?$s(r,s,t,a):!!l}function nh(r){if(!Ct(r))return!1;var s=hr(r);return s==A||s==d||typeof r.message=="string"&&typeof r.name=="string"&&!Ms(r)}function tx(r){return typeof r=="number"&&Zd(r)}function En(r){if(!Et(r))return!1;var s=hr(r);return s==ae||s==fe||s==H||s==yt}function bg(r){return typeof r=="number"&&r==je(r)}function _a(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=V}function Et(r){var s=typeof r;return r!=null&&(s=="object"||s=="function")}function Ct(r){return r!=null&&typeof r=="object"}var mg=Rr?xr(Rr):sD;function rx(r,s){return r===s||Au(r,s,Gu(s))}function nx(r,s,a){return a=typeof a=="function"?a:t,Au(r,s,Gu(s),a)}function ix(r){return wg(r)&&r!=+r}function sx(r){if(BD(r))throw new Ae(c);return fp(r)}function ox(r){return r===null}function ax(r){return r==null}function wg(r){return typeof r=="number"||Ct(r)&&hr(r)==Be}function Ms(r){if(!Ct(r)||hr(r)!=Ue)return!1;var s=Vo(r);if(s===null)return!0;var a=it.call(s,"constructor")&&s.constructor;return typeof a=="function"&&a instanceof a&&Ho.call(a)==n6}var ih=tn?xr(tn):oD;function cx(r){return bg(r)&&r>=-V&&r<=V}var Eg=Ss?xr(Ss):aD;function ba(r){return typeof r=="string"||!Re(r)&&Ct(r)&&hr(r)==$e}function Ir(r){return typeof r=="symbol"||Ct(r)&&hr(r)==Fe}var Hi=ri?xr(ri):cD;function ux(r){return r===t}function hx(r){return Ct(r)&&rr(r)==Pe}function lx(r){return Ct(r)&&hr(r)==Le}var fx=ua(Ru),dx=ua(function(r,s){return r<=s});function Dg(r){if(!r)return[];if(br(r))return ba(r)?kr(r):_r(r);if(Os&&r[Os])return V2(r[Os]());var s=rr(r),a=s==xe?bu:s==Oe?jo:Bi;return a(r)}function Dn(r){if(!r)return r===0?r:0;if(r=Mr(r),r===Q||r===-Q){var s=r<0?-1:1;return s*k}return r===r?r:0}function je(r){var s=Dn(r),a=s%1;return s===s?a?s-a:s:0}function Sg(r){return r?oi(je(r),0,re):0}function Mr(r){if(typeof r=="number")return r;if(Ir(r))return J;if(Et(r)){var s=typeof r.valueOf=="function"?r.valueOf():r;r=Et(s)?s+"":s}if(typeof r!="string")return r===0?r:+r;r=zd(r);var a=Wc.test(r);return a||Jc.test(r)?Te(r.slice(2),a?2:8):Gc.test(r)?J:+r}function xg(r){return nn(r,mr(r))}function px(r){return r?oi(je(r),-V,V):r===0?r:0}function nt(r){return r==null?"":Or(r)}var gx=ji(function(r,s){if(Us(s)||br(s)){nn(s,Wt(s),r);return}for(var a in s)it.call(s,a)&&Ts(r,a,s[a])}),Og=ji(function(r,s){nn(s,mr(s),r)}),ma=ji(function(r,s,a,l){nn(s,mr(s),r,l)}),vx=ji(function(r,s,a,l){nn(s,Wt(s),r,l)}),yx=mn(xu);function _x(r,s){var a=Ui(r);return s==null?a:ip(a,s)}var bx=Ke(function(r,s){r=ht(r);var a=-1,l=s.length,g=l>2?s[2]:t;for(g&&lr(s[0],s[1],g)&&(l=1);++a<l;)for(var _=s[a],O=mr(_),N=-1,M=O.length;++N<M;){var X=O[N],Z=r[X];(Z===t||Wr(Z,$i[X])&&!it.call(r,X))&&(r[X]=_[X])}return r}),mx=Ke(function(r){return r.push(t,zp),Gt(Ig,t,r)});function wx(r,s){return Md(r,be(s,3),rn)}function Ex(r,s){return Md(r,be(s,3),Iu)}function Dx(r,s){return r==null?r:Ou(r,be(s,3),mr)}function Sx(r,s){return r==null?r:up(r,be(s,3),mr)}function xx(r,s){return r&&rn(r,be(s,3))}function Ox(r,s){return r&&Iu(r,be(s,3))}function Ix(r){return r==null?[]:ta(r,Wt(r))}function Px(r){return r==null?[]:ta(r,mr(r))}function sh(r,s,a){var l=r==null?t:ai(r,s);return l===t?a:l}function Cx(r,s){return r!=null&&kp(r,s,X6)}function oh(r,s){return r!=null&&kp(r,s,Z6)}var Ax=jp(function(r,s,a){s!=null&&typeof s.toString!="function"&&(s=Bo.call(s)),r[s]=a},ch(wr)),Tx=jp(function(r,s,a){s!=null&&typeof s.toString!="function"&&(s=Bo.call(s)),it.call(r,s)?r[s].push(a):r[s]=[a]},be),Rx=Ke(Ns);function Wt(r){return br(r)?rp(r):Tu(r)}function mr(r){return br(r)?rp(r,!0):uD(r)}function Nx(r,s){var a={};return s=be(s,3),rn(r,function(l,g,_){_n(a,s(l,g,_),l)}),a}function $x(r,s){var a={};return s=be(s,3),rn(r,function(l,g,_){_n(a,g,s(l,g,_))}),a}var Fx=ji(function(r,s,a){ra(r,s,a)}),Ig=ji(function(r,s,a,l){ra(r,s,a,l)}),Lx=mn(function(r,s){var a={};if(r==null)return a;var l=!1;s=mt(s,function(_){return _=jn(_,r),l||(l=_.length>1),_}),nn(r,Vu(r),a),l&&(a=Lr(a,I|S|C,AD));for(var g=s.length;g--;)Uu(a,s[g]);return a});function Ux(r,s){return Pg(r,ya(be(s)))}var jx=mn(function(r,s){return r==null?{}:lD(r,s)});function Pg(r,s){if(r==null)return{};var a=mt(Vu(r),function(l){return[l]});return s=be(s),bp(r,a,function(l,g){return s(l,g[0])})}function Mx(r,s,a){s=jn(s,r);var l=-1,g=s.length;for(g||(g=1,r=t);++l<g;){var _=r==null?t:r[sn(s[l])];_===t&&(l=g,_=a),r=En(_)?_.call(r):_}return r}function qx(r,s,a){return r==null?r:Fs(r,s,a)}function Hx(r,s,a,l){return l=typeof l=="function"?l:t,r==null?r:Fs(r,s,a,l)}var Cg=Hp(Wt),Ag=Hp(mr);function Bx(r,s,a){var l=Re(r),g=l||qn(r)||Hi(r);if(s=be(s,4),a==null){var _=r&&r.constructor;g?a=l?new _:[]:Et(r)?a=En(_)?Ui(Vo(r)):{}:a={}}return(g?Nr:rn)(r,function(O,N,M){return s(a,O,N,M)}),a}function zx(r,s){return r==null?!0:Uu(r,s)}function Kx(r,s,a){return r==null?r:Sp(r,s,qu(a))}function Vx(r,s,a,l){return l=typeof l=="function"?l:t,r==null?r:Sp(r,s,qu(a),l)}function Bi(r){return r==null?[]:_u(r,Wt(r))}function kx(r){return r==null?[]:_u(r,mr(r))}function Gx(r,s,a){return a===t&&(a=s,s=t),a!==t&&(a=Mr(a),a=a===a?a:0),s!==t&&(s=Mr(s),s=s===s?s:0),oi(Mr(r),s,a)}function Wx(r,s,a){return s=Dn(s),a===t?(a=s,s=0):a=Dn(a),r=Mr(r),eD(r,s,a)}function Yx(r,s,a){if(a&&typeof a!="boolean"&&lr(r,s,a)&&(s=a=t),a===t&&(typeof s=="boolean"?(a=s,s=t):typeof r=="boolean"&&(a=r,r=t)),r===t&&s===t?(r=0,s=1):(r=Dn(r),s===t?(s=r,r=0):s=Dn(s)),r>s){var l=r;r=s,s=l}if(a||r%1||s%1){var g=ep();return tr(r+g*(s-r+ct("1e-"+((g+"").length-1))),s)}return $u(r,s)}var Jx=Mi(function(r,s,a){return s=s.toLowerCase(),r+(a?Tg(s):s)});function Tg(r){return ah(nt(r).toLowerCase())}function Rg(r){return r=nt(r),r&&r.replace(pn,q2).replace(uu,"")}function Qx(r,s,a){r=nt(r),s=Or(s);var l=r.length;a=a===t?l:oi(je(a),0,l);var g=a;return a-=s.length,a>=0&&r.slice(a,g)==s}function Xx(r){return r=nt(r),r&&_t.test(r)?r.replace(Qn,H2):r}function Zx(r){return r=nt(r),r&&jt.test(r)?r.replace(Ot,"\\$&"):r}var eO=Mi(function(r,s,a){return r+(a?"-":"")+s.toLowerCase()}),tO=Mi(function(r,s,a){return r+(a?" ":"")+s.toLowerCase()}),rO=Fp("toLowerCase");function nO(r,s,a){r=nt(r),s=je(s);var l=s?Ri(r):0;if(!s||l>=s)return r;var g=(s-l)/2;return ca(Yo(g),a)+r+ca(Wo(g),a)}function iO(r,s,a){r=nt(r),s=je(s);var l=s?Ri(r):0;return s&&l<s?r+ca(s-l,a):r}function sO(r,s,a){r=nt(r),s=je(s);var l=s?Ri(r):0;return s&&l<s?ca(s-l,a)+r:r}function oO(r,s,a){return a||s==null?s=0:s&&(s=+s),d6(nt(r).replace(It,""),s||0)}function aO(r,s,a){return(a?lr(r,s,a):s===t)?s=1:s=je(s),Fu(nt(r),s)}function cO(){var r=arguments,s=nt(r[0]);return r.length<3?s:s.replace(r[1],r[2])}var uO=Mi(function(r,s,a){return r+(a?"_":"")+s.toLowerCase()});function hO(r,s,a){return a&&typeof a!="number"&&lr(r,s,a)&&(s=a=t),a=a===t?re:a>>>0,a?(r=nt(r),r&&(typeof s=="string"||s!=null&&!ih(s))&&(s=Or(s),!s&&Ti(r))?Mn(kr(r),0,a):r.split(s,a)):[]}var lO=Mi(function(r,s,a){return r+(a?" ":"")+ah(s)});function fO(r,s,a){return r=nt(r),a=a==null?0:oi(je(a),0,r.length),s=Or(s),r.slice(a,a+s.length)==s}function dO(r,s,a){var l=y.templateSettings;a&&lr(r,s,a)&&(s=t),r=nt(r),s=ma({},s,l,Bp);var g=ma({},s.imports,l.imports,Bp),_=Wt(g),O=_u(g,_),N,M,X=0,Z=s.interpolate||Di,ne="__p += '",ue=mu((s.escape||Di).source+"|"+Z.source+"|"+(Z===wt?kc:Di).source+"|"+(s.evaluate||Di).source+"|$","g"),ve="//# sourceURL="+(it.call(s,"sourceURL")?(s.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++hu+"]")+`
82
+ `;r.replace(ue,function(De,Ge,Ze,Pr,fr,Cr){return Ze||(Ze=Pr),ne+=r.slice(X,Cr).replace(Xc,B2),Ge&&(N=!0,ne+=`' +
83
83
  __e(`+Ge+`) +
84
- '`),dr&&(M=!0,ne+=`';
85
- `+dr+`;
84
+ '`),fr&&(M=!0,ne+=`';
85
+ `+fr+`;
86
86
  __p += '`),Ze&&(ne+=`' +
87
87
  ((__t = (`+Ze+`)) == null ? '' : __t) +
88
- '`),X=Ar+De.length,De}),ne+=`';
88
+ '`),X=Cr+De.length,De}),ne+=`';
89
89
  `;var Ee=it.call(s,"variable")&&s.variable;if(!Ee)ne=`with (obj) {
90
90
  `+ne+`
91
91
  }
92
- `;else if(Vc.test(Ee))throw new Ae(f);ne=(M?ne.replace(en,""):ne).replace(ur,"$1").replace(pn,"$1;"),ne="function("+(Ee||"obj")+`) {
92
+ `;else if(Kc.test(Ee))throw new Ae(f);ne=(M?ne.replace(Zr,""):ne).replace(cr,"$1").replace(dn,"$1;"),ne="function("+(Ee||"obj")+`) {
93
93
  `+(Ee?"":`obj || (obj = {});
94
94
  `)+"var __t, __p = ''"+(N?", __e = _.escape":"")+(M?`, __j = Array.prototype.join;
95
95
  function print() { __p += __j.call(arguments, '') }
96
96
  `:`;
97
97
  `)+ne+`return __p
98
- }`;var He=Ug(function(){return rt(_,ve+"return "+ne).apply(t,O)});if(He.source=ne,ih(He))throw He;return He}function mO(n){return nt(n).toLowerCase()}function wO(n){return nt(n).toUpperCase()}function EO(n,s,c){if(n=nt(n),n&&(c||s===t))return kd(n);if(!n||!(s=Ir(s)))return n;var l=Gr(n),g=Gr(s),_=Gd(l,g),O=Wd(l,g)+1;return qn(l,_,O).join("")}function DO(n,s,c){if(n=nt(n),n&&(c||s===t))return n.slice(0,Jd(n)+1);if(!n||!(s=Ir(s)))return n;var l=Gr(n),g=Wd(l,Gr(s))+1;return qn(l,0,g).join("")}function SO(n,s,c){if(n=nt(n),n&&(c||s===t))return n.replace(It,"");if(!n||!(s=Ir(s)))return n;var l=Gr(n),g=Gd(l,Gr(s));return qn(l,g).join("")}function xO(n,s){var c=Y,l=ie;if(Et(s)){var g="separator"in s?s.separator:g;c="length"in s?je(s.length):c,l="omission"in s?Ir(s.omission):l}n=nt(n);var _=n.length;if(Ri(n)){var O=Gr(n);_=O.length}if(c>=_)return n;var N=c-Ni(l);if(N<1)return l;var M=O?qn(O,0,N).join(""):n.slice(0,N);if(g===t)return M+l;if(O&&(N+=M.length-N),sh(g)){if(n.slice(N).search(g)){var X,Z=M;for(g.global||(g=wu(g.source,nt(Rr.exec(g))+"g")),g.lastIndex=0;X=g.exec(Z);)var ne=X.index;M=M.slice(0,ne===t?N:ne)}}else if(n.indexOf(Ir(g),N)!=N){var ue=M.lastIndexOf(g);ue>-1&&(M=M.slice(0,ue))}return M+l}function OO(n){return n=nt(n),n&&Dt.test(n)?n.replace(Tn,t6):n}var IO=qi(function(n,s,c){return n+(c?" ":"")+s.toUpperCase()}),ch=jp("toUpperCase");function Lg(n,s,c){return n=nt(n),s=c?t:s,s===t?J2(n)?i6(n):H2(n):n.match(s)||[]}var Ug=Ke(function(n,s){try{return Gt(n,t,s)}catch(c){return ih(c)?c:new Ae(c)}}),PO=wn(function(n,s){return $r(s,function(c){c=on(c),bn(n,c,rh(n[c],n))}),n});function CO(n){var s=n==null?0:n.length,c=be();return n=s?mt(n,function(l){if(typeof l[1]!="function")throw new Fr(u);return[c(l[0]),l[1]]}):[],Ke(function(l){for(var g=-1;++g<s;){var _=n[g];if(Gt(_[0],this,l))return Gt(_[1],this,l)}})}function AO(n){return tD(Ur(n,I))}function uh(n){return function(){return n}}function TO(n,s){return n==null||n!==n?s:n}var RO=qp(),NO=qp(!0);function Er(n){return n}function hh(n){return vp(typeof n=="function"?n:Ur(n,I))}function $O(n){return _p(Ur(n,I))}function FO(n,s){return bp(n,Ur(s,I))}var LO=Ke(function(n,s){return function(c){return $s(c,n,s)}}),UO=Ke(function(n,s){return function(c){return $s(n,c,s)}});function lh(n,s,c){var l=Wt(s),g=ra(s,l);c==null&&!(Et(s)&&(g.length||!l.length))&&(c=s,s=n,n=this,g=ra(s,Wt(s)));var _=!(Et(c)&&"chain"in c)||!!c.chain,O=Dn(n);return $r(g,function(N){var M=s[N];n[N]=M,O&&(n.prototype[N]=function(){var X=this.__chain__;if(_||X){var Z=n(this.__wrapped__),ne=Z.__actions__=br(this.__actions__);return ne.push({func:M,args:arguments,thisArg:n}),Z.__chain__=X,Z}return M.apply(n,$n([this.value()],arguments))})}),n}function jO(){return Xe._===this&&(Xe._=h6),this}function fh(){}function MO(n){return n=je(n),Ke(function(s){return mp(s,n)})}var qO=zu(mt),HO=zu(Hd),BO=zu(pu);function jg(n){return Ju(n)?gu(on(n)):_D(n)}function zO(n){return function(s){return n==null?t:ci(n,s)}}var KO=Bp(),VO=Bp(!0);function dh(){return[]}function ph(){return!1}function kO(){return{}}function GO(){return""}function WO(){return!0}function YO(n,s){if(n=je(n),n<1||n>V)return[];var c=re,l=tr(n,re);s=be(s),n-=re;for(var g=_u(l,s);++c<n;)s(c);return g}function JO(n){return Re(n)?mt(n,on):Pr(n)?[n]:br(ig(nt(n)))}function QO(n){var s=++c6;return nt(n)+s}var XO=ca(function(n,s){return n+s},0),ZO=Ku("ceil"),eI=ca(function(n,s){return n/s},1),tI=Ku("floor");function rI(n){return n&&n.length?ta(n,Er,Cu):t}function nI(n,s){return n&&n.length?ta(n,be(s,2),Cu):t}function iI(n){return Kd(n,Er)}function sI(n,s){return Kd(n,be(s,2))}function oI(n){return n&&n.length?ta(n,Er,Nu):t}function aI(n,s){return n&&n.length?ta(n,be(s,2),Nu):t}var cI=ca(function(n,s){return n*s},1),uI=Ku("round"),hI=ca(function(n,s){return n-s},0);function lI(n){return n&&n.length?yu(n,Er):0}function fI(n,s){return n&&n.length?yu(n,be(s,2)):0}return y.after=$5,y.ary=gg,y.assign=wx,y.assignIn=Cg,y.assignInWith=wa,y.assignWith=Ex,y.at=Dx,y.before=vg,y.bind=rh,y.bindAll=PO,y.bindKey=yg,y.castArray=k5,y.chain=fg,y.chunk=tS,y.compact=rS,y.concat=nS,y.cond=CO,y.conforms=AO,y.constant=uh,y.countBy=l5,y.create=Sx,y.curry=_g,y.curryRight=bg,y.debounce=mg,y.defaults=xx,y.defaultsDeep=Ox,y.defer=F5,y.delay=L5,y.difference=iS,y.differenceBy=sS,y.differenceWith=oS,y.drop=aS,y.dropRight=cS,y.dropRightWhile=uS,y.dropWhile=hS,y.fill=lS,y.filter=d5,y.flatMap=v5,y.flatMapDeep=y5,y.flatMapDepth=_5,y.flatten=cg,y.flattenDeep=fS,y.flattenDepth=dS,y.flip=U5,y.flow=RO,y.flowRight=NO,y.fromPairs=pS,y.functions=Nx,y.functionsIn=$x,y.groupBy=b5,y.initial=vS,y.intersection=yS,y.intersectionBy=_S,y.intersectionWith=bS,y.invert=Lx,y.invertBy=Ux,y.invokeMap=w5,y.iteratee=hh,y.keyBy=E5,y.keys=Wt,y.keysIn=wr,y.map=ga,y.mapKeys=Mx,y.mapValues=qx,y.matches=$O,y.matchesProperty=FO,y.memoize=ya,y.merge=Hx,y.mergeWith=Ag,y.method=LO,y.methodOf=UO,y.mixin=lh,y.negate=_a,y.nthArg=MO,y.omit=Bx,y.omitBy=zx,y.once=j5,y.orderBy=D5,y.over=qO,y.overArgs=M5,y.overEvery=HO,y.overSome=BO,y.partial=nh,y.partialRight=wg,y.partition=S5,y.pick=Kx,y.pickBy=Tg,y.property=jg,y.propertyOf=zO,y.pull=DS,y.pullAll=hg,y.pullAllBy=SS,y.pullAllWith=xS,y.pullAt=OS,y.range=KO,y.rangeRight=VO,y.rearg=q5,y.reject=I5,y.remove=IS,y.rest=H5,y.reverse=eh,y.sampleSize=C5,y.set=kx,y.setWith=Gx,y.shuffle=A5,y.slice=PS,y.sortBy=N5,y.sortedUniq=FS,y.sortedUniqBy=LS,y.split=vO,y.spread=B5,y.tail=US,y.take=jS,y.takeRight=MS,y.takeRightWhile=qS,y.takeWhile=HS,y.tap=r5,y.throttle=z5,y.thru=pa,y.toArray=Og,y.toPairs=Rg,y.toPairsIn=Ng,y.toPath=JO,y.toPlainObject=Pg,y.transform=Wx,y.unary=K5,y.union=BS,y.unionBy=zS,y.unionWith=KS,y.uniq=VS,y.uniqBy=kS,y.uniqWith=GS,y.unset=Yx,y.unzip=th,y.unzipWith=lg,y.update=Jx,y.updateWith=Qx,y.values=zi,y.valuesIn=Xx,y.without=WS,y.words=Lg,y.wrap=V5,y.xor=YS,y.xorBy=JS,y.xorWith=QS,y.zip=XS,y.zipObject=ZS,y.zipObjectDeep=e5,y.zipWith=t5,y.entries=Rg,y.entriesIn=Ng,y.extend=Cg,y.extendWith=wa,lh(y,y),y.add=XO,y.attempt=Ug,y.camelCase=rO,y.capitalize=$g,y.ceil=ZO,y.clamp=Zx,y.clone=G5,y.cloneDeep=Y5,y.cloneDeepWith=J5,y.cloneWith=W5,y.conformsTo=Q5,y.deburr=Fg,y.defaultTo=TO,y.divide=eI,y.endsWith=nO,y.eq=Yr,y.escape=iO,y.escapeRegExp=sO,y.every=f5,y.find=p5,y.findIndex=og,y.findKey=Ix,y.findLast=g5,y.findLastIndex=ag,y.findLastKey=Px,y.floor=tI,y.forEach=dg,y.forEachRight=pg,y.forIn=Cx,y.forInRight=Ax,y.forOwn=Tx,y.forOwnRight=Rx,y.get=oh,y.gt=X5,y.gte=Z5,y.has=Fx,y.hasIn=ah,y.head=ug,y.identity=Er,y.includes=m5,y.indexOf=gS,y.inRange=eO,y.invoke=jx,y.isArguments=li,y.isArray=Re,y.isArrayBuffer=ex,y.isArrayLike=mr,y.isArrayLikeObject=Nt,y.isBoolean=tx,y.isBuffer=Hn,y.isDate=rx,y.isElement=nx,y.isEmpty=ix,y.isEqual=sx,y.isEqualWith=ox,y.isError=ih,y.isFinite=ax,y.isFunction=Dn,y.isInteger=Eg,y.isLength=ba,y.isMap=Dg,y.isMatch=cx,y.isMatchWith=ux,y.isNaN=hx,y.isNative=lx,y.isNil=dx,y.isNull=fx,y.isNumber=Sg,y.isObject=Et,y.isObjectLike=Ct,y.isPlainObject=qs,y.isRegExp=sh,y.isSafeInteger=px,y.isSet=xg,y.isString=ma,y.isSymbol=Pr,y.isTypedArray=Bi,y.isUndefined=gx,y.isWeakMap=vx,y.isWeakSet=yx,y.join=mS,y.kebabCase=oO,y.last=Mr,y.lastIndexOf=wS,y.lowerCase=aO,y.lowerFirst=cO,y.lt=_x,y.lte=bx,y.max=rI,y.maxBy=nI,y.mean=iI,y.meanBy=sI,y.min=oI,y.minBy=aI,y.stubArray=dh,y.stubFalse=ph,y.stubObject=kO,y.stubString=GO,y.stubTrue=WO,y.multiply=cI,y.nth=ES,y.noConflict=jO,y.noop=fh,y.now=va,y.pad=uO,y.padEnd=hO,y.padStart=lO,y.parseInt=fO,y.random=tO,y.reduce=x5,y.reduceRight=O5,y.repeat=dO,y.replace=pO,y.result=Vx,y.round=uI,y.runInContext=j,y.sample=P5,y.size=T5,y.snakeCase=gO,y.some=R5,y.sortedIndex=CS,y.sortedIndexBy=AS,y.sortedIndexOf=TS,y.sortedLastIndex=RS,y.sortedLastIndexBy=NS,y.sortedLastIndexOf=$S,y.startCase=yO,y.startsWith=_O,y.subtract=hI,y.sum=lI,y.sumBy=fI,y.template=bO,y.times=YO,y.toFinite=Sn,y.toInteger=je,y.toLength=Ig,y.toLower=mO,y.toNumber=qr,y.toSafeInteger=mx,y.toString=nt,y.toUpper=wO,y.trim=EO,y.trimEnd=DO,y.trimStart=SO,y.truncate=xO,y.unescape=OO,y.uniqueId=QO,y.upperCase=IO,y.upperFirst=ch,y.each=dg,y.eachRight=pg,y.first=ug,lh(y,function(){var n={};return nn(y,function(s,c){it.call(y.prototype,c)||(n[c]=s)}),n}(),{chain:!1}),y.VERSION=i,$r(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){y[n].placeholder=y}),$r(["drop","take"],function(n,s){Ye.prototype[n]=function(c){c=c===t?1:Kt(je(c),0);var l=this.__filtered__&&!s?new Ye(this):this.clone();return l.__filtered__?l.__takeCount__=tr(c,l.__takeCount__):l.__views__.push({size:tr(c,re),type:n+(l.__dir__<0?"Right":"")}),l},Ye.prototype[n+"Right"]=function(c){return this.reverse()[n](c).reverse()}}),$r(["filter","map","takeWhile"],function(n,s){var c=s+1,l=c==m||c==ee;Ye.prototype[n]=function(g){var _=this.clone();return _.__iteratees__.push({iteratee:be(g,3),type:c}),_.__filtered__=_.__filtered__||l,_}}),$r(["head","last"],function(n,s){var c="take"+(s?"Right":"");Ye.prototype[n]=function(){return this[c](1).value()[0]}}),$r(["initial","tail"],function(n,s){var c="drop"+(s?"":"Right");Ye.prototype[n]=function(){return this.__filtered__?new Ye(this):this[c](1)}}),Ye.prototype.compact=function(){return this.filter(Er)},Ye.prototype.find=function(n){return this.filter(n).head()},Ye.prototype.findLast=function(n){return this.reverse().find(n)},Ye.prototype.invokeMap=Ke(function(n,s){return typeof n=="function"?new Ye(this):this.map(function(c){return $s(c,n,s)})}),Ye.prototype.reject=function(n){return this.filter(_a(be(n)))},Ye.prototype.slice=function(n,s){n=je(n);var c=this;return c.__filtered__&&(n>0||s<0)?new Ye(c):(n<0?c=c.takeRight(-n):n&&(c=c.drop(n)),s!==t&&(s=je(s),c=s<0?c.dropRight(-s):c.take(s-n)),c)},Ye.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Ye.prototype.toArray=function(){return this.take(re)},nn(Ye.prototype,function(n,s){var c=/^(?:filter|find|map|reject)|While$/.test(s),l=/^(?:head|last)$/.test(s),g=y[l?"take"+(s=="last"?"Right":""):s],_=l||/^find/.test(s);g&&(y.prototype[s]=function(){var O=this.__wrapped__,N=l?[1]:arguments,M=O instanceof Ye,X=N[0],Z=M||Re(O),ne=function(Ge){var Ze=g.apply(y,$n([Ge],N));return l&&ue?Ze[0]:Ze};Z&&c&&typeof X=="function"&&X.length!=1&&(M=Z=!1);var ue=this.__chain__,ve=!!this.__actions__.length,Ee=_&&!ue,He=M&&!ve;if(!_&&Z){O=He?O:new Ye(this);var De=n.apply(O,N);return De.__actions__.push({func:pa,args:[ne],thisArg:t}),new Lr(De,ue)}return Ee&&He?n.apply(this,N):(De=this.thru(ne),Ee?l?De.value()[0]:De.value():De)})}),$r(["pop","push","shift","sort","splice","unshift"],function(n){var s=qo[n],c=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",l=/^(?:pop|shift)$/.test(n);y.prototype[n]=function(){var g=arguments;if(l&&!this.__chain__){var _=this.value();return s.apply(Re(_)?_:[],g)}return this[c](function(O){return s.apply(Re(O)?O:[],g)})}}),nn(Ye.prototype,function(n,s){var c=y[s];if(c){var l=c.name+"";it.call(Ui,l)||(Ui[l]=[]),Ui[l].push({name:s,func:c})}}),Ui[aa(t,se).name]=[{name:"wrapper",func:t}],Ye.prototype.clone=O6,Ye.prototype.reverse=I6,Ye.prototype.value=P6,y.prototype.at=n5,y.prototype.chain=i5,y.prototype.commit=s5,y.prototype.next=o5,y.prototype.plant=c5,y.prototype.reverse=u5,y.prototype.toJSON=y.prototype.valueOf=y.prototype.value=h5,y.prototype.first=y.prototype.head,Is&&(y.prototype[Is]=a5),y},$i=s6();Rt?((Rt.exports=$i)._=$i,ut._=$i):Xe._=$i}).call(ms)})(Mc,Mc.exports);var t2=Object.defineProperty,r2=Object.defineProperties,n2=Object.getOwnPropertyDescriptors,Cd=Object.getOwnPropertySymbols,i2=Object.prototype.hasOwnProperty,s2=Object.prototype.propertyIsEnumerable,Ad=(r,e,t)=>e in r?t2(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,lo=(r,e)=>{for(var t in e||(e={}))i2.call(e,t)&&Ad(r,t,e[t]);if(Cd)for(var t of Cd(e))s2.call(e,t)&&Ad(r,t,e[t]);return r},o2=(r,e)=>r2(r,n2(e));function An(r,e,t){var i;const o=c_(r);return((i=e.rpcMap)==null?void 0:i[o.reference])||`${e2}?chainId=${o.namespace}:${o.reference}&projectId=${t}`}function Qn(r){return r.includes(":")?r.split(":")[1]:r}function Td(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function a2(r,e){const t=Object.keys(e.namespaces).filter(o=>o.includes(r));if(!t.length)return[];const i=[];return t.forEach(o=>{const a=e.namespaces[o].accounts;i.push(...a)}),i}function c2(r={},e={}){const t=Rd(r),i=Rd(e);return Mc.exports.merge(t,i)}function Rd(r){var e,t,i,o;const a={};if(!bi(r))return a;for(const[u,f]of Object.entries(r)){const v=Za(u)?[u]:f.chains,p=f.methods||[],w=f.events||[],I=f.rpcMap||{},S=ts(u);a[S]=o2(lo(lo({},a[S]),f),{chains:Qa(v,(e=a[S])==null?void 0:e.chains),methods:Qa(p,(t=a[S])==null?void 0:t.methods),events:Qa(w,(i=a[S])==null?void 0:i.events),rpcMap:lo(lo({},I),(o=a[S])==null?void 0:o.rpcMap)})}return a}function u2(r){return r.includes(":")?r.split(":")[2]:r}function h2(r){const e={};for(const[t,i]of Object.entries(r)){const o=i.methods||[],a=i.events||[],u=i.accounts||[],f=Za(t)?[t]:i.chains?i.chains:Td(i.accounts);e[t]={chains:f,methods:o,events:a,accounts:u}}return e}function qc(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):r.includes(":")?Number(r.split(":")[1]):Number(r)}const Nd={},gt=r=>Nd[r],Hc=(r,e)=>{Nd[r]=e};class l2{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("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;const e=this.namespace.chains[0];if(!e)throw new 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(dn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const o=Qn(t);e[o]=this.createHttpProvider(o,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||An(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new hn(new Cn(i,gt("disableProviderPing")))}}class f2{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain())}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(dn.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;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||An(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new hn(new Cn(i,gt("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const o=parseInt(Qn(t));e[o]=this.createHttpProvider(o,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,i;let o=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const a=parseInt(o,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:o}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. 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}`)}}class d2{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("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(dn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const o=Qn(t);e[o]=this.createHttpProvider(o,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||An(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new hn(new Cn(i,gt("disableProviderPing")))}}class p2{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("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;const e=this.namespace.chains[0];if(!e)throw new 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(dn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const o=Qn(t);e[o]=this.createHttpProvider(o,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||An(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new hn(new Cn(i,gt("disableProviderPing")))}}class g2{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("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;const e=this.namespace.chains[0];if(!e)throw new 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(dn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const i=this.getCardanoRPCUrl(t),o=Qn(t);e[o]=this.createHttpProvider(o,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new hn(new Cn(i,gt("disableProviderPing")))}}class v2{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("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(dn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const o=Qn(t);e[o]=this.createHttpProvider(o,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||An(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new hn(new Cn(i,gt("disableProviderPing")))}}class y2{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("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(dn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const o=Qn(t);e[o]=this.createHttpProvider(o,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||An(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new hn(new Cn(i,gt("disableProviderPing")))}}class _2{constructor(e){this.name="near",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("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;const e=this.namespace.chains[0];if(!e)throw new 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]){const i=t||An(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(dn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||An(e,this.namespace);return typeof i>"u"?void 0:new hn(new Cn(i,gt("disableProviderPing")))}}var b2=Object.defineProperty,m2=Object.defineProperties,w2=Object.getOwnPropertyDescriptors,$d=Object.getOwnPropertySymbols,E2=Object.prototype.hasOwnProperty,D2=Object.prototype.propertyIsEnumerable,Fd=(r,e,t)=>e in r?b2(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,fo=(r,e)=>{for(var t in e||(e={}))E2.call(e,t)&&Fd(r,t,e[t]);if($d)for(var t of $d(e))D2.call(e,t)&&Fd(r,t,e[t]);return r},Bc=(r,e)=>m2(r,w2(e));class zc{constructor(e){this.events=new Yt.exports,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Je.pino(Je.getDefaultLoggerOptions({level:e?.logger||Id})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const t=new zc(e);return await t.initialize(),t}async request(e,t){const[i,o]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:fo({},e),chainId:`${i}:${o}`,topic:this.session.topic})}sendAsync(e,t,i){this.request(e,i).then(o=>t(null,o)).catch(o=>t(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:At("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:o}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await o().then(a=>{this.session=a,this.namespaces||(this.namespaces=h2(a.namespaces),this.persist("namespaces",this.namespaces))}).catch(a=>{if(a.message!==wd)throw a;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,o]=this.validateChain(e);this.getProvider(i).setDefaultChain(o,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(Xr(t)){for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const 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 Uc.init({logger:this.providerOpts.logger||Id,relayUrl:this.providerOpts.relayUrl||Q3,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>ts(t)))];Hc("client",this.client),Hc("events",this.events),Hc("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=a2(t,this.session),o=Td(i),a=c2(this.namespaces,this.optionalNamespaces),u=Bc(fo({},a[t]),{accounts:i,chains:o});switch(t){case"eip155":this.rpcProviders[t]=new f2({namespace:u});break;case"solana":this.rpcProviders[t]=new d2({namespace:u});break;case"cosmos":this.rpcProviders[t]=new p2({namespace:u});break;case"polkadot":this.rpcProviders[t]=new l2({namespace:u});break;case"cip34":this.rpcProviders[t]=new g2({namespace:u});break;case"elrond":this.rpcProviders[t]=new v2({namespace:u});break;case"multiversx":this.rpcProviders[t]=new y2({namespace:u});break;case"near":this.rpcProviders[t]=new _2({namespace:u});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:i}=t;if(i.name==="accountsChanged"){const o=i.data;o&&Xr(o)&&this.events.emit("accountsChanged",o.map(u2))}else if(i.name==="chainChanged"){const o=t.chainId,a=t.event.data,u=ts(o),f=qc(o)!==qc(a)?`${u}:${qc(a)}`:o;this.onChainChanged(f)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i;const{namespaces:o}=t,a=(i=this.client)==null?void 0:i.session.get(e);this.session=Bc(fo({},a),{namespaces:o}),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",Bc(fo({},At("USER_DISCONNECTED")),{data:e.topic}))}),this.on(dn.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){if(!this.rpcProviders[e])throw new Error(`Provider not found: ${e}`);return this.rpcProviders[e]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:i,sessionProperties:o}=e;t&&Object.keys(t).length&&(this.namespaces=t),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=o,this.persist("namespaces",t),this.persist("optionalNamespaces",i)}validateChain(e){const[t,i]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(u=>ts(u)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const o=ts(Object.keys(this.namespaces)[0]),a=this.rpcProviders[o].getDefaultChain();return[o,a]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){var i;if(!this.namespaces)return;const[o,a]=this.validateChain(e);t||this.getProvider(o).setDefaultChain(a),((i=this.namespaces[o])!=null?i:this.namespaces[`${o}:${a}`]).defaultChain=a,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",a)}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(`${Pd}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${Pd}/${e}`)}}const S2=zc,x2="wc",O2="ethereum_provider",I2=`${x2}@2:${O2}:`,P2="https://rpc.walletconnect.com/v1/",po=["eth_sendTransaction","personal_sign"],Ld=["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"],go=["chainChanged","accountsChanged"],Ud=["chainChanged","accountsChanged","message","disconnect","connect"];var C2=Object.defineProperty,A2=Object.defineProperties,T2=Object.getOwnPropertyDescriptors,jd=Object.getOwnPropertySymbols,R2=Object.prototype.hasOwnProperty,N2=Object.prototype.propertyIsEnumerable,Md=(r,e,t)=>e in r?C2(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ws=(r,e)=>{for(var t in e||(e={}))R2.call(e,t)&&Md(r,t,e[t]);if(jd)for(var t of jd(e))N2.call(e,t)&&Md(r,t,e[t]);return r},qd=(r,e)=>A2(r,T2(e));function vo(r){return Number(r[0].split(":")[1])}function Kc(r){return`0x${r.toString(16)}`}function $2(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:o,events:a,optionalEvents:u,rpcMap:f}=r;if(!Xr(e))throw new Error("Invalid chains");const v={chains:e,methods:i||po,events:a||go,rpcMap:ws({},e.length?{[vo(e)]:f[vo(e)]}:{})},p=a?.filter(C=>!go.includes(C)),w=i?.filter(C=>!po.includes(C));if(!t&&!u&&!o&&!(p!=null&&p.length)&&!(w!=null&&w.length))return{required:e.length?v:void 0};const I=p?.length&&w?.length||!t,S={chains:[...new Set(I?v.chains.concat(t||[]):t)],methods:[...new Set(v.methods.concat(o!=null&&o.length?o:Ld))],events:[...new Set(v.events.concat(u!=null&&u.length?u:Ud))],rpcMap:f};return{required:e.length?v:void 0,optional:t.length?S:void 0}}class yo{constructor(){this.events=new Yt.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=I2,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new yo;return await t.initialize(e),t}async request(e){return await this.signer.request(e,this.formatChainId(this.chainId))}sendAsync(e,t){this.signer.sendAsync(e,t,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:i}=$2(this.rpc);try{const o=await new Promise(async(u,f)=>{var v;this.rpc.showQrModal&&((v=this.modal)==null||v.subscribeModal(p=>{!p.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(qd(ws({namespaces:ws({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e?.pairingTopic})).then(p=>{u(p)}).catch(p=>{f(new Error(p.message))})});if(!o)return;const a=u_(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Kc(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",Kc(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",qd(ws({},At("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,i;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",Kc(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,o]=e.split(":");return{chainId:`${t}:${i}`,address:o}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,i;const o=(t=e?.chains)!=null?t:[],a=(i=e?.optionalChains)!=null?i:[],u=o.concat(a);if(!u.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=o.length?e?.methods||po:[],v=o.length?e?.events||go:[],p=e?.optionalMethods||[],w=e?.optionalEvents||[],I=e?.rpcMap||this.buildRpcMap(u,e.projectId),S=e?.qrModalOptions||void 0;return{chains:o?.map(C=>this.formatChainId(C)),optionalChains:a.map(C=>this.formatChainId(C)),methods:f,events:v,optionalMethods:p,optionalEvents:w,rpcMap:I,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:S,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(o=>{i[o]=this.getRpcUrl(o,t)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?vo(this.rpc.chains):vo(this.rpc.optionalChains),this.signer=await S2.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{t=require("@walletconnect/modal")}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(ws({walletConnectVersion:2,projectId:this.rpc.projectId,standaloneChains:this.rpc.chains},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:o}=e;t&&Xr(t)&&(this.rpc.chains=t.map(a=>this.formatChainId(a)),t.forEach(a=>{this.rpc.rpcMap[a]=o?.[a]||this.getRpcUrl(a)})),i&&Xr(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i?.map(a=>this.formatChainId(a)),i.forEach(a=>{this.rpc.rpcMap[a]=o?.[a]||this.getRpcUrl(a)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${P2}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t?.accounts),this.setAccounts(t?.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const F2=yo;Hr.EthereumProvider=F2,Hr.OPTIONAL_EVENTS=Ud,Hr.OPTIONAL_METHODS=Ld,Hr.REQUIRED_EVENTS=go,Hr.REQUIRED_METHODS=po,Hr.default=yo,Object.defineProperty(Hr,"__esModule",{value:!0})});
98
+ }`;var He=$g(function(){return rt(_,ve+"return "+ne).apply(t,O)});if(He.source=ne,nh(He))throw He;return He}function pO(r){return nt(r).toLowerCase()}function gO(r){return nt(r).toUpperCase()}function vO(r,s,a){if(r=nt(r),r&&(a||s===t))return zd(r);if(!r||!(s=Or(s)))return r;var l=kr(r),g=kr(s),_=Kd(l,g),O=Vd(l,g)+1;return Mn(l,_,O).join("")}function yO(r,s,a){if(r=nt(r),r&&(a||s===t))return r.slice(0,Gd(r)+1);if(!r||!(s=Or(s)))return r;var l=kr(r),g=Vd(l,kr(s))+1;return Mn(l,0,g).join("")}function _O(r,s,a){if(r=nt(r),r&&(a||s===t))return r.replace(It,"");if(!r||!(s=Or(s)))return r;var l=kr(r),g=Kd(l,kr(s));return Mn(l,g).join("")}function bO(r,s){var a=Y,l=ie;if(Et(s)){var g="separator"in s?s.separator:g;a="length"in s?je(s.length):a,l="omission"in s?Or(s.omission):l}r=nt(r);var _=r.length;if(Ti(r)){var O=kr(r);_=O.length}if(a>=_)return r;var N=a-Ri(l);if(N<1)return l;var M=O?Mn(O,0,N).join(""):r.slice(0,N);if(g===t)return M+l;if(O&&(N+=M.length-N),ih(g)){if(r.slice(N).search(g)){var X,Z=M;for(g.global||(g=mu(g.source,nt(Tr.exec(g))+"g")),g.lastIndex=0;X=g.exec(Z);)var ne=X.index;M=M.slice(0,ne===t?N:ne)}}else if(r.indexOf(Or(g),N)!=N){var ue=M.lastIndexOf(g);ue>-1&&(M=M.slice(0,ue))}return M+l}function mO(r){return r=nt(r),r&&Dt.test(r)?r.replace(An,Y2):r}var wO=Mi(function(r,s,a){return r+(a?" ":"")+s.toUpperCase()}),ah=Fp("toUpperCase");function Ng(r,s,a){return r=nt(r),s=a?t:s,s===t?K2(r)?X2(r):F2(r):r.match(s)||[]}var $g=Ke(function(r,s){try{return Gt(r,t,s)}catch(a){return nh(a)?a:new Ae(a)}}),EO=mn(function(r,s){return Nr(s,function(a){a=sn(a),_n(r,a,th(r[a],r))}),r});function DO(r){var s=r==null?0:r.length,a=be();return r=s?mt(r,function(l){if(typeof l[1]!="function")throw new $r(u);return[a(l[0]),l[1]]}):[],Ke(function(l){for(var g=-1;++g<s;){var _=r[g];if(Gt(_[0],this,l))return Gt(_[1],this,l)}})}function SO(r){return Y6(Lr(r,I))}function ch(r){return function(){return r}}function xO(r,s){return r==null||r!==r?s:r}var OO=Up(),IO=Up(!0);function wr(r){return r}function uh(r){return dp(typeof r=="function"?r:Lr(r,I))}function PO(r){return gp(Lr(r,I))}function CO(r,s){return vp(r,Lr(s,I))}var AO=Ke(function(r,s){return function(a){return Ns(a,r,s)}}),TO=Ke(function(r,s){return function(a){return Ns(r,a,s)}});function hh(r,s,a){var l=Wt(s),g=ta(s,l);a==null&&!(Et(s)&&(g.length||!l.length))&&(a=s,s=r,r=this,g=ta(s,Wt(s)));var _=!(Et(a)&&"chain"in a)||!!a.chain,O=En(r);return Nr(g,function(N){var M=s[N];r[N]=M,O&&(r.prototype[N]=function(){var X=this.__chain__;if(_||X){var Z=r(this.__wrapped__),ne=Z.__actions__=_r(this.__actions__);return ne.push({func:M,args:arguments,thisArg:r}),Z.__chain__=X,Z}return M.apply(r,Nn([this.value()],arguments))})}),r}function RO(){return Xe._===this&&(Xe._=i6),this}function lh(){}function NO(r){return r=je(r),Ke(function(s){return yp(s,r)})}var $O=Bu(mt),FO=Bu(jd),LO=Bu(du);function Fg(r){return Yu(r)?pu(sn(r)):fD(r)}function UO(r){return function(s){return r==null?t:ai(r,s)}}var jO=Mp(),MO=Mp(!0);function fh(){return[]}function dh(){return!1}function qO(){return{}}function HO(){return""}function BO(){return!0}function zO(r,s){if(r=je(r),r<1||r>V)return[];var a=re,l=tr(r,re);s=be(s),r-=re;for(var g=yu(l,s);++a<r;)s(a);return g}function KO(r){return Re(r)?mt(r,sn):Ir(r)?[r]:_r(tg(nt(r)))}function VO(r){var s=++r6;return nt(r)+s}var kO=aa(function(r,s){return r+s},0),GO=zu("ceil"),WO=aa(function(r,s){return r/s},1),YO=zu("floor");function JO(r){return r&&r.length?ea(r,wr,Pu):t}function QO(r,s){return r&&r.length?ea(r,be(s,2),Pu):t}function XO(r){return Hd(r,wr)}function ZO(r,s){return Hd(r,be(s,2))}function eI(r){return r&&r.length?ea(r,wr,Ru):t}function tI(r,s){return r&&r.length?ea(r,be(s,2),Ru):t}var rI=aa(function(r,s){return r*s},1),nI=zu("round"),iI=aa(function(r,s){return r-s},0);function sI(r){return r&&r.length?vu(r,wr):0}function oI(r,s){return r&&r.length?vu(r,be(s,2)):0}return y.after=P5,y.ary=fg,y.assign=gx,y.assignIn=Og,y.assignInWith=ma,y.assignWith=vx,y.at=yx,y.before=dg,y.bind=th,y.bindAll=EO,y.bindKey=pg,y.castArray=q5,y.chain=ug,y.chunk=YD,y.compact=JD,y.concat=QD,y.cond=DO,y.conforms=SO,y.constant=ch,y.countBy=s5,y.create=_x,y.curry=gg,y.curryRight=vg,y.debounce=yg,y.defaults=bx,y.defaultsDeep=mx,y.defer=C5,y.delay=A5,y.difference=XD,y.differenceBy=ZD,y.differenceWith=eS,y.drop=tS,y.dropRight=rS,y.dropRightWhile=nS,y.dropWhile=iS,y.fill=sS,y.filter=a5,y.flatMap=h5,y.flatMapDeep=l5,y.flatMapDepth=f5,y.flatten=sg,y.flattenDeep=oS,y.flattenDepth=aS,y.flip=T5,y.flow=OO,y.flowRight=IO,y.fromPairs=cS,y.functions=Ix,y.functionsIn=Px,y.groupBy=d5,y.initial=hS,y.intersection=lS,y.intersectionBy=fS,y.intersectionWith=dS,y.invert=Ax,y.invertBy=Tx,y.invokeMap=g5,y.iteratee=uh,y.keyBy=v5,y.keys=Wt,y.keysIn=mr,y.map=pa,y.mapKeys=Nx,y.mapValues=$x,y.matches=PO,y.matchesProperty=CO,y.memoize=va,y.merge=Fx,y.mergeWith=Ig,y.method=AO,y.methodOf=TO,y.mixin=hh,y.negate=ya,y.nthArg=NO,y.omit=Lx,y.omitBy=Ux,y.once=R5,y.orderBy=y5,y.over=$O,y.overArgs=N5,y.overEvery=FO,y.overSome=LO,y.partial=rh,y.partialRight=_g,y.partition=_5,y.pick=jx,y.pickBy=Pg,y.property=Fg,y.propertyOf=UO,y.pull=yS,y.pullAll=ag,y.pullAllBy=_S,y.pullAllWith=bS,y.pullAt=mS,y.range=jO,y.rangeRight=MO,y.rearg=$5,y.reject=w5,y.remove=wS,y.rest=F5,y.reverse=Zu,y.sampleSize=D5,y.set=qx,y.setWith=Hx,y.shuffle=S5,y.slice=ES,y.sortBy=I5,y.sortedUniq=CS,y.sortedUniqBy=AS,y.split=hO,y.spread=L5,y.tail=TS,y.take=RS,y.takeRight=NS,y.takeRightWhile=$S,y.takeWhile=FS,y.tap=JS,y.throttle=U5,y.thru=da,y.toArray=Dg,y.toPairs=Cg,y.toPairsIn=Ag,y.toPath=KO,y.toPlainObject=xg,y.transform=Bx,y.unary=j5,y.union=LS,y.unionBy=US,y.unionWith=jS,y.uniq=MS,y.uniqBy=qS,y.uniqWith=HS,y.unset=zx,y.unzip=eh,y.unzipWith=cg,y.update=Kx,y.updateWith=Vx,y.values=Bi,y.valuesIn=kx,y.without=BS,y.words=Ng,y.wrap=M5,y.xor=zS,y.xorBy=KS,y.xorWith=VS,y.zip=kS,y.zipObject=GS,y.zipObjectDeep=WS,y.zipWith=YS,y.entries=Cg,y.entriesIn=Ag,y.extend=Og,y.extendWith=ma,hh(y,y),y.add=kO,y.attempt=$g,y.camelCase=Jx,y.capitalize=Tg,y.ceil=GO,y.clamp=Gx,y.clone=H5,y.cloneDeep=z5,y.cloneDeepWith=K5,y.cloneWith=B5,y.conformsTo=V5,y.deburr=Rg,y.defaultTo=xO,y.divide=WO,y.endsWith=Qx,y.eq=Wr,y.escape=Xx,y.escapeRegExp=Zx,y.every=o5,y.find=c5,y.findIndex=ng,y.findKey=wx,y.findLast=u5,y.findLastIndex=ig,y.findLastKey=Ex,y.floor=YO,y.forEach=hg,y.forEachRight=lg,y.forIn=Dx,y.forInRight=Sx,y.forOwn=xx,y.forOwnRight=Ox,y.get=sh,y.gt=k5,y.gte=G5,y.has=Cx,y.hasIn=oh,y.head=og,y.identity=wr,y.includes=p5,y.indexOf=uS,y.inRange=Wx,y.invoke=Rx,y.isArguments=hi,y.isArray=Re,y.isArrayBuffer=W5,y.isArrayLike=br,y.isArrayLikeObject=Nt,y.isBoolean=Y5,y.isBuffer=qn,y.isDate=J5,y.isElement=Q5,y.isEmpty=X5,y.isEqual=Z5,y.isEqualWith=ex,y.isError=nh,y.isFinite=tx,y.isFunction=En,y.isInteger=bg,y.isLength=_a,y.isMap=mg,y.isMatch=rx,y.isMatchWith=nx,y.isNaN=ix,y.isNative=sx,y.isNil=ax,y.isNull=ox,y.isNumber=wg,y.isObject=Et,y.isObjectLike=Ct,y.isPlainObject=Ms,y.isRegExp=ih,y.isSafeInteger=cx,y.isSet=Eg,y.isString=ba,y.isSymbol=Ir,y.isTypedArray=Hi,y.isUndefined=ux,y.isWeakMap=hx,y.isWeakSet=lx,y.join=pS,y.kebabCase=eO,y.last=jr,y.lastIndexOf=gS,y.lowerCase=tO,y.lowerFirst=rO,y.lt=fx,y.lte=dx,y.max=JO,y.maxBy=QO,y.mean=XO,y.meanBy=ZO,y.min=eI,y.minBy=tI,y.stubArray=fh,y.stubFalse=dh,y.stubObject=qO,y.stubString=HO,y.stubTrue=BO,y.multiply=rI,y.nth=vS,y.noConflict=RO,y.noop=lh,y.now=ga,y.pad=nO,y.padEnd=iO,y.padStart=sO,y.parseInt=oO,y.random=Yx,y.reduce=b5,y.reduceRight=m5,y.repeat=aO,y.replace=cO,y.result=Mx,y.round=nI,y.runInContext=j,y.sample=E5,y.size=x5,y.snakeCase=uO,y.some=O5,y.sortedIndex=DS,y.sortedIndexBy=SS,y.sortedIndexOf=xS,y.sortedLastIndex=OS,y.sortedLastIndexBy=IS,y.sortedLastIndexOf=PS,y.startCase=lO,y.startsWith=fO,y.subtract=iI,y.sum=sI,y.sumBy=oI,y.template=dO,y.times=zO,y.toFinite=Dn,y.toInteger=je,y.toLength=Sg,y.toLower=pO,y.toNumber=Mr,y.toSafeInteger=px,y.toString=nt,y.toUpper=gO,y.trim=vO,y.trimEnd=yO,y.trimStart=_O,y.truncate=bO,y.unescape=mO,y.uniqueId=VO,y.upperCase=wO,y.upperFirst=ah,y.each=hg,y.eachRight=lg,y.first=og,hh(y,function(){var r={};return rn(y,function(s,a){it.call(y.prototype,a)||(r[a]=s)}),r}(),{chain:!1}),y.VERSION=i,Nr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(r){y[r].placeholder=y}),Nr(["drop","take"],function(r,s){Ye.prototype[r]=function(a){a=a===t?1:Kt(je(a),0);var l=this.__filtered__&&!s?new Ye(this):this.clone();return l.__filtered__?l.__takeCount__=tr(a,l.__takeCount__):l.__views__.push({size:tr(a,re),type:r+(l.__dir__<0?"Right":"")}),l},Ye.prototype[r+"Right"]=function(a){return this.reverse()[r](a).reverse()}}),Nr(["filter","map","takeWhile"],function(r,s){var a=s+1,l=a==m||a==ee;Ye.prototype[r]=function(g){var _=this.clone();return _.__iteratees__.push({iteratee:be(g,3),type:a}),_.__filtered__=_.__filtered__||l,_}}),Nr(["head","last"],function(r,s){var a="take"+(s?"Right":"");Ye.prototype[r]=function(){return this[a](1).value()[0]}}),Nr(["initial","tail"],function(r,s){var a="drop"+(s?"":"Right");Ye.prototype[r]=function(){return this.__filtered__?new Ye(this):this[a](1)}}),Ye.prototype.compact=function(){return this.filter(wr)},Ye.prototype.find=function(r){return this.filter(r).head()},Ye.prototype.findLast=function(r){return this.reverse().find(r)},Ye.prototype.invokeMap=Ke(function(r,s){return typeof r=="function"?new Ye(this):this.map(function(a){return Ns(a,r,s)})}),Ye.prototype.reject=function(r){return this.filter(ya(be(r)))},Ye.prototype.slice=function(r,s){r=je(r);var a=this;return a.__filtered__&&(r>0||s<0)?new Ye(a):(r<0?a=a.takeRight(-r):r&&(a=a.drop(r)),s!==t&&(s=je(s),a=s<0?a.dropRight(-s):a.take(s-r)),a)},Ye.prototype.takeRightWhile=function(r){return this.reverse().takeWhile(r).reverse()},Ye.prototype.toArray=function(){return this.take(re)},rn(Ye.prototype,function(r,s){var a=/^(?:filter|find|map|reject)|While$/.test(s),l=/^(?:head|last)$/.test(s),g=y[l?"take"+(s=="last"?"Right":""):s],_=l||/^find/.test(s);g&&(y.prototype[s]=function(){var O=this.__wrapped__,N=l?[1]:arguments,M=O instanceof Ye,X=N[0],Z=M||Re(O),ne=function(Ge){var Ze=g.apply(y,Nn([Ge],N));return l&&ue?Ze[0]:Ze};Z&&a&&typeof X=="function"&&X.length!=1&&(M=Z=!1);var ue=this.__chain__,ve=!!this.__actions__.length,Ee=_&&!ue,He=M&&!ve;if(!_&&Z){O=He?O:new Ye(this);var De=r.apply(O,N);return De.__actions__.push({func:da,args:[ne],thisArg:t}),new Fr(De,ue)}return Ee&&He?r.apply(this,N):(De=this.thru(ne),Ee?l?De.value()[0]:De.value():De)})}),Nr(["pop","push","shift","sort","splice","unshift"],function(r){var s=Mo[r],a=/^(?:push|sort|unshift)$/.test(r)?"tap":"thru",l=/^(?:pop|shift)$/.test(r);y.prototype[r]=function(){var g=arguments;if(l&&!this.__chain__){var _=this.value();return s.apply(Re(_)?_:[],g)}return this[a](function(O){return s.apply(Re(O)?O:[],g)})}}),rn(Ye.prototype,function(r,s){var a=y[s];if(a){var l=a.name+"";it.call(Li,l)||(Li[l]=[]),Li[l].push({name:s,func:a})}}),Li[oa(t,se).name]=[{name:"wrapper",func:t}],Ye.prototype.clone=m6,Ye.prototype.reverse=w6,Ye.prototype.value=E6,y.prototype.at=QS,y.prototype.chain=XS,y.prototype.commit=ZS,y.prototype.next=e5,y.prototype.plant=r5,y.prototype.reverse=n5,y.prototype.toJSON=y.prototype.valueOf=y.prototype.value=i5,y.prototype.first=y.prototype.head,Os&&(y.prototype[Os]=t5),y},Ni=Z2();Rt?((Rt.exports=Ni)._=Ni,ut._=Ni):Xe._=Ni}).call(bs)})(jc,jc.exports);var Y3=Object.defineProperty,J3=Object.defineProperties,Q3=Object.getOwnPropertyDescriptors,Od=Object.getOwnPropertySymbols,X3=Object.prototype.hasOwnProperty,Z3=Object.prototype.propertyIsEnumerable,Id=(n,e,t)=>e in n?Y3(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ho=(n,e)=>{for(var t in e||(e={}))X3.call(e,t)&&Id(n,t,e[t]);if(Od)for(var t of Od(e))Z3.call(e,t)&&Id(n,t,e[t]);return n},e2=(n,e)=>J3(n,Q3(e));function Cn(n,e,t){var i;const o=s_(n);return((i=e.rpcMap)==null?void 0:i[o.reference])||`${W3}?chainId=${o.namespace}:${o.reference}&projectId=${t}`}function Jn(n){return n.includes(":")?n.split(":")[1]:n}function Pd(n){return n.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function t2(n,e){const t=Object.keys(e.namespaces).filter(o=>o.includes(n));if(!t.length)return[];const i=[];return t.forEach(o=>{const c=e.namespaces[o].accounts;i.push(...c)}),i}function r2(n={},e={}){const t=Cd(n),i=Cd(e);return jc.exports.merge(t,i)}function Cd(n){var e,t,i,o;const c={};if(!_i(n))return c;for(const[u,f]of Object.entries(n)){const v=Xa(u)?[u]:f.chains,p=f.methods||[],w=f.events||[],I=f.rpcMap||{},S=es(u);c[S]=e2(ho(ho({},c[S]),f),{chains:Ja(v,(e=c[S])==null?void 0:e.chains),methods:Ja(p,(t=c[S])==null?void 0:t.methods),events:Ja(w,(i=c[S])==null?void 0:i.events),rpcMap:ho(ho({},I),(o=c[S])==null?void 0:o.rpcMap)})}return c}function n2(n){return n.includes(":")?n.split(":")[2]:n}function i2(n){const e={};for(const[t,i]of Object.entries(n)){const o=i.methods||[],c=i.events||[],u=i.accounts||[],f=Xa(t)?[t]:i.chains?i.chains:Pd(i.accounts);e[t]={chains:f,methods:o,events:c,accounts:u}}return e}function Mc(n){return typeof n=="number"?n:n.includes("0x")?parseInt(n,16):n.includes(":")?Number(n.split(":")[1]):Number(n)}const Ad={},gt=n=>Ad[n],qc=(n,e)=>{Ad[n]=e};class s2{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("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;const e=this.namespace.chains[0];if(!e)throw new 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(fn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const o=Jn(t);e[o]=this.createHttpProvider(o,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Cn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new un(new Pn(i,gt("disableProviderPing")))}}class o2{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain())}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(fn.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;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||Cn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new un(new Pn(i,gt("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const o=parseInt(Jn(t));e[o]=this.createHttpProvider(o,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,i;let o=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";o=o.startsWith("0x")?o:`0x${o}`;const c=parseInt(o,16);if(this.isChainApproved(c))this.setDefaultChain(`${c}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:o}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${c}`);else throw new Error(`Failed to switch to chain 'eip155:${c}'. 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}`)}}class a2{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("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(fn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const o=Jn(t);e[o]=this.createHttpProvider(o,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Cn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new un(new Pn(i,gt("disableProviderPing")))}}class c2{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("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;const e=this.namespace.chains[0];if(!e)throw new 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(fn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const o=Jn(t);e[o]=this.createHttpProvider(o,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Cn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new un(new Pn(i,gt("disableProviderPing")))}}class u2{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("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;const e=this.namespace.chains[0];if(!e)throw new 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(fn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const i=this.getCardanoRPCUrl(t),o=Jn(t);e[o]=this.createHttpProvider(o,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new un(new Pn(i,gt("disableProviderPing")))}}class h2{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("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(fn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const o=Jn(t);e[o]=this.createHttpProvider(o,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Cn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new un(new Pn(i,gt("disableProviderPing")))}}class l2{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("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(fn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const o=Jn(t);e[o]=this.createHttpProvider(o,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Cn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new un(new Pn(i,gt("disableProviderPing")))}}class f2{constructor(e){this.name="near",this.namespace=e.namespace,this.events=gt("events"),this.client=gt("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;const e=this.namespace.chains[0];if(!e)throw new 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]){const i=t||Cn(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(fn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||Cn(e,this.namespace);return typeof i>"u"?void 0:new un(new Pn(i,gt("disableProviderPing")))}}var d2=Object.defineProperty,p2=Object.defineProperties,g2=Object.getOwnPropertyDescriptors,Td=Object.getOwnPropertySymbols,v2=Object.prototype.hasOwnProperty,y2=Object.prototype.propertyIsEnumerable,Rd=(n,e,t)=>e in n?d2(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,lo=(n,e)=>{for(var t in e||(e={}))v2.call(e,t)&&Rd(n,t,e[t]);if(Td)for(var t of Td(e))y2.call(e,t)&&Rd(n,t,e[t]);return n},Hc=(n,e)=>p2(n,g2(e));class Bc{constructor(e){this.events=new Yt.exports,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Je.pino(Je.getDefaultLoggerOptions({level:e?.logger||Sd})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const t=new Bc(e);return await t.initialize(),t}async request(e,t){const[i,o]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:lo({},e),chainId:`${i}:${o}`,topic:this.session.topic})}sendAsync(e,t,i){this.request(e,i).then(o=>t(null,o)).catch(o=>t(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:At("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:o}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await o().then(c=>{this.session=c,this.namespaces||(this.namespaces=i2(c.namespaces),this.persist("namespaces",this.namespaces))}).catch(c=>{if(c.message!==_d)throw c;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,o]=this.validateChain(e);this.getProvider(i).setDefaultChain(o,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(Qr(t)){for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const 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 Lc.init({logger:this.providerOpts.logger||Sd,relayUrl:this.providerOpts.relayUrl||V3,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>es(t)))];qc("client",this.client),qc("events",this.events),qc("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=t2(t,this.session),o=Pd(i),c=r2(this.namespaces,this.optionalNamespaces),u=Hc(lo({},c[t]),{accounts:i,chains:o});switch(t){case"eip155":this.rpcProviders[t]=new o2({namespace:u});break;case"solana":this.rpcProviders[t]=new a2({namespace:u});break;case"cosmos":this.rpcProviders[t]=new c2({namespace:u});break;case"polkadot":this.rpcProviders[t]=new s2({namespace:u});break;case"cip34":this.rpcProviders[t]=new u2({namespace:u});break;case"elrond":this.rpcProviders[t]=new h2({namespace:u});break;case"multiversx":this.rpcProviders[t]=new l2({namespace:u});break;case"near":this.rpcProviders[t]=new f2({namespace:u});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:i}=t;if(i.name==="accountsChanged"){const o=i.data;o&&Qr(o)&&this.events.emit("accountsChanged",o.map(n2))}else if(i.name==="chainChanged"){const o=t.chainId,c=t.event.data,u=es(o),f=Mc(o)!==Mc(c)?`${u}:${Mc(c)}`:o;this.onChainChanged(f)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i;const{namespaces:o}=t,c=(i=this.client)==null?void 0:i.session.get(e);this.session=Hc(lo({},c),{namespaces:o}),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",Hc(lo({},At("USER_DISCONNECTED")),{data:e.topic}))}),this.on(fn.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){if(!this.rpcProviders[e])throw new Error(`Provider not found: ${e}`);return this.rpcProviders[e]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:i,sessionProperties:o}=e;t&&Object.keys(t).length&&(this.namespaces=t),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=o,this.persist("namespaces",t),this.persist("optionalNamespaces",i)}validateChain(e){const[t,i]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(u=>es(u)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const o=es(Object.keys(this.namespaces)[0]),c=this.rpcProviders[o].getDefaultChain();return[o,c]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){var i;if(!this.namespaces)return;const[o,c]=this.validateChain(e);t||this.getProvider(o).setDefaultChain(c),((i=this.namespaces[o])!=null?i:this.namespaces[`${o}:${c}`]).defaultChain=c,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",c)}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(`${xd}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${xd}/${e}`)}}const _2=Bc,b2="wc",m2="ethereum_provider",w2=`${b2}@2:${m2}:`,E2="https://rpc.walletconnect.com/v1/",fo=["eth_sendTransaction","personal_sign"],Nd=["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"],po=["chainChanged","accountsChanged"],$d=["chainChanged","accountsChanged","message","disconnect","connect"];var D2=Object.defineProperty,S2=Object.defineProperties,x2=Object.getOwnPropertyDescriptors,Fd=Object.getOwnPropertySymbols,O2=Object.prototype.hasOwnProperty,I2=Object.prototype.propertyIsEnumerable,Ld=(n,e,t)=>e in n?D2(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ms=(n,e)=>{for(var t in e||(e={}))O2.call(e,t)&&Ld(n,t,e[t]);if(Fd)for(var t of Fd(e))I2.call(e,t)&&Ld(n,t,e[t]);return n},Ud=(n,e)=>S2(n,x2(e));function go(n){return Number(n[0].split(":")[1])}function zc(n){return`0x${n.toString(16)}`}function P2(n){const{chains:e,optionalChains:t,methods:i,optionalMethods:o,events:c,optionalEvents:u,rpcMap:f}=n;if(!Qr(e))throw new Error("Invalid chains");const v={chains:e,methods:i||fo,events:c||po,rpcMap:ms({},e.length?{[go(e)]:f[go(e)]}:{})},p=c?.filter(C=>!po.includes(C)),w=i?.filter(C=>!fo.includes(C));if(!t&&!u&&!o&&!(p!=null&&p.length)&&!(w!=null&&w.length))return{required:e.length?v:void 0};const I=p?.length&&w?.length||!t,S={chains:[...new Set(I?v.chains.concat(t||[]):t)],methods:[...new Set(v.methods.concat(o!=null&&o.length?o:Nd))],events:[...new Set(v.events.concat(u!=null&&u.length?u:$d))],rpcMap:f};return{required:e.length?v:void 0,optional:t.length?S:void 0}}class vo{constructor(){this.events=new Yt.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=w2,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new vo;return await t.initialize(e),t}async request(e){return await this.signer.request(e,this.formatChainId(this.chainId))}sendAsync(e,t){this.signer.sendAsync(e,t,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:i}=P2(this.rpc);try{const o=await new Promise(async(u,f)=>{var v;this.rpc.showQrModal&&((v=this.modal)==null||v.subscribeModal(p=>{!p.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Ud(ms({namespaces:ms({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e?.pairingTopic})).then(p=>{u(p)}).catch(p=>{f(new Error(p.message))})});if(!o)return;const c=o_(o.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:c),this.setAccounts(c),this.events.emit("connect",{chainId:zc(this.chainId)})}catch(o){throw this.signer.logger.error(o),o}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",zc(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",Ud(ms({},At("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,i;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",zc(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,o]=e.split(":");return{chainId:`${t}:${i}`,address:o}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,i;const o=(t=e?.chains)!=null?t:[],c=(i=e?.optionalChains)!=null?i:[],u=o.concat(c);if(!u.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=o.length?e?.methods||fo:[],v=o.length?e?.events||po:[],p=e?.optionalMethods||[],w=e?.optionalEvents||[],I=e?.rpcMap||this.buildRpcMap(u,e.projectId),S=e?.qrModalOptions||void 0;return{chains:o?.map(C=>this.formatChainId(C)),optionalChains:c.map(C=>this.formatChainId(C)),methods:f,events:v,optionalMethods:p,optionalEvents:w,rpcMap:I,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:S,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(o=>{i[o]=this.getRpcUrl(o,t)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?go(this.rpc.chains):go(this.rpc.optionalChains),this.signer=await _2.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{t=require("@walletconnect/modal").WalletConnectModal}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(ms({walletConnectVersion:2,projectId:this.rpc.projectId,standaloneChains:this.rpc.chains},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:o}=e;t&&Qr(t)&&(this.rpc.chains=t.map(c=>this.formatChainId(c)),t.forEach(c=>{this.rpc.rpcMap[c]=o?.[c]||this.getRpcUrl(c)})),i&&Qr(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i?.map(c=>this.formatChainId(c)),i.forEach(c=>{this.rpc.rpcMap[c]=o?.[c]||this.getRpcUrl(c)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${E2}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t?.accounts),this.setAccounts(t?.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const C2=vo;qr.EthereumProvider=C2,qr.OPTIONAL_EVENTS=$d,qr.OPTIONAL_METHODS=Nd,qr.REQUIRED_EVENTS=po,qr.REQUIRED_METHODS=fo,qr.default=vo,Object.defineProperty(qr,"__esModule",{value:!0})});
99
99
  //# sourceMappingURL=index.umd.js.map