@walletconnect/ethereum-provider 2.11.3 → 2.12.0

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(dn,vr){typeof exports=="object"&&typeof module<"u"?vr(exports):typeof define=="function"&&define.amd?define(["exports"],vr):(dn=typeof globalThis<"u"?globalThis:dn||self,vr(dn["@walletconnect/ethereum-provider"]={}))})(this,function(dn){"use strict";var vr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Cy(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Pi(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(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var lr={exports:{}},vs=typeof Reflect=="object"?Reflect:null,Nd=vs&&typeof vs.apply=="function"?vs.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},Sa;vs&&typeof vs.ownKeys=="function"?Sa=vs.ownKeys:Object.getOwnPropertySymbols?Sa=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Sa=function(e){return Object.getOwnPropertyNames(e)};function $y(r){console&&console.warn&&console.warn(r)}var Ld=Number.isNaN||function(e){return e!==e};function pt(){pt.init.call(this)}lr.exports=pt,lr.exports.once=Ry,pt.EventEmitter=pt,pt.prototype._events=void 0,pt.prototype._eventsCount=0,pt.prototype._maxListeners=void 0;var Md=10;function Oa(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(pt,"defaultMaxListeners",{enumerable:!0,get:function(){return Md},set:function(r){if(typeof r!="number"||r<0||Ld(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");Md=r}}),pt.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},pt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ld(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 Ud(r){return r._maxListeners===void 0?pt.defaultMaxListeners:r._maxListeners}pt.prototype.getMaxListeners=function(){return Ud(this)},pt.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e==="error",a=this._events;if(a!==void 0)i=i&&a.error===void 0;else if(!i)return!1;if(i){var c;if(t.length>0&&(c=t[0]),c instanceof Error)throw c;var u=new Error("Unhandled error."+(c?" ("+c.message+")":""));throw u.context=c,u}var f=a[e];if(f===void 0)return!1;if(typeof f=="function")Nd(f,this,t);else for(var h=f.length,m=qd(f,h),n=0;n<h;++n)Nd(m[n],this,t);return!0};function jd(r,e,t,n){var i,a,c;if(Oa(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),c=a[e]),c===void 0)c=a[e]=t,++r._eventsCount;else if(typeof c=="function"?c=a[e]=n?[t,c]:[c,t]:n?c.unshift(t):c.push(t),i=Ud(r),i>0&&c.length>i&&!c.warned){c.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=r,u.type=e,u.count=c.length,$y(u)}return r}pt.prototype.addListener=function(e,t){return jd(this,e,t,!1)},pt.prototype.on=pt.prototype.addListener,pt.prototype.prependListener=function(e,t){return jd(this,e,t,!0)};function Ay(){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 Fd(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},i=Ay.bind(n);return i.listener=t,n.wrapFn=i,i}pt.prototype.once=function(e,t){return Oa(t),this.on(e,Fd(this,e,t)),this},pt.prototype.prependOnceListener=function(e,t){return Oa(t),this.prependListener(e,Fd(this,e,t)),this},pt.prototype.removeListener=function(e,t){var n,i,a,c,u;if(Oa(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!="function"){for(a=-1,c=n.length-1;c>=0;c--)if(n[c]===t||n[c].listener===t){u=n[c].listener,a=c;break}if(a<0)return this;a===0?n.shift():Py(n,a),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||t)}return this},pt.prototype.off=pt.prototype.removeListener,pt.prototype.removeAllListeners=function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var a=Object.keys(n),c;for(i=0;i<a.length;++i)c=a[i],c!=="removeListener"&&this.removeAllListeners(c);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this};function Bd(r,e,t){var n=r._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?t?[i.listener||i]:[i]:t?Ty(i):qd(i,i.length)}pt.prototype.listeners=function(e){return Bd(this,e,!0)},pt.prototype.rawListeners=function(e){return Bd(this,e,!1)},pt.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):kd.call(r,e)},pt.prototype.listenerCount=kd;function kd(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}pt.prototype.eventNames=function(){return this._eventsCount>0?Sa(this._events):[]};function qd(r,e){for(var t=new Array(e),n=0;n<e;++n)t[n]=r[n];return t}function Py(r,e){for(;e+1<r.length;e++)r[e]=r[e+1];r.pop()}function Ty(r){for(var e=new Array(r.length),t=0;t<e.length;++t)e[t]=r[t].listener||r[t];return e}function Ry(r,e){return new Promise(function(t,n){function i(c){r.removeListener(e,a),n(c)}function a(){typeof r.removeListener=="function"&&r.removeListener("error",i),t([].slice.call(arguments))}zd(r,e,a,{once:!0}),e!=="error"&&Ny(r,i,{once:!0})})}function Ny(r,e,t){typeof r.on=="function"&&zd(r,"error",e,t)}function zd(r,e,t,n){if(typeof r.on=="function")n.once?r.once(e,t):r.on(e,t);else if(typeof r.addEventListener=="function")r.addEventListener(e,function i(a){n.once&&r.removeEventListener(e,i),t(a)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof r)}var Nl={},Ca={},Me={},Hd={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function e(u,f){var h=u>>>16&65535,m=u&65535,w=f>>>16&65535,y=f&65535;return m*y+(h*y+m*w<<16>>>0)|0}r.mul=Math.imul||e;function t(u,f){return u+f|0}r.add=t;function n(u,f){return u-f|0}r.sub=n;function i(u,f){return u<<f|u>>>32-f}r.rotl=i;function a(u,f){return u<<32-f|u>>>f}r.rotr=a;function c(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u}r.isInteger=Number.isInteger||c,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(u){return r.isInteger(u)&&u>=-r.MAX_SAFE_INTEGER&&u<=r.MAX_SAFE_INTEGER}})(Hd),Object.defineProperty(Me,"__esModule",{value:!0});var Wd=Hd;function Ly(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}Me.readInt16BE=Ly;function My(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}Me.readUint16BE=My;function Uy(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}Me.readInt16LE=Uy;function jy(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}Me.readUint16LE=jy;function Kd(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}Me.writeUint16BE=Kd,Me.writeInt16BE=Kd;function Vd(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}Me.writeUint16LE=Vd,Me.writeInt16LE=Vd;function Ll(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}Me.readInt32BE=Ll;function Ml(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}Me.readUint32BE=Ml;function Ul(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}Me.readInt32LE=Ul;function jl(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}Me.readUint32LE=jl;function $a(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}Me.writeUint32BE=$a,Me.writeInt32BE=$a;function Aa(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}Me.writeUint32LE=Aa,Me.writeInt32LE=Aa;function Fy(r,e){e===void 0&&(e=0);var t=Ll(r,e),n=Ll(r,e+4);return t*4294967296+n-(n>>31)*4294967296}Me.readInt64BE=Fy;function By(r,e){e===void 0&&(e=0);var t=Ml(r,e),n=Ml(r,e+4);return t*4294967296+n}Me.readUint64BE=By;function ky(r,e){e===void 0&&(e=0);var t=Ul(r,e),n=Ul(r,e+4);return n*4294967296+t-(t>>31)*4294967296}Me.readInt64LE=ky;function qy(r,e){e===void 0&&(e=0);var t=jl(r,e),n=jl(r,e+4);return n*4294967296+t}Me.readUint64LE=qy;function Gd(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),$a(r/4294967296>>>0,e,t),$a(r>>>0,e,t+4),e}Me.writeUint64BE=Gd,Me.writeInt64BE=Gd;function Yd(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Aa(r>>>0,e,t),Aa(r/4294967296>>>0,e,t+4),e}Me.writeUint64LE=Yd,Me.writeInt64LE=Yd;function zy(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 n=0,i=1,a=r/8+t-1;a>=t;a--)n+=e[a]*i,i*=256;return n}Me.readUintBE=zy;function Hy(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 n=0,i=1,a=t;a<t+r/8;a++)n+=e[a]*i,i*=256;return n}Me.readUintLE=Hy;function Wy(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Wd.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var i=1,a=r/8+n-1;a>=n;a--)t[a]=e/i&255,i*=256;return t}Me.writeUintBE=Wy;function Ky(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Wd.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,a=n;a<n+r/8;a++)t[a]=e/i&255,i*=256;return t}Me.writeUintLE=Ky;function Vy(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e)}Me.readFloat32BE=Vy;function Gy(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e,!0)}Me.readFloat32LE=Gy;function Yy(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e)}Me.readFloat64BE=Yy;function Zy(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e,!0)}Me.readFloat64LE=Zy;function Jy(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r),e}Me.writeFloat32BE=Jy;function Qy(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r,!0),e}Me.writeFloat32LE=Qy;function Xy(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r),e}Me.writeFloat64BE=Xy;function ew(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r,!0),e}Me.writeFloat64LE=ew;var qr={};Object.defineProperty(qr,"__esModule",{value:!0});function tw(r){for(var e=0;e<r.length;e++)r[e]=0;return r}qr.wipe=tw,Object.defineProperty(Ca,"__esModule",{value:!0});var dr=Me,Fl=qr,rw=20;function nw(r,e,t){for(var n=1634760805,i=857760878,a=2036477234,c=1797285236,u=t[3]<<24|t[2]<<16|t[1]<<8|t[0],f=t[7]<<24|t[6]<<16|t[5]<<8|t[4],h=t[11]<<24|t[10]<<16|t[9]<<8|t[8],m=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=t[19]<<24|t[18]<<16|t[17]<<8|t[16],y=t[23]<<24|t[22]<<16|t[21]<<8|t[20],_=t[27]<<24|t[26]<<16|t[25]<<8|t[24],S=t[31]<<24|t[30]<<16|t[29]<<8|t[28],P=e[3]<<24|e[2]<<16|e[1]<<8|e[0],j=e[7]<<24|e[6]<<16|e[5]<<8|e[4],U=e[11]<<24|e[10]<<16|e[9]<<8|e[8],A=e[15]<<24|e[14]<<16|e[13]<<8|e[12],T=n,O=i,$=a,x=c,d=u,b=f,H=h,F=m,V=w,se=y,ce=_,I=S,N=P,X=j,ee=U,Y=A,Z=0;Z<rw;Z+=2)T=T+d|0,N^=T,N=N>>>32-16|N<<16,V=V+N|0,d^=V,d=d>>>32-12|d<<12,O=O+b|0,X^=O,X=X>>>32-16|X<<16,se=se+X|0,b^=se,b=b>>>32-12|b<<12,$=$+H|0,ee^=$,ee=ee>>>32-16|ee<<16,ce=ce+ee|0,H^=ce,H=H>>>32-12|H<<12,x=x+F|0,Y^=x,Y=Y>>>32-16|Y<<16,I=I+Y|0,F^=I,F=F>>>32-12|F<<12,$=$+H|0,ee^=$,ee=ee>>>32-8|ee<<8,ce=ce+ee|0,H^=ce,H=H>>>32-7|H<<7,x=x+F|0,Y^=x,Y=Y>>>32-8|Y<<8,I=I+Y|0,F^=I,F=F>>>32-7|F<<7,O=O+b|0,X^=O,X=X>>>32-8|X<<8,se=se+X|0,b^=se,b=b>>>32-7|b<<7,T=T+d|0,N^=T,N=N>>>32-8|N<<8,V=V+N|0,d^=V,d=d>>>32-7|d<<7,T=T+b|0,Y^=T,Y=Y>>>32-16|Y<<16,ce=ce+Y|0,b^=ce,b=b>>>32-12|b<<12,O=O+H|0,N^=O,N=N>>>32-16|N<<16,I=I+N|0,H^=I,H=H>>>32-12|H<<12,$=$+F|0,X^=$,X=X>>>32-16|X<<16,V=V+X|0,F^=V,F=F>>>32-12|F<<12,x=x+d|0,ee^=x,ee=ee>>>32-16|ee<<16,se=se+ee|0,d^=se,d=d>>>32-12|d<<12,$=$+F|0,X^=$,X=X>>>32-8|X<<8,V=V+X|0,F^=V,F=F>>>32-7|F<<7,x=x+d|0,ee^=x,ee=ee>>>32-8|ee<<8,se=se+ee|0,d^=se,d=d>>>32-7|d<<7,O=O+H|0,N^=O,N=N>>>32-8|N<<8,I=I+N|0,H^=I,H=H>>>32-7|H<<7,T=T+b|0,Y^=T,Y=Y>>>32-8|Y<<8,ce=ce+Y|0,b^=ce,b=b>>>32-7|b<<7;dr.writeUint32LE(T+n|0,r,0),dr.writeUint32LE(O+i|0,r,4),dr.writeUint32LE($+a|0,r,8),dr.writeUint32LE(x+c|0,r,12),dr.writeUint32LE(d+u|0,r,16),dr.writeUint32LE(b+f|0,r,20),dr.writeUint32LE(H+h|0,r,24),dr.writeUint32LE(F+m|0,r,28),dr.writeUint32LE(V+w|0,r,32),dr.writeUint32LE(se+y|0,r,36),dr.writeUint32LE(ce+_|0,r,40),dr.writeUint32LE(I+S|0,r,44),dr.writeUint32LE(N+P|0,r,48),dr.writeUint32LE(X+j|0,r,52),dr.writeUint32LE(ee+U|0,r,56),dr.writeUint32LE(Y+A|0,r,60)}function Zd(r,e,t,n,i){if(i===void 0&&(i=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<t.length)throw new Error("ChaCha: destination is shorter than source");var a,c;if(i===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");a=new Uint8Array(16),c=a.length-e.length,a.set(e,c)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");a=e,c=i}for(var u=new Uint8Array(64),f=0;f<t.length;f+=64){nw(u,a,r);for(var h=f;h<f+64&&h<t.length;h++)n[h]=t[h]^u[h-f];sw(a,0,c)}return Fl.wipe(u),i===0&&Fl.wipe(a),n}Ca.streamXOR=Zd;function iw(r,e,t,n){return n===void 0&&(n=0),Fl.wipe(t),Zd(r,e,t,t,n)}Ca.stream=iw;function sw(r,e,t){for(var n=1;t--;)n=n+(r[e]&255)|0,r[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var Jd={},ni={};Object.defineProperty(ni,"__esModule",{value:!0});function ow(r,e,t){return~(r-1)&e|r-1&t}ni.select=ow;function aw(r,e){return(r|0)-(e|0)-1>>>31&1}ni.lessOrEqual=aw;function Qd(r,e){if(r.length!==e.length)return 0;for(var t=0,n=0;n<r.length;n++)t|=r[n]^e[n];return 1&t-1>>>8}ni.compare=Qd;function cw(r,e){return r.length===0||e.length===0?!1:Qd(r,e)!==0}ni.equal=cw,function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=ni,t=qr;r.DIGEST_LENGTH=16;var n=function(){function c(u){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 f=u[0]|u[1]<<8;this._r[0]=f&8191;var h=u[2]|u[3]<<8;this._r[1]=(f>>>13|h<<3)&8191;var m=u[4]|u[5]<<8;this._r[2]=(h>>>10|m<<6)&7939;var w=u[6]|u[7]<<8;this._r[3]=(m>>>7|w<<9)&8191;var y=u[8]|u[9]<<8;this._r[4]=(w>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var _=u[10]|u[11]<<8;this._r[6]=(y>>>14|_<<2)&8191;var S=u[12]|u[13]<<8;this._r[7]=(_>>>11|S<<5)&8065;var P=u[14]|u[15]<<8;this._r[8]=(S>>>8|P<<8)&8191,this._r[9]=P>>>5&127,this._pad[0]=u[16]|u[17]<<8,this._pad[1]=u[18]|u[19]<<8,this._pad[2]=u[20]|u[21]<<8,this._pad[3]=u[22]|u[23]<<8,this._pad[4]=u[24]|u[25]<<8,this._pad[5]=u[26]|u[27]<<8,this._pad[6]=u[28]|u[29]<<8,this._pad[7]=u[30]|u[31]<<8}return c.prototype._blocks=function(u,f,h){for(var m=this._fin?0:2048,w=this._h[0],y=this._h[1],_=this._h[2],S=this._h[3],P=this._h[4],j=this._h[5],U=this._h[6],A=this._h[7],T=this._h[8],O=this._h[9],$=this._r[0],x=this._r[1],d=this._r[2],b=this._r[3],H=this._r[4],F=this._r[5],V=this._r[6],se=this._r[7],ce=this._r[8],I=this._r[9];h>=16;){var N=u[f+0]|u[f+1]<<8;w+=N&8191;var X=u[f+2]|u[f+3]<<8;y+=(N>>>13|X<<3)&8191;var ee=u[f+4]|u[f+5]<<8;_+=(X>>>10|ee<<6)&8191;var Y=u[f+6]|u[f+7]<<8;S+=(ee>>>7|Y<<9)&8191;var Z=u[f+8]|u[f+9]<<8;P+=(Y>>>4|Z<<12)&8191,j+=Z>>>1&8191;var Q=u[f+10]|u[f+11]<<8;U+=(Z>>>14|Q<<2)&8191;var ie=u[f+12]|u[f+13]<<8;A+=(Q>>>11|ie<<5)&8191;var Ee=u[f+14]|u[f+15]<<8;T+=(ie>>>8|Ee<<8)&8191,O+=Ee>>>5|m;var ae=0,xe=ae;xe+=w*$,xe+=y*(5*I),xe+=_*(5*ce),xe+=S*(5*se),xe+=P*(5*V),ae=xe>>>13,xe&=8191,xe+=j*(5*F),xe+=U*(5*H),xe+=A*(5*b),xe+=T*(5*d),xe+=O*(5*x),ae+=xe>>>13,xe&=8191;var de=ae;de+=w*x,de+=y*$,de+=_*(5*I),de+=S*(5*ce),de+=P*(5*se),ae=de>>>13,de&=8191,de+=j*(5*V),de+=U*(5*F),de+=A*(5*H),de+=T*(5*b),de+=O*(5*d),ae+=de>>>13,de&=8191;var be=ae;be+=w*d,be+=y*x,be+=_*$,be+=S*(5*I),be+=P*(5*ce),ae=be>>>13,be&=8191,be+=j*(5*se),be+=U*(5*V),be+=A*(5*F),be+=T*(5*H),be+=O*(5*b),ae+=be>>>13,be&=8191;var K=ae;K+=w*b,K+=y*d,K+=_*x,K+=S*$,K+=P*(5*I),ae=K>>>13,K&=8191,K+=j*(5*ce),K+=U*(5*se),K+=A*(5*V),K+=T*(5*F),K+=O*(5*H),ae+=K>>>13,K&=8191;var W=ae;W+=w*H,W+=y*b,W+=_*d,W+=S*x,W+=P*$,ae=W>>>13,W&=8191,W+=j*(5*I),W+=U*(5*ce),W+=A*(5*se),W+=T*(5*V),W+=O*(5*F),ae+=W>>>13,W&=8191;var B=ae;B+=w*F,B+=y*H,B+=_*b,B+=S*d,B+=P*x,ae=B>>>13,B&=8191,B+=j*$,B+=U*(5*I),B+=A*(5*ce),B+=T*(5*se),B+=O*(5*V),ae+=B>>>13,B&=8191;var g=ae;g+=w*V,g+=y*F,g+=_*H,g+=S*b,g+=P*d,ae=g>>>13,g&=8191,g+=j*x,g+=U*$,g+=A*(5*I),g+=T*(5*ce),g+=O*(5*se),ae+=g>>>13,g&=8191;var L=ae;L+=w*se,L+=y*V,L+=_*F,L+=S*H,L+=P*b,ae=L>>>13,L&=8191,L+=j*d,L+=U*x,L+=A*$,L+=T*(5*I),L+=O*(5*ce),ae+=L>>>13,L&=8191;var le=ae;le+=w*ce,le+=y*se,le+=_*V,le+=S*F,le+=P*H,ae=le>>>13,le&=8191,le+=j*b,le+=U*d,le+=A*x,le+=T*$,le+=O*(5*I),ae+=le>>>13,le&=8191;var pe=ae;pe+=w*I,pe+=y*ce,pe+=_*se,pe+=S*V,pe+=P*F,ae=pe>>>13,pe&=8191,pe+=j*H,pe+=U*b,pe+=A*d,pe+=T*x,pe+=O*$,ae+=pe>>>13,pe&=8191,ae=(ae<<2)+ae|0,ae=ae+xe|0,xe=ae&8191,ae=ae>>>13,de+=ae,w=xe,y=de,_=be,S=K,P=W,j=B,U=g,A=L,T=le,O=pe,f+=16,h-=16}this._h[0]=w,this._h[1]=y,this._h[2]=_,this._h[3]=S,this._h[4]=P,this._h[5]=j,this._h[6]=U,this._h[7]=A,this._h[8]=T,this._h[9]=O},c.prototype.finish=function(u,f){f===void 0&&(f=0);var h=new Uint16Array(10),m,w,y,_;if(this._leftover){for(_=this._leftover,this._buffer[_++]=1;_<16;_++)this._buffer[_]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(m=this._h[1]>>>13,this._h[1]&=8191,_=2;_<10;_++)this._h[_]+=m,m=this._h[_]>>>13,this._h[_]&=8191;for(this._h[0]+=m*5,m=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=m,m=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=m,h[0]=this._h[0]+5,m=h[0]>>>13,h[0]&=8191,_=1;_<10;_++)h[_]=this._h[_]+m,m=h[_]>>>13,h[_]&=8191;for(h[9]-=8192,w=(m^1)-1,_=0;_<10;_++)h[_]&=w;for(w=~w,_=0;_<10;_++)this._h[_]=this._h[_]&w|h[_];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,y=this._h[0]+this._pad[0],this._h[0]=y&65535,_=1;_<8;_++)y=(this._h[_]+this._pad[_]|0)+(y>>>16)|0,this._h[_]=y&65535;return u[f+0]=this._h[0]>>>0,u[f+1]=this._h[0]>>>8,u[f+2]=this._h[1]>>>0,u[f+3]=this._h[1]>>>8,u[f+4]=this._h[2]>>>0,u[f+5]=this._h[2]>>>8,u[f+6]=this._h[3]>>>0,u[f+7]=this._h[3]>>>8,u[f+8]=this._h[4]>>>0,u[f+9]=this._h[4]>>>8,u[f+10]=this._h[5]>>>0,u[f+11]=this._h[5]>>>8,u[f+12]=this._h[6]>>>0,u[f+13]=this._h[6]>>>8,u[f+14]=this._h[7]>>>0,u[f+15]=this._h[7]>>>8,this._finished=!0,this},c.prototype.update=function(u){var f=0,h=u.length,m;if(this._leftover){m=16-this._leftover,m>h&&(m=h);for(var w=0;w<m;w++)this._buffer[this._leftover+w]=u[f+w];if(h-=m,f+=m,this._leftover+=m,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(h>=16&&(m=h-h%16,this._blocks(u,f,m),f+=m,h-=m),h){for(var w=0;w<h;w++)this._buffer[this._leftover+w]=u[f+w];this._leftover+=h}return this},c.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var u=new Uint8Array(16);return this.finish(u),u},c.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},c}();r.Poly1305=n;function i(c,u){var f=new n(c);f.update(u);var h=f.digest();return f.clean(),h}r.oneTimeAuth=i;function a(c,u){return c.length!==r.DIGEST_LENGTH||u.length!==r.DIGEST_LENGTH?!1:e.equal(c,u)}r.equal=a}(Jd),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Ca,t=Jd,n=qr,i=Me,a=ni;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var c=new Uint8Array(16),u=function(){function f(h){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,h.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(h)}return f.prototype.seal=function(h,m,w,y){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var _=new Uint8Array(16);_.set(h,_.length-h.length);var S=new Uint8Array(32);e.stream(this._key,_,S,4);var P=m.length+this.tagLength,j;if(y){if(y.length!==P)throw new Error("ChaCha20Poly1305: incorrect destination length");j=y}else j=new Uint8Array(P);return e.streamXOR(this._key,_,m,j,4),this._authenticate(j.subarray(j.length-this.tagLength,j.length),S,j.subarray(0,j.length-this.tagLength),w),n.wipe(_),j},f.prototype.open=function(h,m,w,y){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(m.length<this.tagLength)return null;var _=new Uint8Array(16);_.set(h,_.length-h.length);var S=new Uint8Array(32);e.stream(this._key,_,S,4);var P=new Uint8Array(this.tagLength);if(this._authenticate(P,S,m.subarray(0,m.length-this.tagLength),w),!a.equal(P,m.subarray(m.length-this.tagLength,m.length)))return null;var j=m.length-this.tagLength,U;if(y){if(y.length!==j)throw new Error("ChaCha20Poly1305: incorrect destination length");U=y}else U=new Uint8Array(j);return e.streamXOR(this._key,_,m.subarray(0,m.length-this.tagLength),U,4),n.wipe(_),U},f.prototype.clean=function(){return n.wipe(this._key),this},f.prototype._authenticate=function(h,m,w,y){var _=new t.Poly1305(m);y&&(_.update(y),y.length%16>0&&_.update(c.subarray(y.length%16))),_.update(w),w.length%16>0&&_.update(c.subarray(w.length%16));var S=new Uint8Array(8);y&&i.writeUint64LE(y.length,S),_.update(S),i.writeUint64LE(w.length,S),_.update(S);for(var P=_.digest(),j=0;j<P.length;j++)h[j]=P[j];_.clean(),n.wipe(P),n.wipe(S)},f}();r.ChaCha20Poly1305=u}(Nl);var Xd={},mo={},Bl={};Object.defineProperty(Bl,"__esModule",{value:!0});function lw(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Bl.isSerializableHash=lw,Object.defineProperty(mo,"__esModule",{value:!0});var _n=Bl,uw=ni,hw=qr,e0=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 n=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(n).clean():n.set(t);for(var i=0;i<n.length;i++)n[i]^=54;this._inner.update(n);for(var i=0;i<n.length;i++)n[i]^=106;this._outer.update(n),_n.isSerializableHash(this._inner)&&_n.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),hw.wipe(n)}return r.prototype.reset=function(){if(!_n.isSerializableHash(this._inner)||!_n.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(){_n.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),_n.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(!_n.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(!_n.isSerializableHash(this._inner)||!_n.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(!_n.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},r}();mo.HMAC=e0;function fw(r,e,t){var n=new e0(r,e);n.update(t);var i=n.digest();return n.clean(),i}mo.hmac=fw,mo.equal=uw.equal,Object.defineProperty(Xd,"__esModule",{value:!0});var t0=mo,r0=qr,dw=function(){function r(e,t,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var a=t0.hmac(this._hash,n,t);this._hmac=new t0.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),n=0;n<t.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[n]=this._buffer[this._bufpos++];return t},r.prototype.clean=function(){this._hmac.clean(),r0.wipe(this._buffer),r0.wipe(this._counter),this._bufpos=0},r}(),pw=Xd.HKDF=dw,ys={},Pa={},Ta={};Object.defineProperty(Ta,"__esModule",{value:!0}),Ta.BrowserRandomSource=void 0;const n0=65536;class gw{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 n=0;n<t.length;n+=n0)this._crypto.getRandomValues(t.subarray(n,n+Math.min(t.length-n,n0)));return t}}Ta.BrowserRandomSource=gw;function mw(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 Ra={},vw={},yw=Object.freeze({__proto__:null,default:vw}),ww=Pi(yw);Object.defineProperty(Ra,"__esModule",{value:!0}),Ra.NodeRandomSource=void 0;const bw=qr;class _w{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof mw<"u"){const e=ww;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 n=new Uint8Array(e);for(let i=0;i<n.length;i++)n[i]=t[i];return(0,bw.wipe)(t),n}}Ra.NodeRandomSource=_w,Object.defineProperty(Pa,"__esModule",{value:!0}),Pa.SystemRandomSource=void 0;const Ew=Ta,xw=Ra;class Iw{constructor(){if(this.isAvailable=!1,this.name="",this._source=new Ew.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new xw.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)}}Pa.SystemRandomSource=Iw,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const e=Pa,t=Me,n=qr;r.defaultRandomSource=new e.SystemRandomSource;function i(h,m=r.defaultRandomSource){return m.randomBytes(h)}r.randomBytes=i;function a(h=r.defaultRandomSource){const m=i(4,h),w=(0,t.readUint32LE)(m);return(0,n.wipe)(m),w}r.randomUint32=a;const c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function u(h,m=c,w=r.defaultRandomSource){if(m.length<2)throw new Error("randomString charset is too short");if(m.length>256)throw new Error("randomString charset is too long");let y="";const _=m.length,S=256-256%_;for(;h>0;){const P=i(Math.ceil(h*256/S),w);for(let j=0;j<P.length&&h>0;j++){const U=P[j];U<S&&(y+=m.charAt(U%_),h--)}(0,n.wipe)(P)}return y}r.randomString=u;function f(h,m=c,w=r.defaultRandomSource){const y=Math.ceil(h/(Math.log(m.length)/Math.LN2));return u(y,m,w)}r.randomStringForEntropy=f}(ys);var Na={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Me,t=qr;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var n=function(){function u(){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 u.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},u.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},u.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._temp),this.reset()},u.prototype.update=function(f,h){if(h===void 0&&(h=f.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var m=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&h>0;)this._buffer[this._bufferLength++]=f[m++],h--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(m=a(this._temp,this._state,f,m,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=f[m++],h--;return this},u.prototype.finish=function(f){if(!this._finished){var h=this._bytesHashed,m=this._bufferLength,w=h/536870912|0,y=h<<3,_=h%64<56?64:128;this._buffer[m]=128;for(var S=m+1;S<_-8;S++)this._buffer[S]=0;e.writeUint32BE(w,this._buffer,_-8),e.writeUint32BE(y,this._buffer,_-4),a(this._temp,this._state,this._buffer,0,_),this._finished=!0}for(var S=0;S<this.digestLength/4;S++)e.writeUint32BE(this._state[S],f,S*4);return this},u.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},u.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}},u.prototype.restoreState=function(f){return this._state.set(f.state),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},u.prototype.cleanSavedState=function(f){t.wipe(f.state),f.buffer&&t.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},u}();r.SHA256=n;var i=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(u,f,h,m,w){for(;w>=64;){for(var y=f[0],_=f[1],S=f[2],P=f[3],j=f[4],U=f[5],A=f[6],T=f[7],O=0;O<16;O++){var $=m+O*4;u[O]=e.readUint32BE(h,$)}for(var O=16;O<64;O++){var x=u[O-2],d=(x>>>17|x<<32-17)^(x>>>19|x<<32-19)^x>>>10;x=u[O-15];var b=(x>>>7|x<<32-7)^(x>>>18|x<<32-18)^x>>>3;u[O]=(d+u[O-7]|0)+(b+u[O-16]|0)}for(var O=0;O<64;O++){var d=(((j>>>6|j<<26)^(j>>>11|j<<21)^(j>>>25|j<<7))+(j&U^~j&A)|0)+(T+(i[O]+u[O]|0)|0)|0,b=((y>>>2|y<<32-2)^(y>>>13|y<<32-13)^(y>>>22|y<<32-22))+(y&_^y&S^_&S)|0;T=A,A=U,U=j,j=P+d|0,P=S,S=_,_=y,y=d+b|0}f[0]+=y,f[1]+=_,f[2]+=S,f[3]+=P,f[4]+=j,f[5]+=U,f[6]+=A,f[7]+=T,m+=64,w-=64}return m}function c(u){var f=new n;f.update(u);var h=f.digest();return f.clean(),h}r.hash=c})(Na);var kl={};(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=ys,t=qr;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function n(O){const $=new Float64Array(16);if(O)for(let x=0;x<O.length;x++)$[x]=O[x];return $}const i=new Uint8Array(32);i[0]=9;const a=n([56129,1]);function c(O){let $=1;for(let x=0;x<16;x++){let d=O[x]+$+65535;$=Math.floor(d/65536),O[x]=d-$*65536}O[0]+=$-1+37*($-1)}function u(O,$,x){const d=~(x-1);for(let b=0;b<16;b++){const H=d&(O[b]^$[b]);O[b]^=H,$[b]^=H}}function f(O,$){const x=n(),d=n();for(let b=0;b<16;b++)d[b]=$[b];c(d),c(d),c(d);for(let b=0;b<2;b++){x[0]=d[0]-65517;for(let F=1;F<15;F++)x[F]=d[F]-65535-(x[F-1]>>16&1),x[F-1]&=65535;x[15]=d[15]-32767-(x[14]>>16&1);const H=x[15]>>16&1;x[14]&=65535,u(d,x,1-H)}for(let b=0;b<16;b++)O[2*b]=d[b]&255,O[2*b+1]=d[b]>>8}function h(O,$){for(let x=0;x<16;x++)O[x]=$[2*x]+($[2*x+1]<<8);O[15]&=32767}function m(O,$,x){for(let d=0;d<16;d++)O[d]=$[d]+x[d]}function w(O,$,x){for(let d=0;d<16;d++)O[d]=$[d]-x[d]}function y(O,$,x){let d,b,H=0,F=0,V=0,se=0,ce=0,I=0,N=0,X=0,ee=0,Y=0,Z=0,Q=0,ie=0,Ee=0,ae=0,xe=0,de=0,be=0,K=0,W=0,B=0,g=0,L=0,le=0,pe=0,Oe=0,Ke=0,Ze=0,ke=0,Ot=0,Ct=0,ze=x[0],Ce=x[1],Ue=x[2],je=x[3],He=x[4],Ae=x[5],Fe=x[6],Se=x[7],Te=x[8],Ve=x[9],$e=x[10],Je=x[11],et=x[12],at=x[13],ct=x[14],nt=x[15];d=$[0],H+=d*ze,F+=d*Ce,V+=d*Ue,se+=d*je,ce+=d*He,I+=d*Ae,N+=d*Fe,X+=d*Se,ee+=d*Te,Y+=d*Ve,Z+=d*$e,Q+=d*Je,ie+=d*et,Ee+=d*at,ae+=d*ct,xe+=d*nt,d=$[1],F+=d*ze,V+=d*Ce,se+=d*Ue,ce+=d*je,I+=d*He,N+=d*Ae,X+=d*Fe,ee+=d*Se,Y+=d*Te,Z+=d*Ve,Q+=d*$e,ie+=d*Je,Ee+=d*et,ae+=d*at,xe+=d*ct,de+=d*nt,d=$[2],V+=d*ze,se+=d*Ce,ce+=d*Ue,I+=d*je,N+=d*He,X+=d*Ae,ee+=d*Fe,Y+=d*Se,Z+=d*Te,Q+=d*Ve,ie+=d*$e,Ee+=d*Je,ae+=d*et,xe+=d*at,de+=d*ct,be+=d*nt,d=$[3],se+=d*ze,ce+=d*Ce,I+=d*Ue,N+=d*je,X+=d*He,ee+=d*Ae,Y+=d*Fe,Z+=d*Se,Q+=d*Te,ie+=d*Ve,Ee+=d*$e,ae+=d*Je,xe+=d*et,de+=d*at,be+=d*ct,K+=d*nt,d=$[4],ce+=d*ze,I+=d*Ce,N+=d*Ue,X+=d*je,ee+=d*He,Y+=d*Ae,Z+=d*Fe,Q+=d*Se,ie+=d*Te,Ee+=d*Ve,ae+=d*$e,xe+=d*Je,de+=d*et,be+=d*at,K+=d*ct,W+=d*nt,d=$[5],I+=d*ze,N+=d*Ce,X+=d*Ue,ee+=d*je,Y+=d*He,Z+=d*Ae,Q+=d*Fe,ie+=d*Se,Ee+=d*Te,ae+=d*Ve,xe+=d*$e,de+=d*Je,be+=d*et,K+=d*at,W+=d*ct,B+=d*nt,d=$[6],N+=d*ze,X+=d*Ce,ee+=d*Ue,Y+=d*je,Z+=d*He,Q+=d*Ae,ie+=d*Fe,Ee+=d*Se,ae+=d*Te,xe+=d*Ve,de+=d*$e,be+=d*Je,K+=d*et,W+=d*at,B+=d*ct,g+=d*nt,d=$[7],X+=d*ze,ee+=d*Ce,Y+=d*Ue,Z+=d*je,Q+=d*He,ie+=d*Ae,Ee+=d*Fe,ae+=d*Se,xe+=d*Te,de+=d*Ve,be+=d*$e,K+=d*Je,W+=d*et,B+=d*at,g+=d*ct,L+=d*nt,d=$[8],ee+=d*ze,Y+=d*Ce,Z+=d*Ue,Q+=d*je,ie+=d*He,Ee+=d*Ae,ae+=d*Fe,xe+=d*Se,de+=d*Te,be+=d*Ve,K+=d*$e,W+=d*Je,B+=d*et,g+=d*at,L+=d*ct,le+=d*nt,d=$[9],Y+=d*ze,Z+=d*Ce,Q+=d*Ue,ie+=d*je,Ee+=d*He,ae+=d*Ae,xe+=d*Fe,de+=d*Se,be+=d*Te,K+=d*Ve,W+=d*$e,B+=d*Je,g+=d*et,L+=d*at,le+=d*ct,pe+=d*nt,d=$[10],Z+=d*ze,Q+=d*Ce,ie+=d*Ue,Ee+=d*je,ae+=d*He,xe+=d*Ae,de+=d*Fe,be+=d*Se,K+=d*Te,W+=d*Ve,B+=d*$e,g+=d*Je,L+=d*et,le+=d*at,pe+=d*ct,Oe+=d*nt,d=$[11],Q+=d*ze,ie+=d*Ce,Ee+=d*Ue,ae+=d*je,xe+=d*He,de+=d*Ae,be+=d*Fe,K+=d*Se,W+=d*Te,B+=d*Ve,g+=d*$e,L+=d*Je,le+=d*et,pe+=d*at,Oe+=d*ct,Ke+=d*nt,d=$[12],ie+=d*ze,Ee+=d*Ce,ae+=d*Ue,xe+=d*je,de+=d*He,be+=d*Ae,K+=d*Fe,W+=d*Se,B+=d*Te,g+=d*Ve,L+=d*$e,le+=d*Je,pe+=d*et,Oe+=d*at,Ke+=d*ct,Ze+=d*nt,d=$[13],Ee+=d*ze,ae+=d*Ce,xe+=d*Ue,de+=d*je,be+=d*He,K+=d*Ae,W+=d*Fe,B+=d*Se,g+=d*Te,L+=d*Ve,le+=d*$e,pe+=d*Je,Oe+=d*et,Ke+=d*at,Ze+=d*ct,ke+=d*nt,d=$[14],ae+=d*ze,xe+=d*Ce,de+=d*Ue,be+=d*je,K+=d*He,W+=d*Ae,B+=d*Fe,g+=d*Se,L+=d*Te,le+=d*Ve,pe+=d*$e,Oe+=d*Je,Ke+=d*et,Ze+=d*at,ke+=d*ct,Ot+=d*nt,d=$[15],xe+=d*ze,de+=d*Ce,be+=d*Ue,K+=d*je,W+=d*He,B+=d*Ae,g+=d*Fe,L+=d*Se,le+=d*Te,pe+=d*Ve,Oe+=d*$e,Ke+=d*Je,Ze+=d*et,ke+=d*at,Ot+=d*ct,Ct+=d*nt,H+=38*de,F+=38*be,V+=38*K,se+=38*W,ce+=38*B,I+=38*g,N+=38*L,X+=38*le,ee+=38*pe,Y+=38*Oe,Z+=38*Ke,Q+=38*Ze,ie+=38*ke,Ee+=38*Ot,ae+=38*Ct,b=1,d=H+b+65535,b=Math.floor(d/65536),H=d-b*65536,d=F+b+65535,b=Math.floor(d/65536),F=d-b*65536,d=V+b+65535,b=Math.floor(d/65536),V=d-b*65536,d=se+b+65535,b=Math.floor(d/65536),se=d-b*65536,d=ce+b+65535,b=Math.floor(d/65536),ce=d-b*65536,d=I+b+65535,b=Math.floor(d/65536),I=d-b*65536,d=N+b+65535,b=Math.floor(d/65536),N=d-b*65536,d=X+b+65535,b=Math.floor(d/65536),X=d-b*65536,d=ee+b+65535,b=Math.floor(d/65536),ee=d-b*65536,d=Y+b+65535,b=Math.floor(d/65536),Y=d-b*65536,d=Z+b+65535,b=Math.floor(d/65536),Z=d-b*65536,d=Q+b+65535,b=Math.floor(d/65536),Q=d-b*65536,d=ie+b+65535,b=Math.floor(d/65536),ie=d-b*65536,d=Ee+b+65535,b=Math.floor(d/65536),Ee=d-b*65536,d=ae+b+65535,b=Math.floor(d/65536),ae=d-b*65536,d=xe+b+65535,b=Math.floor(d/65536),xe=d-b*65536,H+=b-1+37*(b-1),b=1,d=H+b+65535,b=Math.floor(d/65536),H=d-b*65536,d=F+b+65535,b=Math.floor(d/65536),F=d-b*65536,d=V+b+65535,b=Math.floor(d/65536),V=d-b*65536,d=se+b+65535,b=Math.floor(d/65536),se=d-b*65536,d=ce+b+65535,b=Math.floor(d/65536),ce=d-b*65536,d=I+b+65535,b=Math.floor(d/65536),I=d-b*65536,d=N+b+65535,b=Math.floor(d/65536),N=d-b*65536,d=X+b+65535,b=Math.floor(d/65536),X=d-b*65536,d=ee+b+65535,b=Math.floor(d/65536),ee=d-b*65536,d=Y+b+65535,b=Math.floor(d/65536),Y=d-b*65536,d=Z+b+65535,b=Math.floor(d/65536),Z=d-b*65536,d=Q+b+65535,b=Math.floor(d/65536),Q=d-b*65536,d=ie+b+65535,b=Math.floor(d/65536),ie=d-b*65536,d=Ee+b+65535,b=Math.floor(d/65536),Ee=d-b*65536,d=ae+b+65535,b=Math.floor(d/65536),ae=d-b*65536,d=xe+b+65535,b=Math.floor(d/65536),xe=d-b*65536,H+=b-1+37*(b-1),O[0]=H,O[1]=F,O[2]=V,O[3]=se,O[4]=ce,O[5]=I,O[6]=N,O[7]=X,O[8]=ee,O[9]=Y,O[10]=Z,O[11]=Q,O[12]=ie,O[13]=Ee,O[14]=ae,O[15]=xe}function _(O,$){y(O,$,$)}function S(O,$){const x=n();for(let d=0;d<16;d++)x[d]=$[d];for(let d=253;d>=0;d--)_(x,x),d!==2&&d!==4&&y(x,x,$);for(let d=0;d<16;d++)O[d]=x[d]}function P(O,$){const x=new Uint8Array(32),d=new Float64Array(80),b=n(),H=n(),F=n(),V=n(),se=n(),ce=n();for(let ee=0;ee<31;ee++)x[ee]=O[ee];x[31]=O[31]&127|64,x[0]&=248,h(d,$);for(let ee=0;ee<16;ee++)H[ee]=d[ee];b[0]=V[0]=1;for(let ee=254;ee>=0;--ee){const Y=x[ee>>>3]>>>(ee&7)&1;u(b,H,Y),u(F,V,Y),m(se,b,F),w(b,b,F),m(F,H,V),w(H,H,V),_(V,se),_(ce,b),y(b,F,b),y(F,H,se),m(se,b,F),w(b,b,F),_(H,b),w(F,V,ce),y(b,F,a),m(b,b,V),y(F,F,b),y(b,V,ce),y(V,H,d),_(H,se),u(b,H,Y),u(F,V,Y)}for(let ee=0;ee<16;ee++)d[ee+16]=b[ee],d[ee+32]=F[ee],d[ee+48]=H[ee],d[ee+64]=V[ee];const I=d.subarray(32),N=d.subarray(16);S(I,I),y(N,N,I);const X=new Uint8Array(32);return f(X,N),X}r.scalarMult=P;function j(O){return P(O,i)}r.scalarMultBase=j;function U(O){if(O.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const $=new Uint8Array(O);return{publicKey:j($),secretKey:$}}r.generateKeyPairFromSeed=U;function A(O){const $=(0,e.randomBytes)(32,O),x=U($);return(0,t.wipe)($),x}r.generateKeyPair=A;function T(O,$,x=!1){if(O.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if($.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const d=P(O,$);if(x){let b=0;for(let H=0;H<d.length;H++)b|=d[H];if(b===0)throw new Error("X25519: invalid shared key")}return d}r.sharedKey=T})(kl);function ql(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function i0(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?ql(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function zl(r,e){e||(e=r.reduce((i,a)=>i+a.length,0));const t=i0(e);let n=0;for(const i of r)t.set(i,n),n+=i.length;return ql(t)}function Dw(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<r.length;i++){var a=r.charAt(i),c=a.charCodeAt(0);if(t[c]!==255)throw new TypeError(a+" is ambiguous");t[c]=i}var u=r.length,f=r.charAt(0),h=Math.log(u)/Math.log(256),m=Math.log(256)/Math.log(u);function w(S){if(S instanceof Uint8Array||(ArrayBuffer.isView(S)?S=new Uint8Array(S.buffer,S.byteOffset,S.byteLength):Array.isArray(S)&&(S=Uint8Array.from(S))),!(S instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(S.length===0)return"";for(var P=0,j=0,U=0,A=S.length;U!==A&&S[U]===0;)U++,P++;for(var T=(A-U)*m+1>>>0,O=new Uint8Array(T);U!==A;){for(var $=S[U],x=0,d=T-1;($!==0||x<j)&&d!==-1;d--,x++)$+=256*O[d]>>>0,O[d]=$%u>>>0,$=$/u>>>0;if($!==0)throw new Error("Non-zero carry");j=x,U++}for(var b=T-j;b!==T&&O[b]===0;)b++;for(var H=f.repeat(P);b<T;++b)H+=r.charAt(O[b]);return H}function y(S){if(typeof S!="string")throw new TypeError("Expected String");if(S.length===0)return new Uint8Array;var P=0;if(S[P]!==" "){for(var j=0,U=0;S[P]===f;)j++,P++;for(var A=(S.length-P)*h+1>>>0,T=new Uint8Array(A);S[P];){var O=t[S.charCodeAt(P)];if(O===255)return;for(var $=0,x=A-1;(O!==0||$<U)&&x!==-1;x--,$++)O+=u*T[x]>>>0,T[x]=O%256>>>0,O=O/256>>>0;if(O!==0)throw new Error("Non-zero carry");U=$,P++}if(S[P]!==" "){for(var d=A-U;d!==A&&T[d]===0;)d++;for(var b=new Uint8Array(j+(A-d)),H=j;d!==A;)b[H++]=T[d++];return b}}}function _(S){var P=y(S);if(P)return P;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:y,decode:_}}var Sw=Dw,Ow=Sw;const s0=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")},Cw=r=>new TextEncoder().encode(r),$w=r=>new TextDecoder().decode(r);class Aw{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Pw{constructor(e,t,n){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=n}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 o0(this,e)}}class Tw{constructor(e){this.decoders=e}or(e){return o0(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const o0=(r,e)=>new Tw({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class Rw{constructor(e,t,n,i){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=i,this.encoder=new Aw(e,t,n),this.decoder=new Pw(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const La=({name:r,prefix:e,encode:t,decode:n})=>new Rw(r,e,t,n),vo=({prefix:r,name:e,alphabet:t})=>{const{encode:n,decode:i}=Ow(t,e);return La({prefix:r,name:e,encode:n,decode:a=>s0(i(a))})},Nw=(r,e,t,n)=>{const i={};for(let m=0;m<e.length;++m)i[e[m]]=m;let a=r.length;for(;r[a-1]==="=";)--a;const c=new Uint8Array(a*t/8|0);let u=0,f=0,h=0;for(let m=0;m<a;++m){const w=i[r[m]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<t|w,u+=t,u>=8&&(u-=8,c[h++]=255&f>>u)}if(u>=t||255&f<<8-u)throw new SyntaxError("Unexpected end of data");return c},Lw=(r,e,t)=>{const n=e[e.length-1]==="=",i=(1<<t)-1;let a="",c=0,u=0;for(let f=0;f<r.length;++f)for(u=u<<8|r[f],c+=8;c>t;)c-=t,a+=e[i&u>>c];if(c&&(a+=e[i&u<<t-c]),n)for(;a.length*t&7;)a+="=";return a},ur=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>La({prefix:e,name:r,encode(i){return Lw(i,n,t)},decode(i){return Nw(i,n,t,r)}}),Mw=La({prefix:"\0",name:"identity",encode:r=>$w(r),decode:r=>Cw(r)});var Uw=Object.freeze({__proto__:null,identity:Mw});const jw=ur({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Fw=Object.freeze({__proto__:null,base2:jw});const Bw=ur({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var kw=Object.freeze({__proto__:null,base8:Bw});const qw=vo({prefix:"9",name:"base10",alphabet:"0123456789"});var zw=Object.freeze({__proto__:null,base10:qw});const Hw=ur({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ww=ur({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Kw=Object.freeze({__proto__:null,base16:Hw,base16upper:Ww});const Vw=ur({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Gw=ur({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Yw=ur({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Zw=ur({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Jw=ur({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Qw=ur({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Xw=ur({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),eb=ur({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),tb=ur({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var rb=Object.freeze({__proto__:null,base32:Vw,base32upper:Gw,base32pad:Yw,base32padupper:Zw,base32hex:Jw,base32hexupper:Qw,base32hexpad:Xw,base32hexpadupper:eb,base32z:tb});const nb=vo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ib=vo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var sb=Object.freeze({__proto__:null,base36:nb,base36upper:ib});const ob=vo({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ab=vo({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var cb=Object.freeze({__proto__:null,base58btc:ob,base58flickr:ab});const lb=ur({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ub=ur({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),hb=ur({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),fb=ur({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var db=Object.freeze({__proto__:null,base64:lb,base64pad:ub,base64url:hb,base64urlpad:fb});const a0=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}"),pb=a0.reduce((r,e,t)=>(r[t]=e,r),[]),gb=a0.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function mb(r){return r.reduce((e,t)=>(e+=pb[t],e),"")}function vb(r){const e=[];for(const t of r){const n=gb[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}const yb=La({prefix:"\u{1F680}",name:"base256emoji",encode:mb,decode:vb});var wb=Object.freeze({__proto__:null,base256emoji:yb}),bb=l0,c0=128,_b=127,Eb=~_b,xb=Math.pow(2,31);function l0(r,e,t){e=e||[],t=t||0;for(var n=t;r>=xb;)e[t++]=r&255|c0,r/=128;for(;r&Eb;)e[t++]=r&255|c0,r>>>=7;return e[t]=r|0,l0.bytes=t-n+1,e}var Ib=Hl,Db=128,u0=127;function Hl(r,n){var t=0,n=n||0,i=0,a=n,c,u=r.length;do{if(a>=u)throw Hl.bytes=0,new RangeError("Could not decode varint");c=r[a++],t+=i<28?(c&u0)<<i:(c&u0)*Math.pow(2,i),i+=7}while(c>=Db);return Hl.bytes=a-n,t}var Sb=Math.pow(2,7),Ob=Math.pow(2,14),Cb=Math.pow(2,21),$b=Math.pow(2,28),Ab=Math.pow(2,35),Pb=Math.pow(2,42),Tb=Math.pow(2,49),Rb=Math.pow(2,56),Nb=Math.pow(2,63),Lb=function(r){return r<Sb?1:r<Ob?2:r<Cb?3:r<$b?4:r<Ab?5:r<Pb?6:r<Tb?7:r<Rb?8:r<Nb?9:10},Mb={encode:bb,decode:Ib,encodingLength:Lb},h0=Mb;const f0=(r,e,t=0)=>(h0.encode(r,e,t),e),d0=r=>h0.encodingLength(r),Wl=(r,e)=>{const t=e.byteLength,n=d0(r),i=n+d0(t),a=new Uint8Array(i+t);return f0(r,a,0),f0(t,a,n),a.set(e,i),new Ub(r,t,e,a)};class Ub{constructor(e,t,n,i){this.code=e,this.size=t,this.digest=n,this.bytes=i}}const p0=({name:r,code:e,encode:t})=>new jb(r,e,t);class jb{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Wl(this.code,t):t.then(n=>Wl(this.code,n))}else throw Error("Unknown type, must be binary type")}}const g0=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),Fb=p0({name:"sha2-256",code:18,encode:g0("SHA-256")}),Bb=p0({name:"sha2-512",code:19,encode:g0("SHA-512")});var kb=Object.freeze({__proto__:null,sha256:Fb,sha512:Bb});const m0=0,qb="identity",v0=s0;var zb=Object.freeze({__proto__:null,identity:{code:m0,name:qb,encode:v0,digest:r=>Wl(m0,v0(r))}});new TextEncoder,new TextDecoder;const y0={...Uw,...Fw,...kw,...zw,...Kw,...rb,...sb,...cb,...db,...wb};({...kb,...zb});function w0(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}const b0=w0("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Kl=w0("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=i0(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),_0={utf8:b0,"utf-8":b0,hex:y0.base16,latin1:Kl,ascii:Kl,binary:Kl,...y0};function Pr(r,e="utf8"){const t=_0[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?ql(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}function yr(r,e="utf8"){const t=_0[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 E0=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},Hb=function(){function r(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"}return r}(),Wb=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return r}(),Kb=function(){function r(e,t,n,i){this.name=e,this.version=t,this.os=n,this.bot=i,this.type="bot-device"}return r}(),Vb=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),Gb=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),Yb=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Zb=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,x0=3,Jb=[["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",Yb]],I0=[["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 Qb(r){return r?D0(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Gb:typeof navigator<"u"?D0(navigator.userAgent):t2()}function Xb(r){return r!==""&&Jb.reduce(function(e,t){var n=t[0],i=t[1];if(e)return e;var a=i.exec(r);return!!a&&[n,a]},!1)}function D0(r){var e=Xb(r);if(!e)return null;var t=e[0],n=e[1];if(t==="searchbot")return new Vb;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<x0&&(i=E0(E0([],i,!0),r2(x0-i.length),!0)):i=[];var a=i.join("."),c=e2(r),u=Zb.exec(r);return u&&u[1]?new Kb(t,a,c,u[1]):new Hb(t,a,c)}function e2(r){for(var e=0,t=I0.length;e<t;e++){var n=I0[e],i=n[0],a=n[1],c=a.exec(r);if(c)return i}return null}function t2(){var r=typeof process<"u"&&process.version;return r?new Wb(process.version.slice(1)):null}function r2(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}var me={};/*! *****************************************************************************
1
+ (function(Dn,ka){typeof exports=="object"&&typeof module<"u"?ka(exports,require("stream")):typeof define=="function"&&define.amd?define(["exports","stream"],ka):(Dn=typeof globalThis<"u"?globalThis:Dn||self,ka(Dn["@walletconnect/ethereum-provider"]={},Dn.stream$1))})(this,function(Dn,ka){"use strict";var Jn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function s3(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Us(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Dr={exports:{}},Lo=typeof Reflect=="object"?Reflect:null,Kp=Lo&&typeof Lo.apply=="function"?Lo.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},al;Lo&&typeof Lo.ownKeys=="function"?al=Lo.ownKeys:Object.getOwnPropertySymbols?al=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:al=function(e){return Object.getOwnPropertyNames(e)};function o3(t){console&&console.warn&&console.warn(t)}var Wp=Number.isNaN||function(e){return e!==e};function zt(){zt.init.call(this)}Dr.exports=zt,Dr.exports.once=u3,zt.EventEmitter=zt,zt.prototype._events=void 0,zt.prototype._eventsCount=0,zt.prototype._maxListeners=void 0;var Vp=10;function cl(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(zt,"defaultMaxListeners",{enumerable:!0,get:function(){return Vp},set:function(t){if(typeof t!="number"||t<0||Wp(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Vp=t}}),zt.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},zt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Wp(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 Gp(t){return t._maxListeners===void 0?zt.defaultMaxListeners:t._maxListeners}zt.prototype.getMaxListeners=function(){return Gp(this)},zt.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var c;if(r.length>0&&(c=r[0]),c instanceof Error)throw c;var l=new Error("Unhandled error."+(c?" ("+c.message+")":""));throw l.context=c,l}var f=s[e];if(f===void 0)return!1;if(typeof f=="function")Kp(f,this,r);else for(var h=f.length,m=Xp(f,h),n=0;n<h;++n)Kp(m[n],this,r);return!0};function Yp(t,e,r,n){var i,s,c;if(cl(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),c=s[e]),c===void 0)c=s[e]=r,++t._eventsCount;else if(typeof c=="function"?c=s[e]=n?[r,c]:[c,r]:n?c.unshift(r):c.push(r),i=Gp(t),i>0&&c.length>i&&!c.warned){c.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=c.length,o3(l)}return t}zt.prototype.addListener=function(e,r){return Yp(this,e,r,!1)},zt.prototype.on=zt.prototype.addListener,zt.prototype.prependListener=function(e,r){return Yp(this,e,r,!0)};function a3(){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 Jp(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=a3.bind(n);return i.listener=r,n.wrapFn=i,i}zt.prototype.once=function(e,r){return cl(r),this.on(e,Jp(this,e,r)),this},zt.prototype.prependOnceListener=function(e,r){return cl(r),this.prependListener(e,Jp(this,e,r)),this},zt.prototype.removeListener=function(e,r){var n,i,s,c,l;if(cl(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,c=n.length-1;c>=0;c--)if(n[c]===r||n[c].listener===r){l=n[c].listener,s=c;break}if(s<0)return this;s===0?n.shift():c3(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,l||r)}return this},zt.prototype.off=zt.prototype.removeListener,zt.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),c;for(i=0;i<s.length;++i)c=s[i],c!=="removeListener"&&this.removeAllListeners(c);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function Qp(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?l3(i):Xp(i,i.length)}zt.prototype.listeners=function(e){return Qp(this,e,!0)},zt.prototype.rawListeners=function(e){return Qp(this,e,!1)},zt.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Zp.call(t,e)},zt.prototype.listenerCount=Zp;function Zp(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}zt.prototype.eventNames=function(){return this._eventsCount>0?al(this._events):[]};function Xp(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function c3(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function l3(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function u3(t,e){return new Promise(function(r,n){function i(c){t.removeListener(e,s),n(c)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}e1(t,e,s,{once:!0}),e!=="error"&&h3(t,i,{once:!0})})}function h3(t,e,r){typeof t.on=="function"&&e1(t,"error",e,r)}function e1(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var t1=function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))},f3=function(){function t(e,r,n){this.name=e,this.version=r,this.os=n,this.type="browser"}return t}(),d3=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),p3=function(){function t(e,r,n,i){this.name=e,this.version=r,this.os=n,this.bot=i,this.type="bot-device"}return t}(),g3=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),m3=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),v3=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,y3=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,r1=3,w3=[["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",v3]],n1=[["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 b3(t){return t?i1(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new m3:typeof navigator<"u"?i1(navigator.userAgent):A3()}function _3(t){return t!==""&&w3.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function i1(t){var e=_3(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new g3;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<r1&&(i=t1(t1([],i,!0),x3(r1-i.length),!0)):i=[];var s=i.join("."),c=E3(t),l=y3.exec(t);return l&&l[1]?new p3(r,s,c,l[1]):new f3(r,s,c)}function E3(t){for(var e=0,r=n1.length;e<r;e++){var n=n1[e],i=n[0],s=n[1],c=s.exec(t);if(c)return i}return null}function A3(){var t=typeof process<"u"&&process.version;return t?new d3(process.version.slice(1)):null}function x3(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}var _e={};/*! *****************************************************************************
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,23 @@
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 Vl=function(r,e){return Vl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},Vl(r,e)};function n2(r,e){Vl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Gl=function(){return Gl=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Gl.apply(this,arguments)};function i2(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function s2(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var u=r.length-1;u>=0;u--)(c=r[u])&&(a=(i<3?c(a):i>3?c(e,t,a):c(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function o2(r,e){return function(t,n){e(t,n,r)}}function a2(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function c2(r,e,t,n){function i(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function u(m){try{h(n.next(m))}catch(w){c(w)}}function f(m){try{h(n.throw(m))}catch(w){c(w)}}function h(m){m.done?a(m.value):i(m.value).then(u,f)}h((n=n.apply(r,e||[])).next())})}function l2(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=h[0]&2?i.return:h[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,h[1])).done)return a;switch(i=0,a&&(h=[h[0]&2,a.value]),h[0]){case 0:case 1:a=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,i=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){t.label=h[1];break}if(h[0]===6&&t.label<a[1]){t.label=a[1],a=h;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(h);break}a[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(m){h=[6,m],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function u2(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}function h2(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function Yl(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function S0(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(u){c={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(c)throw c.error}}return a}function f2(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(S0(arguments[e]));return r}function d2(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],c=0,u=a.length;c<u;c++,i++)n[i]=a[c];return n}function yo(r){return this instanceof yo?(this.v=r,this):new yo(r)}function p2(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(y){n[y]&&(i[y]=function(_){return new Promise(function(S,P){a.push([y,_,S,P])>1||u(y,_)})})}function u(y,_){try{f(n[y](_))}catch(S){w(a[0][3],S)}}function f(y){y.value instanceof yo?Promise.resolve(y.value.v).then(h,m):w(a[0][2],y)}function h(y){u("next",y)}function m(y){u("throw",y)}function w(y,_){y(_),a.shift(),a.length&&u(a[0][0],a[0][1])}}function g2(r){var e,t;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,a){e[i]=r[i]?function(c){return(t=!t)?{value:yo(r[i](c)),done:i==="return"}:a?a(c):c}:a}}function m2(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 Yl=="function"?Yl(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(c){return new Promise(function(u,f){c=r[a](c),i(u,f,c.done,c.value)})}}function i(a,c,u,f){Promise.resolve(f).then(function(h){a({value:h,done:u})},c)}}function v2(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function y2(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 w2(r){return r&&r.__esModule?r:{default:r}}function b2(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function _2(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 E2=Object.freeze({__proto__:null,__extends:n2,get __assign(){return Gl},__rest:i2,__decorate:s2,__param:o2,__metadata:a2,__awaiter:c2,__generator:l2,__createBinding:u2,__exportStar:h2,__values:Yl,__read:S0,__spread:f2,__spreadArrays:d2,__await:yo,__asyncGenerator:p2,__asyncDelegator:g2,__asyncValues:m2,__makeTemplateObject:v2,__importStar:y2,__importDefault:w2,__classPrivateFieldGet:b2,__classPrivateFieldSet:_2}),Ma=Pi(E2),Zl={},wo={},O0;function x2(){if(O0)return wo;O0=1,Object.defineProperty(wo,"__esModule",{value:!0}),wo.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return wo.delay=r,wo}var Ti={},Jl={},Ri={},C0;function I2(){return C0||(C0=1,Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.ONE_THOUSAND=Ri.ONE_HUNDRED=void 0,Ri.ONE_HUNDRED=100,Ri.ONE_THOUSAND=1e3),Ri}var Ql={},$0;function D2(){return $0||($0=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}(Ql)),Ql}var A0;function P0(){return A0||(A0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Ma;e.__exportStar(I2(),r),e.__exportStar(D2(),r)}(Jl)),Jl}var T0;function S2(){if(T0)return Ti;T0=1,Object.defineProperty(Ti,"__esModule",{value:!0}),Ti.fromMiliseconds=Ti.toMiliseconds=void 0;const r=P0();function e(n){return n*r.ONE_THOUSAND}Ti.toMiliseconds=e;function t(n){return Math.floor(n/r.ONE_THOUSAND)}return Ti.fromMiliseconds=t,Ti}var R0;function O2(){return R0||(R0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Ma;e.__exportStar(x2(),r),e.__exportStar(S2(),r)}(Zl)),Zl}var ws={},N0;function C2(){if(N0)return ws;N0=1,Object.defineProperty(ws,"__esModule",{value:!0}),ws.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 n=this.get(t);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const i=Date.now()-n.started;this.timestamps.set(t,{started:n.started,elapsed:i})}get(t){const n=this.timestamps.get(t);if(typeof n>"u")throw new Error(`No timestamp found for label: ${t}`);return n}elapsed(t){const n=this.get(t);return n.elapsed||Date.now()-n.started}}return ws.Watch=r,ws.default=r,ws}var Xl={},bo={},L0;function $2(){if(L0)return bo;L0=1,Object.defineProperty(bo,"__esModule",{value:!0}),bo.IWatch=void 0;class r{}return bo.IWatch=r,bo}var M0;function A2(){return M0||(M0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),Ma.__exportStar($2(),r)}(Xl)),Xl}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Ma;e.__exportStar(O2(),r),e.__exportStar(C2(),r),e.__exportStar(A2(),r),e.__exportStar(P0(),r)})(me);var _t={};Object.defineProperty(_t,"__esModule",{value:!0}),_t.getLocalStorage=_t.getLocalStorageOrThrow=_t.getCrypto=_t.getCryptoOrThrow=U0=_t.getLocation=_t.getLocationOrThrow=tu=_t.getNavigator=_t.getNavigatorOrThrow=eu=_t.getDocument=_t.getDocumentOrThrow=_t.getFromWindowOrThrow=_t.getFromWindow=void 0;function Ni(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}_t.getFromWindow=Ni;function bs(r){const e=Ni(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}_t.getFromWindowOrThrow=bs;function P2(){return bs("document")}_t.getDocumentOrThrow=P2;function T2(){return Ni("document")}var eu=_t.getDocument=T2;function R2(){return bs("navigator")}_t.getNavigatorOrThrow=R2;function N2(){return Ni("navigator")}var tu=_t.getNavigator=N2;function L2(){return bs("location")}_t.getLocationOrThrow=L2;function M2(){return Ni("location")}var U0=_t.getLocation=M2;function U2(){return bs("crypto")}_t.getCryptoOrThrow=U2;function j2(){return Ni("crypto")}_t.getCrypto=j2;function F2(){return bs("localStorage")}_t.getLocalStorageOrThrow=F2;function B2(){return Ni("localStorage")}_t.getLocalStorage=B2;var ru={};Object.defineProperty(ru,"__esModule",{value:!0});var j0=ru.getWindowMetadata=void 0;const F0=_t;function k2(){let r,e;try{r=F0.getDocumentOrThrow(),e=F0.getLocationOrThrow()}catch{return null}function t(){const w=r.getElementsByTagName("link"),y=[];for(let _=0;_<w.length;_++){const S=w[_],P=S.getAttribute("rel");if(P&&P.toLowerCase().indexOf("icon")>-1){const j=S.getAttribute("href");if(j)if(j.toLowerCase().indexOf("https:")===-1&&j.toLowerCase().indexOf("http:")===-1&&j.indexOf("//")!==0){let U=e.protocol+"//"+e.host;if(j.indexOf("/")===0)U+=j;else{const A=e.pathname.split("/");A.pop();const T=A.join("/");U+=T+"/"+j}y.push(U)}else if(j.indexOf("//")===0){const U=e.protocol+j;y.push(U)}else y.push(j)}}return y}function n(...w){const y=r.getElementsByTagName("meta");for(let _=0;_<y.length;_++){const S=y[_],P=["itemprop","property","name"].map(j=>S.getAttribute(j)).filter(j=>j?w.includes(j):!1);if(P.length&&P){const j=S.getAttribute("content");if(j)return j}}return""}function i(){let w=n("name","og:site_name","og:title","twitter:title");return w||(w=r.title),w}function a(){return n("description","og:description","twitter:description","keywords")}const c=i(),u=a(),f=e.origin,h=t();return{description:u,url:f,icons:h,name:c}}j0=ru.getWindowMetadata=k2;var _o={},q2=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),B0="%[a-f0-9]{2}",k0=new RegExp("("+B0+")|([^%]+?)","gi"),q0=new RegExp("("+B0+")+","gi");function nu(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),n=r.slice(e);return Array.prototype.concat.call([],nu(t),nu(n))}function z2(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(k0)||[],t=1;t<e.length;t++)r=nu(e,t).join(""),e=r.match(k0)||[];return r}}function H2(r){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},t=q0.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var n=z2(t[0]);n!==t[0]&&(e[t[0]]=n)}t=q0.exec(r)}e["%C2"]="\uFFFD";for(var i=Object.keys(e),a=0;a<i.length;a++){var c=i[a];r=r.replace(new RegExp(c,"g"),e[c])}return r}var W2=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 H2(r)}},K2=(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)]},V2=function(r,e){for(var t={},n=Object.keys(r),i=Array.isArray(e),a=0;a<n.length;a++){var c=n[a],u=r[c];(i?e.indexOf(c)!==-1:e(c,u,r))&&(t[c]=u)}return t};(function(r){const e=q2,t=W2,n=K2,i=V2,a=A=>A==null,c=Symbol("encodeFragmentIdentifier");function u(A){switch(A.arrayFormat){case"index":return T=>(O,$)=>{const x=O.length;return $===void 0||A.skipNull&&$===null||A.skipEmptyString&&$===""?O:$===null?[...O,[m(T,A),"[",x,"]"].join("")]:[...O,[m(T,A),"[",m(x,A),"]=",m($,A)].join("")]};case"bracket":return T=>(O,$)=>$===void 0||A.skipNull&&$===null||A.skipEmptyString&&$===""?O:$===null?[...O,[m(T,A),"[]"].join("")]:[...O,[m(T,A),"[]=",m($,A)].join("")];case"colon-list-separator":return T=>(O,$)=>$===void 0||A.skipNull&&$===null||A.skipEmptyString&&$===""?O:$===null?[...O,[m(T,A),":list="].join("")]:[...O,[m(T,A),":list=",m($,A)].join("")];case"comma":case"separator":case"bracket-separator":{const T=A.arrayFormat==="bracket-separator"?"[]=":"=";return O=>($,x)=>x===void 0||A.skipNull&&x===null||A.skipEmptyString&&x===""?$:(x=x===null?"":x,$.length===0?[[m(O,A),T,m(x,A)].join("")]:[[$,m(x,A)].join(A.arrayFormatSeparator)])}default:return T=>(O,$)=>$===void 0||A.skipNull&&$===null||A.skipEmptyString&&$===""?O:$===null?[...O,m(T,A)]:[...O,[m(T,A),"=",m($,A)].join("")]}}function f(A){let T;switch(A.arrayFormat){case"index":return(O,$,x)=>{if(T=/\[(\d*)\]$/.exec(O),O=O.replace(/\[\d*\]$/,""),!T){x[O]=$;return}x[O]===void 0&&(x[O]={}),x[O][T[1]]=$};case"bracket":return(O,$,x)=>{if(T=/(\[\])$/.exec(O),O=O.replace(/\[\]$/,""),!T){x[O]=$;return}if(x[O]===void 0){x[O]=[$];return}x[O]=[].concat(x[O],$)};case"colon-list-separator":return(O,$,x)=>{if(T=/(:list)$/.exec(O),O=O.replace(/:list$/,""),!T){x[O]=$;return}if(x[O]===void 0){x[O]=[$];return}x[O]=[].concat(x[O],$)};case"comma":case"separator":return(O,$,x)=>{const d=typeof $=="string"&&$.includes(A.arrayFormatSeparator),b=typeof $=="string"&&!d&&w($,A).includes(A.arrayFormatSeparator);$=b?w($,A):$;const H=d||b?$.split(A.arrayFormatSeparator).map(F=>w(F,A)):$===null?$:w($,A);x[O]=H};case"bracket-separator":return(O,$,x)=>{const d=/(\[\])$/.test(O);if(O=O.replace(/\[\]$/,""),!d){x[O]=$&&w($,A);return}const b=$===null?[]:$.split(A.arrayFormatSeparator).map(H=>w(H,A));if(x[O]===void 0){x[O]=b;return}x[O]=[].concat(x[O],b)};default:return(O,$,x)=>{if(x[O]===void 0){x[O]=$;return}x[O]=[].concat(x[O],$)}}}function h(A){if(typeof A!="string"||A.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function m(A,T){return T.encode?T.strict?e(A):encodeURIComponent(A):A}function w(A,T){return T.decode?t(A):A}function y(A){return Array.isArray(A)?A.sort():typeof A=="object"?y(Object.keys(A)).sort((T,O)=>Number(T)-Number(O)).map(T=>A[T]):A}function _(A){const T=A.indexOf("#");return T!==-1&&(A=A.slice(0,T)),A}function S(A){let T="";const O=A.indexOf("#");return O!==-1&&(T=A.slice(O)),T}function P(A){A=_(A);const T=A.indexOf("?");return T===-1?"":A.slice(T+1)}function j(A,T){return T.parseNumbers&&!Number.isNaN(Number(A))&&typeof A=="string"&&A.trim()!==""?A=Number(A):T.parseBooleans&&A!==null&&(A.toLowerCase()==="true"||A.toLowerCase()==="false")&&(A=A.toLowerCase()==="true"),A}function U(A,T){T=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},T),h(T.arrayFormatSeparator);const O=f(T),$=Object.create(null);if(typeof A!="string"||(A=A.trim().replace(/^[?#&]/,""),!A))return $;for(const x of A.split("&")){if(x==="")continue;let[d,b]=n(T.decode?x.replace(/\+/g," "):x,"=");b=b===void 0?null:["comma","separator","bracket-separator"].includes(T.arrayFormat)?b:w(b,T),O(w(d,T),b,$)}for(const x of Object.keys($)){const d=$[x];if(typeof d=="object"&&d!==null)for(const b of Object.keys(d))d[b]=j(d[b],T);else $[x]=j(d,T)}return T.sort===!1?$:(T.sort===!0?Object.keys($).sort():Object.keys($).sort(T.sort)).reduce((x,d)=>{const b=$[d];return b&&typeof b=="object"&&!Array.isArray(b)?x[d]=y(b):x[d]=b,x},Object.create(null))}r.extract=P,r.parse=U,r.stringify=(A,T)=>{if(!A)return"";T=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},T),h(T.arrayFormatSeparator);const O=b=>T.skipNull&&a(A[b])||T.skipEmptyString&&A[b]==="",$=u(T),x={};for(const b of Object.keys(A))O(b)||(x[b]=A[b]);const d=Object.keys(x);return T.sort!==!1&&d.sort(T.sort),d.map(b=>{const H=A[b];return H===void 0?"":H===null?m(b,T):Array.isArray(H)?H.length===0&&T.arrayFormat==="bracket-separator"?m(b,T)+"[]":H.reduce($(b),[]).join("&"):m(b,T)+"="+m(H,T)}).filter(b=>b.length>0).join("&")},r.parseUrl=(A,T)=>{T=Object.assign({decode:!0},T);const[O,$]=n(A,"#");return Object.assign({url:O.split("?")[0]||"",query:U(P(A),T)},T&&T.parseFragmentIdentifier&&$?{fragmentIdentifier:w($,T)}:{})},r.stringifyUrl=(A,T)=>{T=Object.assign({encode:!0,strict:!0,[c]:!0},T);const O=_(A.url).split("?")[0]||"",$=r.extract(A.url),x=r.parse($,{sort:!1}),d=Object.assign(x,A.query);let b=r.stringify(d,T);b&&(b=`?${b}`);let H=S(A.url);return A.fragmentIdentifier&&(H=`#${T[c]?m(A.fragmentIdentifier,T):A.fragmentIdentifier}`),`${O}${b}${H}`},r.pick=(A,T,O)=>{O=Object.assign({parseFragmentIdentifier:!0,[c]:!1},O);const{url:$,query:x,fragmentIdentifier:d}=r.parseUrl(A,O);return r.stringifyUrl({url:$,query:i(x,T),fragmentIdentifier:d},O)},r.exclude=(A,T,O)=>{const $=Array.isArray(T)?x=>!T.includes(x):(x,d)=>!T(x,d);return r.pick(A,$,O)}})(_o);const G2={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"}},Y2=":";function Z2(r){const[e,t]=r.split(Y2);return{namespace:e,reference:t}}function J2(r,e=[]){const t=[];return Object.keys(r).forEach(n=>{if(e.length&&!e.includes(n))return;const i=r[n];t.push(...i.accounts)}),t}function z0(r,e){return r.includes(":")?[r]:e.chains||[]}const H0="base10",wr="base16",iu="base64pad",su="utf8",W0=0,Li=1,Q2=0,K0=1,ou=12,au=32;function X2(){const r=kl.generateKeyPair();return{privateKey:yr(r.secretKey,wr),publicKey:yr(r.publicKey,wr)}}function cu(){const r=ys.randomBytes(au);return yr(r,wr)}function e_(r,e){const t=kl.sharedKey(Pr(r,wr),Pr(e,wr),!0),n=new pw(Na.SHA256,t).expand(au);return yr(n,wr)}function t_(r){const e=Na.hash(Pr(r,wr));return yr(e,wr)}function _s(r){const e=Na.hash(Pr(r,su));return yr(e,wr)}function r_(r){return Pr(`${r}`,H0)}function Eo(r){return Number(yr(r,H0))}function n_(r){const e=r_(typeof r.type<"u"?r.type:W0);if(Eo(e)===Li&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof r.senderPublicKey<"u"?Pr(r.senderPublicKey,wr):void 0,n=typeof r.iv<"u"?Pr(r.iv,wr):ys.randomBytes(ou),i=new Nl.ChaCha20Poly1305(Pr(r.symKey,wr)).seal(n,Pr(r.message,su));return s_({type:e,sealed:i,iv:n,senderPublicKey:t})}function i_(r){const e=new Nl.ChaCha20Poly1305(Pr(r.symKey,wr)),{sealed:t,iv:n}=Ua(r.encoded),i=e.open(n,t);if(i===null)throw new Error("Failed to decrypt");return yr(i,su)}function s_(r){if(Eo(r.type)===Li){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return yr(zl([r.type,r.senderPublicKey,r.iv,r.sealed]),iu)}return yr(zl([r.type,r.iv,r.sealed]),iu)}function Ua(r){const e=Pr(r,iu),t=e.slice(Q2,K0),n=K0;if(Eo(t)===Li){const u=n+au,f=u+ou,h=e.slice(n,u),m=e.slice(u,f),w=e.slice(f);return{type:t,sealed:w,iv:m,senderPublicKey:h}}const i=n+ou,a=e.slice(n,i),c=e.slice(i);return{type:t,sealed:c,iv:a}}function o_(r,e){const t=Ua(r);return V0({type:Eo(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?yr(t.senderPublicKey,wr):void 0,receiverPublicKey:e?.receiverPublicKey})}function V0(r){const e=r?.type||W0;if(e===Li){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 G0(r){return r.type===Li&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}var a_=Object.defineProperty,Y0=Object.getOwnPropertySymbols,c_=Object.prototype.hasOwnProperty,l_=Object.prototype.propertyIsEnumerable,Z0=(r,e,t)=>e in r?a_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,J0=(r,e)=>{for(var t in e||(e={}))c_.call(e,t)&&Z0(r,t,e[t]);if(Y0)for(var t of Y0(e))l_.call(e,t)&&Z0(r,t,e[t]);return r};const u_="ReactNative",zr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},h_="js";function xo(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Es(){return!eu()&&!!tu()&&navigator.product===u_}function xs(){return!xo()&&!!tu()&&!!eu()}function Io(){return Es()?zr.reactNative:xo()?zr.node:xs()?zr.browser:zr.unknown}function f_(){var r;try{return Es()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(r=global.Application)==null?void 0:r.applicationId:void 0}catch{return}}function d_(r,e){let t=_o.parse(r);return t=J0(J0({},t),e),r=_o.stringify(t),r}function p_(){return j0()||{name:"",description:"",url:"",icons:[""]}}function g_(){if(Io()===zr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:t,Version:n}=global.Platform;return[t,n].join("-")}const r=Qb();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 m_(){var r;const e=Io();return e===zr.browser?[e,((r=U0())==null?void 0:r.host)||"unknown"].join(":"):e}function v_(r,e,t){const n=g_(),i=m_();return[[r,e].join("-"),[h_,t].join("-"),n,i].join("/")}function y_({protocol:r,version:e,relayUrl:t,sdkVersion:n,auth:i,projectId:a,useOnCloseEvent:c,bundleId:u}){const f=t.split("?"),h=v_(r,e,n),m={auth:i,ua:h,projectId:a,useOnCloseEvent:c||void 0,origin:u||void 0},w=d_(f[1]||"",m);return f[0]+"?"+w}function Mi(r,e){return r.filter(t=>e.includes(t)).length===r.length}function Q0(r){return Object.fromEntries(r.entries())}function X0(r){return new Map(Object.entries(r))}function Is(r=me.FIVE_MINUTES,e){const t=me.toMiliseconds(r||me.FIVE_MINUTES);let n,i,a;return{resolve:c=>{a&&n&&(clearTimeout(a),n(c))},reject:c=>{a&&i&&(clearTimeout(a),i(c))},done:()=>new Promise((c,u)=>{a=setTimeout(()=>{u(new Error(e))},t),n=c,i=u})}}function Do(r,e,t){return new Promise(async(n,i)=>{const a=setTimeout(()=>i(new Error(t)),e);try{const c=await r;n(c)}catch(c){i(c)}clearTimeout(a)})}function ep(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 w_(r){return ep("topic",r)}function b_(r){return ep("id",r)}function tp(r){const[e,t]=r.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")n.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))n.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return n}function Hr(r,e){return me.fromMiliseconds((e||Date.now())+me.toMiliseconds(r))}function ii(r){return Date.now()>=me.toMiliseconds(r)}function gt(r,e){return`${r}${e?`:${e}`:""}`}function lu(r=[],e=[]){return[...new Set([...r,...e])]}async function __({id:r,topic:e,wcDeepLink:t}){try{if(!t)return;const n=typeof t=="string"?JSON.parse(t):t;let i=n?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));const a=`${i}/wc?requestId=${r}&sessionTopic=${e}`,c=Io();c===zr.browser?a.startsWith("https://")?window.open(a,"_blank","noreferrer noopener"):window.open(a,"_self","noreferrer noopener"):c===zr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(a)}catch(n){console.error(n)}}async function E_(r,e){try{return await r.getItem(e)||(xs()?localStorage.getItem(e):void 0)}catch(t){console.error(t)}}const x_="irn";function uu(r){return r?.relay||{protocol:x_}}function ja(r){const e=G2[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var I_=Object.defineProperty,D_=Object.defineProperties,S_=Object.getOwnPropertyDescriptors,rp=Object.getOwnPropertySymbols,O_=Object.prototype.hasOwnProperty,C_=Object.prototype.propertyIsEnumerable,np=(r,e,t)=>e in r?I_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$_=(r,e)=>{for(var t in e||(e={}))O_.call(e,t)&&np(r,t,e[t]);if(rp)for(var t of rp(e))C_.call(e,t)&&np(r,t,e[t]);return r},A_=(r,e)=>D_(r,S_(e));function P_(r,e="-"){const t={},n="relay"+e;return Object.keys(r).forEach(i=>{if(i.startsWith(n)){const a=i.replace(n,""),c=r[i];t[a]=c}}),t}function ip(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,n=r.substring(0,e),i=r.substring(e+1,t).split("@"),a=typeof t<"u"?r.substring(t):"",c=_o.parse(a);return{protocol:n,topic:T_(i[0]),version:parseInt(i[1],10),symKey:c.symKey,relay:P_(c),expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function T_(r){return r.startsWith("//")?r.substring(2):r}function R_(r,e="-"){const t="relay",n={};return Object.keys(r).forEach(i=>{const a=t+e+i;r[i]&&(n[a]=r[i])}),n}function N_(r){return`${r.protocol}:${r.topic}@${r.version}?`+_o.stringify(A_($_({symKey:r.symKey},R_(r.relay)),{expiryTimestamp:r.expiryTimestamp}))}function Ds(r){const e=[];return r.forEach(t=>{const[n,i]=t.split(":");e.push(`${n}:${i}`)}),e}function L_(r){const e=[];return Object.values(r).forEach(t=>{e.push(...Ds(t.accounts))}),e}function M_(r,e){const t=[];return Object.values(r).forEach(n=>{Ds(n.accounts).includes(e)&&t.push(...n.methods)}),t}function U_(r,e){const t=[];return Object.values(r).forEach(n=>{Ds(n.accounts).includes(e)&&t.push(...n.events)}),t}function hu(r){return r.includes(":")}function So(r){return hu(r)?r.split(":")[0]:r}const j_={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}},F_={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 ue(r,e){const{message:t,code:n}=F_[r];return{message:e?`${t} ${e}`:t,code:n}}function xt(r,e){const{message:t,code:n}=j_[r];return{message:e?`${t} ${e}`:t,code:n}}function En(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function Oo(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function br(r){return typeof r>"u"}function ir(r,e){return e&&br(r)?!0:typeof r=="string"&&!!r.trim().length}function fu(r,e){return e&&br(r)?!0:typeof r=="number"&&!isNaN(r)}function B_(r,e){const{requiredNamespaces:t}=e,n=Object.keys(r.namespaces),i=Object.keys(t);let a=!0;return Mi(i,n)?(n.forEach(c=>{const{accounts:u,methods:f,events:h}=r.namespaces[c],m=Ds(u),w=t[c];(!Mi(z0(c,w),m)||!Mi(w.methods,f)||!Mi(w.events,h))&&(a=!1)}),a):!1}function Fa(r){return ir(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function k_(r){if(ir(r,!1)&&r.includes(":")){const e=r.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&Fa(t)}}return!1}function q_(r){if(ir(r,!1))try{return typeof new URL(r)<"u"}catch{return!1}return!1}function z_(r){var e;return(e=r?.proposer)==null?void 0:e.publicKey}function H_(r){return r?.topic}function W_(r,e){let t=null;return ir(r?.publicKey,!1)||(t=ue("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function sp(r){let e=!0;return En(r)?r.length&&(e=r.every(t=>ir(t,!1))):e=!1,e}function K_(r,e,t){let n=null;return En(e)&&e.length?e.forEach(i=>{n||Fa(i)||(n=xt("UNSUPPORTED_CHAINS",`${t}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Fa(r)||(n=xt("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"] }`)),n}function V_(r,e,t){let n=null;return Object.entries(r).forEach(([i,a])=>{if(n)return;const c=K_(i,z0(i,a),`${e} ${t}`);c&&(n=c)}),n}function G_(r,e){let t=null;return En(r)?r.forEach(n=>{t||k_(n)||(t=xt("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):t=xt("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function Y_(r,e){let t=null;return Object.values(r).forEach(n=>{if(t)return;const i=G_(n?.accounts,`${e} namespace`);i&&(t=i)}),t}function Z_(r,e){let t=null;return sp(r?.methods)?sp(r?.events)||(t=xt("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=xt("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function op(r,e){let t=null;return Object.values(r).forEach(n=>{if(t)return;const i=Z_(n,`${e}, namespace`);i&&(t=i)}),t}function J_(r,e,t){let n=null;if(r&&Oo(r)){const i=op(r,e);i&&(n=i);const a=V_(r,e,t);a&&(n=a)}else n=ue("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return n}function du(r,e){let t=null;if(r&&Oo(r)){const n=op(r,e);n&&(t=n);const i=Y_(r,e);i&&(t=i)}else t=ue("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function ap(r){return ir(r.protocol,!0)}function Q_(r,e){let t=!1;return e&&!r?t=!0:r&&En(r)&&r.length&&r.forEach(n=>{t=ap(n)}),t}function X_(r){return typeof r=="number"}function Tr(r){return typeof r<"u"&&typeof r!==null}function e3(r){return!(!r||typeof r!="object"||!r.code||!fu(r.code,!1)||!r.message||!ir(r.message,!1))}function t3(r){return!(br(r)||!ir(r.method,!1))}function r3(r){return!(br(r)||br(r.result)&&br(r.error)||!fu(r.id,!1)||!ir(r.jsonrpc,!1))}function n3(r){return!(br(r)||!ir(r.name,!1))}function cp(r,e){return!(!Fa(e)||!L_(r).includes(e))}function i3(r,e,t){return ir(t,!1)?M_(r,e).includes(t):!1}function s3(r,e,t){return ir(t,!1)?U_(r,e).includes(t):!1}function lp(r,e,t){let n=null;const i=o3(r),a=a3(e),c=Object.keys(i),u=Object.keys(a),f=up(Object.keys(r)),h=up(Object.keys(e)),m=f.filter(w=>!h.includes(w));return m.length&&(n=ue("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.
14
+ ***************************************************************************** */var Nh=function(t,e){return Nh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Nh(t,e)};function S3(t,e){Nh(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Rh=function(){return Rh=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Rh.apply(this,arguments)};function I3(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function D3(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(s=(i<3?c(s):i>3?c(e,r,s):c(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function C3(t,e){return function(r,n){e(r,n,t)}}function O3(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function P3(t,e,r,n){function i(s){return s instanceof r?s:new r(function(c){c(s)})}return new(r||(r=Promise))(function(s,c){function l(m){try{h(n.next(m))}catch(_){c(_)}}function f(m){try{h(n.throw(m))}catch(_){c(_)}}function h(m){m.done?s(m.value):i(m.value).then(l,f)}h((n=n.apply(t,e||[])).next())})}function M3(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=h[0]&2?i.return:h[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,h[1])).done)return s;switch(i=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){r.label=h[1];break}if(h[0]===6&&r.label<s[1]){r.label=s[1],s=h;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(h);break}s[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(m){h=[6,m],i=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function T3(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function $3(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Lh(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function s1(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(l){c={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return s}function N3(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(s1(arguments[e]));return t}function R3(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],c=0,l=s.length;c<l;c++,i++)n[i]=s[c];return n}function qa(t){return this instanceof qa?(this.v=t,this):new qa(t)}function L3(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(E){n[E]&&(i[E]=function(A){return new Promise(function(I,R){s.push([E,A,I,R])>1||l(E,A)})})}function l(E,A){try{f(n[E](A))}catch(I){_(s[0][3],I)}}function f(E){E.value instanceof qa?Promise.resolve(E.value.v).then(h,m):_(s[0][2],E)}function h(E){l("next",E)}function m(E){l("throw",E)}function _(E,A){E(A),s.shift(),s.length&&l(s[0][0],s[0][1])}}function B3(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(c){return(r=!r)?{value:qa(t[i](c)),done:i==="return"}:s?s(c):c}:s}}function U3(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Lh=="function"?Lh(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(c){return new Promise(function(l,f){c=t[s](c),i(l,f,c.done,c.value)})}}function i(s,c,l,f){Promise.resolve(f).then(function(h){s({value:h,done:l})},c)}}function F3(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function j3(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function k3(t){return t&&t.__esModule?t:{default:t}}function q3(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function z3(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var H3=Object.freeze({__proto__:null,__extends:S3,get __assign(){return Rh},__rest:I3,__decorate:D3,__param:C3,__metadata:O3,__awaiter:P3,__generator:M3,__createBinding:T3,__exportStar:$3,__values:Lh,__read:s1,__spread:N3,__spreadArrays:R3,__await:qa,__asyncGenerator:L3,__asyncDelegator:B3,__asyncValues:U3,__makeTemplateObject:F3,__importStar:j3,__importDefault:k3,__classPrivateFieldGet:q3,__classPrivateFieldSet:z3}),ll=Us(H3),Bh={},za={},o1;function K3(){if(o1)return za;o1=1,Object.defineProperty(za,"__esModule",{value:!0}),za.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return za.delay=t,za}var Fs={},Uh={},js={},a1;function W3(){return a1||(a1=1,Object.defineProperty(js,"__esModule",{value:!0}),js.ONE_THOUSAND=js.ONE_HUNDRED=void 0,js.ONE_HUNDRED=100,js.ONE_THOUSAND=1e3),js}var Fh={},c1;function V3(){return c1||(c1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(Fh)),Fh}var l1;function u1(){return l1||(l1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=ll;e.__exportStar(W3(),t),e.__exportStar(V3(),t)}(Uh)),Uh}var h1;function G3(){if(h1)return Fs;h1=1,Object.defineProperty(Fs,"__esModule",{value:!0}),Fs.fromMiliseconds=Fs.toMiliseconds=void 0;const t=u1();function e(n){return n*t.ONE_THOUSAND}Fs.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return Fs.fromMiliseconds=r,Fs}var f1;function Y3(){return f1||(f1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=ll;e.__exportStar(K3(),t),e.__exportStar(G3(),t)}(Bh)),Bh}var Bo={},d1;function J3(){if(d1)return Bo;d1=1,Object.defineProperty(Bo,"__esModule",{value:!0}),Bo.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return Bo.Watch=t,Bo.default=t,Bo}var jh={},Ha={},p1;function Q3(){if(p1)return Ha;p1=1,Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.IWatch=void 0;class t{}return Ha.IWatch=t,Ha}var g1;function Z3(){return g1||(g1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),ll.__exportStar(Q3(),t)}(jh)),jh}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=ll;e.__exportStar(Y3(),t),e.__exportStar(J3(),t),e.__exportStar(Z3(),t),e.__exportStar(u1(),t)})(_e);var Jt={};Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.getLocalStorage=Jt.getLocalStorageOrThrow=Jt.getCrypto=Jt.getCryptoOrThrow=m1=Jt.getLocation=Jt.getLocationOrThrow=qh=Jt.getNavigator=Jt.getNavigatorOrThrow=kh=Jt.getDocument=Jt.getDocumentOrThrow=Jt.getFromWindowOrThrow=Jt.getFromWindow=void 0;function ks(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Jt.getFromWindow=ks;function Uo(t){const e=ks(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Jt.getFromWindowOrThrow=Uo;function X3(){return Uo("document")}Jt.getDocumentOrThrow=X3;function e6(){return ks("document")}var kh=Jt.getDocument=e6;function t6(){return Uo("navigator")}Jt.getNavigatorOrThrow=t6;function r6(){return ks("navigator")}var qh=Jt.getNavigator=r6;function n6(){return Uo("location")}Jt.getLocationOrThrow=n6;function i6(){return ks("location")}var m1=Jt.getLocation=i6;function s6(){return Uo("crypto")}Jt.getCryptoOrThrow=s6;function o6(){return ks("crypto")}Jt.getCrypto=o6;function a6(){return Uo("localStorage")}Jt.getLocalStorageOrThrow=a6;function c6(){return ks("localStorage")}Jt.getLocalStorage=c6;var zh={};Object.defineProperty(zh,"__esModule",{value:!0});var v1=zh.getWindowMetadata=void 0;const y1=Jt;function l6(){let t,e;try{t=y1.getDocumentOrThrow(),e=y1.getLocationOrThrow()}catch{return null}function r(){const _=t.getElementsByTagName("link"),E=[];for(let A=0;A<_.length;A++){const I=_[A],R=I.getAttribute("rel");if(R&&R.toLowerCase().indexOf("icon")>-1){const W=I.getAttribute("href");if(W)if(W.toLowerCase().indexOf("https:")===-1&&W.toLowerCase().indexOf("http:")===-1&&W.indexOf("//")!==0){let Y=e.protocol+"//"+e.host;if(W.indexOf("/")===0)Y+=W;else{const F=e.pathname.split("/");F.pop();const z=F.join("/");Y+=z+"/"+W}E.push(Y)}else if(W.indexOf("//")===0){const Y=e.protocol+W;E.push(Y)}else E.push(W)}}return E}function n(..._){const E=t.getElementsByTagName("meta");for(let A=0;A<E.length;A++){const I=E[A],R=["itemprop","property","name"].map(W=>I.getAttribute(W)).filter(W=>W?_.includes(W):!1);if(R.length&&R){const W=I.getAttribute("content");if(W)return W}}return""}function i(){let _=n("name","og:site_name","og:title","twitter:title");return _||(_=t.title),_}function s(){return n("description","og:description","twitter:description","keywords")}const c=i(),l=s(),f=e.origin,h=r();return{description:l,url:f,icons:h,name:c}}v1=zh.getWindowMetadata=l6;var Ka={},u6=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),w1="%[a-f0-9]{2}",b1=new RegExp("("+w1+")|([^%]+?)","gi"),_1=new RegExp("("+w1+")+","gi");function Hh(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],Hh(r),Hh(n))}function h6(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(b1)||[],r=1;r<e.length;r++)t=Hh(e,r).join(""),e=t.match(b1)||[];return t}}function f6(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=_1.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var n=h6(r[0]);n!==r[0]&&(e[r[0]]=n)}r=_1.exec(t)}e["%C2"]="\uFFFD";for(var i=Object.keys(e),s=0;s<i.length;s++){var c=i[s];t=t.replace(new RegExp(c,"g"),e[c])}return t}var d6=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return f6(t)}},p6=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},g6=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s<n.length;s++){var c=n[s],l=t[c];(i?e.indexOf(c)!==-1:e(c,l,t))&&(r[c]=l)}return r};(function(t){const e=u6,r=d6,n=p6,i=g6,s=F=>F==null,c=Symbol("encodeFragmentIdentifier");function l(F){switch(F.arrayFormat){case"index":return z=>($,j)=>{const P=$.length;return j===void 0||F.skipNull&&j===null||F.skipEmptyString&&j===""?$:j===null?[...$,[m(z,F),"[",P,"]"].join("")]:[...$,[m(z,F),"[",m(P,F),"]=",m(j,F)].join("")]};case"bracket":return z=>($,j)=>j===void 0||F.skipNull&&j===null||F.skipEmptyString&&j===""?$:j===null?[...$,[m(z,F),"[]"].join("")]:[...$,[m(z,F),"[]=",m(j,F)].join("")];case"colon-list-separator":return z=>($,j)=>j===void 0||F.skipNull&&j===null||F.skipEmptyString&&j===""?$:j===null?[...$,[m(z,F),":list="].join("")]:[...$,[m(z,F),":list=",m(j,F)].join("")];case"comma":case"separator":case"bracket-separator":{const z=F.arrayFormat==="bracket-separator"?"[]=":"=";return $=>(j,P)=>P===void 0||F.skipNull&&P===null||F.skipEmptyString&&P===""?j:(P=P===null?"":P,j.length===0?[[m($,F),z,m(P,F)].join("")]:[[j,m(P,F)].join(F.arrayFormatSeparator)])}default:return z=>($,j)=>j===void 0||F.skipNull&&j===null||F.skipEmptyString&&j===""?$:j===null?[...$,m(z,F)]:[...$,[m(z,F),"=",m(j,F)].join("")]}}function f(F){let z;switch(F.arrayFormat){case"index":return($,j,P)=>{if(z=/\[(\d*)\]$/.exec($),$=$.replace(/\[\d*\]$/,""),!z){P[$]=j;return}P[$]===void 0&&(P[$]={}),P[$][z[1]]=j};case"bracket":return($,j,P)=>{if(z=/(\[\])$/.exec($),$=$.replace(/\[\]$/,""),!z){P[$]=j;return}if(P[$]===void 0){P[$]=[j];return}P[$]=[].concat(P[$],j)};case"colon-list-separator":return($,j,P)=>{if(z=/(:list)$/.exec($),$=$.replace(/:list$/,""),!z){P[$]=j;return}if(P[$]===void 0){P[$]=[j];return}P[$]=[].concat(P[$],j)};case"comma":case"separator":return($,j,P)=>{const g=typeof j=="string"&&j.includes(F.arrayFormatSeparator),C=typeof j=="string"&&!g&&_(j,F).includes(F.arrayFormatSeparator);j=C?_(j,F):j;const Z=g||C?j.split(F.arrayFormatSeparator).map(J=>_(J,F)):j===null?j:_(j,F);P[$]=Z};case"bracket-separator":return($,j,P)=>{const g=/(\[\])$/.test($);if($=$.replace(/\[\]$/,""),!g){P[$]=j&&_(j,F);return}const C=j===null?[]:j.split(F.arrayFormatSeparator).map(Z=>_(Z,F));if(P[$]===void 0){P[$]=C;return}P[$]=[].concat(P[$],C)};default:return($,j,P)=>{if(P[$]===void 0){P[$]=j;return}P[$]=[].concat(P[$],j)}}}function h(F){if(typeof F!="string"||F.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function m(F,z){return z.encode?z.strict?e(F):encodeURIComponent(F):F}function _(F,z){return z.decode?r(F):F}function E(F){return Array.isArray(F)?F.sort():typeof F=="object"?E(Object.keys(F)).sort((z,$)=>Number(z)-Number($)).map(z=>F[z]):F}function A(F){const z=F.indexOf("#");return z!==-1&&(F=F.slice(0,z)),F}function I(F){let z="";const $=F.indexOf("#");return $!==-1&&(z=F.slice($)),z}function R(F){F=A(F);const z=F.indexOf("?");return z===-1?"":F.slice(z+1)}function W(F,z){return z.parseNumbers&&!Number.isNaN(Number(F))&&typeof F=="string"&&F.trim()!==""?F=Number(F):z.parseBooleans&&F!==null&&(F.toLowerCase()==="true"||F.toLowerCase()==="false")&&(F=F.toLowerCase()==="true"),F}function Y(F,z){z=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},z),h(z.arrayFormatSeparator);const $=f(z),j=Object.create(null);if(typeof F!="string"||(F=F.trim().replace(/^[?#&]/,""),!F))return j;for(const P of F.split("&")){if(P==="")continue;let[g,C]=n(z.decode?P.replace(/\+/g," "):P,"=");C=C===void 0?null:["comma","separator","bracket-separator"].includes(z.arrayFormat)?C:_(C,z),$(_(g,z),C,j)}for(const P of Object.keys(j)){const g=j[P];if(typeof g=="object"&&g!==null)for(const C of Object.keys(g))g[C]=W(g[C],z);else j[P]=W(g,z)}return z.sort===!1?j:(z.sort===!0?Object.keys(j).sort():Object.keys(j).sort(z.sort)).reduce((P,g)=>{const C=j[g];return C&&typeof C=="object"&&!Array.isArray(C)?P[g]=E(C):P[g]=C,P},Object.create(null))}t.extract=R,t.parse=Y,t.stringify=(F,z)=>{if(!F)return"";z=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},z),h(z.arrayFormatSeparator);const $=C=>z.skipNull&&s(F[C])||z.skipEmptyString&&F[C]==="",j=l(z),P={};for(const C of Object.keys(F))$(C)||(P[C]=F[C]);const g=Object.keys(P);return z.sort!==!1&&g.sort(z.sort),g.map(C=>{const Z=F[C];return Z===void 0?"":Z===null?m(C,z):Array.isArray(Z)?Z.length===0&&z.arrayFormat==="bracket-separator"?m(C,z)+"[]":Z.reduce(j(C),[]).join("&"):m(C,z)+"="+m(Z,z)}).filter(C=>C.length>0).join("&")},t.parseUrl=(F,z)=>{z=Object.assign({decode:!0},z);const[$,j]=n(F,"#");return Object.assign({url:$.split("?")[0]||"",query:Y(R(F),z)},z&&z.parseFragmentIdentifier&&j?{fragmentIdentifier:_(j,z)}:{})},t.stringifyUrl=(F,z)=>{z=Object.assign({encode:!0,strict:!0,[c]:!0},z);const $=A(F.url).split("?")[0]||"",j=t.extract(F.url),P=t.parse(j,{sort:!1}),g=Object.assign(P,F.query);let C=t.stringify(g,z);C&&(C=`?${C}`);let Z=I(F.url);return F.fragmentIdentifier&&(Z=`#${z[c]?m(F.fragmentIdentifier,z):F.fragmentIdentifier}`),`${$}${C}${Z}`},t.pick=(F,z,$)=>{$=Object.assign({parseFragmentIdentifier:!0,[c]:!1},$);const{url:j,query:P,fragmentIdentifier:g}=t.parseUrl(F,$);return t.stringifyUrl({url:j,query:i(P,z),fragmentIdentifier:g},$)},t.exclude=(F,z,$)=>{const j=Array.isArray(z)?P=>!z.includes(P):(P,g)=>!z(P,g);return t.pick(F,j,$)}})(Ka);var Kh={},ul={},ct={},E1={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(l,f){var h=l>>>16&65535,m=l&65535,_=f>>>16&65535,E=f&65535;return m*E+(h*E+m*_<<16>>>0)|0}t.mul=Math.imul||e;function r(l,f){return l+f|0}t.add=r;function n(l,f){return l-f|0}t.sub=n;function i(l,f){return l<<f|l>>>32-f}t.rotl=i;function s(l,f){return l<<32-f|l>>>f}t.rotr=s;function c(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l}t.isInteger=Number.isInteger||c,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(l){return t.isInteger(l)&&l>=-t.MAX_SAFE_INTEGER&&l<=t.MAX_SAFE_INTEGER}})(E1),Object.defineProperty(ct,"__esModule",{value:!0});var A1=E1;function m6(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}ct.readInt16BE=m6;function v6(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}ct.readUint16BE=v6;function y6(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}ct.readInt16LE=y6;function w6(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}ct.readUint16LE=w6;function x1(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}ct.writeUint16BE=x1,ct.writeInt16BE=x1;function S1(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}ct.writeUint16LE=S1,ct.writeInt16LE=S1;function Wh(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}ct.readInt32BE=Wh;function Vh(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}ct.readUint32BE=Vh;function Gh(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}ct.readInt32LE=Gh;function Yh(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}ct.readUint32LE=Yh;function hl(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}ct.writeUint32BE=hl,ct.writeInt32BE=hl;function fl(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}ct.writeUint32LE=fl,ct.writeInt32LE=fl;function b6(t,e){e===void 0&&(e=0);var r=Wh(t,e),n=Wh(t,e+4);return r*4294967296+n-(n>>31)*4294967296}ct.readInt64BE=b6;function _6(t,e){e===void 0&&(e=0);var r=Vh(t,e),n=Vh(t,e+4);return r*4294967296+n}ct.readUint64BE=_6;function E6(t,e){e===void 0&&(e=0);var r=Gh(t,e),n=Gh(t,e+4);return n*4294967296+r-(r>>31)*4294967296}ct.readInt64LE=E6;function A6(t,e){e===void 0&&(e=0);var r=Yh(t,e),n=Yh(t,e+4);return n*4294967296+r}ct.readUint64LE=A6;function I1(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),hl(t/4294967296>>>0,e,r),hl(t>>>0,e,r+4),e}ct.writeUint64BE=I1,ct.writeInt64BE=I1;function D1(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),fl(t>>>0,e,r),fl(t/4294967296>>>0,e,r+4),e}ct.writeUint64LE=D1,ct.writeInt64LE=D1;function x6(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}ct.readUintBE=x6;function S6(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s<r+t/8;s++)n+=e[s]*i,i*=256;return n}ct.readUintLE=S6;function I6(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!A1.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var i=1,s=t/8+n-1;s>=n;s--)r[s]=e/i&255,i*=256;return r}ct.writeUintBE=I6;function D6(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!A1.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s<n+t/8;s++)r[s]=e/i&255,i*=256;return r}ct.writeUintLE=D6;function C6(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e)}ct.readFloat32BE=C6;function O6(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e,!0)}ct.readFloat32LE=O6;function P6(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e)}ct.readFloat64BE=P6;function M6(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e,!0)}ct.readFloat64LE=M6;function T6(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(r,t),e}ct.writeFloat32BE=T6;function $6(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(r,t,!0),e}ct.writeFloat32LE=$6;function N6(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(r,t),e}ct.writeFloat64BE=N6;function R6(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(r,t,!0),e}ct.writeFloat64LE=R6;var fn={};Object.defineProperty(fn,"__esModule",{value:!0});function L6(t){for(var e=0;e<t.length;e++)t[e]=0;return t}fn.wipe=L6,Object.defineProperty(ul,"__esModule",{value:!0});var $r=ct,Jh=fn,B6=20;function U6(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,c=1797285236,l=r[3]<<24|r[2]<<16|r[1]<<8|r[0],f=r[7]<<24|r[6]<<16|r[5]<<8|r[4],h=r[11]<<24|r[10]<<16|r[9]<<8|r[8],m=r[15]<<24|r[14]<<16|r[13]<<8|r[12],_=r[19]<<24|r[18]<<16|r[17]<<8|r[16],E=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],I=r[31]<<24|r[30]<<16|r[29]<<8|r[28],R=e[3]<<24|e[2]<<16|e[1]<<8|e[0],W=e[7]<<24|e[6]<<16|e[5]<<8|e[4],Y=e[11]<<24|e[10]<<16|e[9]<<8|e[8],F=e[15]<<24|e[14]<<16|e[13]<<8|e[12],z=n,$=i,j=s,P=c,g=l,C=f,Z=h,J=m,te=_,ae=E,p=A,d=I,b=R,D=W,M=Y,N=F,U=0;U<B6;U+=2)z=z+g|0,b^=z,b=b>>>32-16|b<<16,te=te+b|0,g^=te,g=g>>>32-12|g<<12,$=$+C|0,D^=$,D=D>>>32-16|D<<16,ae=ae+D|0,C^=ae,C=C>>>32-12|C<<12,j=j+Z|0,M^=j,M=M>>>32-16|M<<16,p=p+M|0,Z^=p,Z=Z>>>32-12|Z<<12,P=P+J|0,N^=P,N=N>>>32-16|N<<16,d=d+N|0,J^=d,J=J>>>32-12|J<<12,j=j+Z|0,M^=j,M=M>>>32-8|M<<8,p=p+M|0,Z^=p,Z=Z>>>32-7|Z<<7,P=P+J|0,N^=P,N=N>>>32-8|N<<8,d=d+N|0,J^=d,J=J>>>32-7|J<<7,$=$+C|0,D^=$,D=D>>>32-8|D<<8,ae=ae+D|0,C^=ae,C=C>>>32-7|C<<7,z=z+g|0,b^=z,b=b>>>32-8|b<<8,te=te+b|0,g^=te,g=g>>>32-7|g<<7,z=z+C|0,N^=z,N=N>>>32-16|N<<16,p=p+N|0,C^=p,C=C>>>32-12|C<<12,$=$+Z|0,b^=$,b=b>>>32-16|b<<16,d=d+b|0,Z^=d,Z=Z>>>32-12|Z<<12,j=j+J|0,D^=j,D=D>>>32-16|D<<16,te=te+D|0,J^=te,J=J>>>32-12|J<<12,P=P+g|0,M^=P,M=M>>>32-16|M<<16,ae=ae+M|0,g^=ae,g=g>>>32-12|g<<12,j=j+J|0,D^=j,D=D>>>32-8|D<<8,te=te+D|0,J^=te,J=J>>>32-7|J<<7,P=P+g|0,M^=P,M=M>>>32-8|M<<8,ae=ae+M|0,g^=ae,g=g>>>32-7|g<<7,$=$+Z|0,b^=$,b=b>>>32-8|b<<8,d=d+b|0,Z^=d,Z=Z>>>32-7|Z<<7,z=z+C|0,N^=z,N=N>>>32-8|N<<8,p=p+N|0,C^=p,C=C>>>32-7|C<<7;$r.writeUint32LE(z+n|0,t,0),$r.writeUint32LE($+i|0,t,4),$r.writeUint32LE(j+s|0,t,8),$r.writeUint32LE(P+c|0,t,12),$r.writeUint32LE(g+l|0,t,16),$r.writeUint32LE(C+f|0,t,20),$r.writeUint32LE(Z+h|0,t,24),$r.writeUint32LE(J+m|0,t,28),$r.writeUint32LE(te+_|0,t,32),$r.writeUint32LE(ae+E|0,t,36),$r.writeUint32LE(p+A|0,t,40),$r.writeUint32LE(d+I|0,t,44),$r.writeUint32LE(b+R|0,t,48),$r.writeUint32LE(D+W|0,t,52),$r.writeUint32LE(M+Y|0,t,56),$r.writeUint32LE(N+F|0,t,60)}function C1(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<r.length)throw new Error("ChaCha: destination is shorter than source");var s,c;if(i===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),c=s.length-e.length,s.set(e,c)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,c=i}for(var l=new Uint8Array(64),f=0;f<r.length;f+=64){U6(l,s,t);for(var h=f;h<f+64&&h<r.length;h++)n[h]=r[h]^l[h-f];j6(s,0,c)}return Jh.wipe(l),i===0&&Jh.wipe(s),n}ul.streamXOR=C1;function F6(t,e,r,n){return n===void 0&&(n=0),Jh.wipe(r),C1(t,e,r,r,n)}ul.stream=F6;function j6(t,e,r){for(var n=1;r--;)n=n+(t[e]&255)|0,t[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var O1={},ns={};Object.defineProperty(ns,"__esModule",{value:!0});function k6(t,e,r){return~(t-1)&e|t-1&r}ns.select=k6;function q6(t,e){return(t|0)-(e|0)-1>>>31&1}ns.lessOrEqual=q6;function P1(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n<t.length;n++)r|=t[n]^e[n];return 1&r-1>>>8}ns.compare=P1;function z6(t,e){return t.length===0||e.length===0?!1:P1(t,e)!==0}ns.equal=z6,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ns,r=fn;t.DIGEST_LENGTH=16;var n=function(){function c(l){this.digestLength=t.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 f=l[0]|l[1]<<8;this._r[0]=f&8191;var h=l[2]|l[3]<<8;this._r[1]=(f>>>13|h<<3)&8191;var m=l[4]|l[5]<<8;this._r[2]=(h>>>10|m<<6)&7939;var _=l[6]|l[7]<<8;this._r[3]=(m>>>7|_<<9)&8191;var E=l[8]|l[9]<<8;this._r[4]=(_>>>4|E<<12)&255,this._r[5]=E>>>1&8190;var A=l[10]|l[11]<<8;this._r[6]=(E>>>14|A<<2)&8191;var I=l[12]|l[13]<<8;this._r[7]=(A>>>11|I<<5)&8065;var R=l[14]|l[15]<<8;this._r[8]=(I>>>8|R<<8)&8191,this._r[9]=R>>>5&127,this._pad[0]=l[16]|l[17]<<8,this._pad[1]=l[18]|l[19]<<8,this._pad[2]=l[20]|l[21]<<8,this._pad[3]=l[22]|l[23]<<8,this._pad[4]=l[24]|l[25]<<8,this._pad[5]=l[26]|l[27]<<8,this._pad[6]=l[28]|l[29]<<8,this._pad[7]=l[30]|l[31]<<8}return c.prototype._blocks=function(l,f,h){for(var m=this._fin?0:2048,_=this._h[0],E=this._h[1],A=this._h[2],I=this._h[3],R=this._h[4],W=this._h[5],Y=this._h[6],F=this._h[7],z=this._h[8],$=this._h[9],j=this._r[0],P=this._r[1],g=this._r[2],C=this._r[3],Z=this._r[4],J=this._r[5],te=this._r[6],ae=this._r[7],p=this._r[8],d=this._r[9];h>=16;){var b=l[f+0]|l[f+1]<<8;_+=b&8191;var D=l[f+2]|l[f+3]<<8;E+=(b>>>13|D<<3)&8191;var M=l[f+4]|l[f+5]<<8;A+=(D>>>10|M<<6)&8191;var N=l[f+6]|l[f+7]<<8;I+=(M>>>7|N<<9)&8191;var U=l[f+8]|l[f+9]<<8;R+=(N>>>4|U<<12)&8191,W+=U>>>1&8191;var O=l[f+10]|l[f+11]<<8;Y+=(U>>>14|O<<2)&8191;var v=l[f+12]|l[f+13]<<8;F+=(O>>>11|v<<5)&8191;var L=l[f+14]|l[f+15]<<8;z+=(v>>>8|L<<8)&8191,$+=L>>>5|m;var oe=0,de=oe;de+=_*j,de+=E*(5*d),de+=A*(5*p),de+=I*(5*ae),de+=R*(5*te),oe=de>>>13,de&=8191,de+=W*(5*J),de+=Y*(5*Z),de+=F*(5*C),de+=z*(5*g),de+=$*(5*P),oe+=de>>>13,de&=8191;var x=oe;x+=_*P,x+=E*j,x+=A*(5*d),x+=I*(5*p),x+=R*(5*ae),oe=x>>>13,x&=8191,x+=W*(5*te),x+=Y*(5*J),x+=F*(5*Z),x+=z*(5*C),x+=$*(5*g),oe+=x>>>13,x&=8191;var ne=oe;ne+=_*g,ne+=E*P,ne+=A*j,ne+=I*(5*d),ne+=R*(5*p),oe=ne>>>13,ne&=8191,ne+=W*(5*ae),ne+=Y*(5*te),ne+=F*(5*J),ne+=z*(5*Z),ne+=$*(5*C),oe+=ne>>>13,ne&=8191;var q=oe;q+=_*C,q+=E*g,q+=A*P,q+=I*j,q+=R*(5*d),oe=q>>>13,q&=8191,q+=W*(5*p),q+=Y*(5*ae),q+=F*(5*te),q+=z*(5*J),q+=$*(5*Z),oe+=q>>>13,q&=8191;var H=oe;H+=_*Z,H+=E*C,H+=A*g,H+=I*P,H+=R*j,oe=H>>>13,H&=8191,H+=W*(5*d),H+=Y*(5*p),H+=F*(5*ae),H+=z*(5*te),H+=$*(5*J),oe+=H>>>13,H&=8191;var V=oe;V+=_*J,V+=E*Z,V+=A*C,V+=I*g,V+=R*P,oe=V>>>13,V&=8191,V+=W*j,V+=Y*(5*d),V+=F*(5*p),V+=z*(5*ae),V+=$*(5*te),oe+=V>>>13,V&=8191;var y=oe;y+=_*te,y+=E*J,y+=A*Z,y+=I*C,y+=R*g,oe=y>>>13,y&=8191,y+=W*P,y+=Y*j,y+=F*(5*d),y+=z*(5*p),y+=$*(5*ae),oe+=y>>>13,y&=8191;var k=oe;k+=_*ae,k+=E*te,k+=A*J,k+=I*Z,k+=R*C,oe=k>>>13,k&=8191,k+=W*g,k+=Y*P,k+=F*j,k+=z*(5*d),k+=$*(5*p),oe+=k>>>13,k&=8191;var ie=oe;ie+=_*p,ie+=E*ae,ie+=A*te,ie+=I*J,ie+=R*Z,oe=ie>>>13,ie&=8191,ie+=W*C,ie+=Y*g,ie+=F*P,ie+=z*j,ie+=$*(5*d),oe+=ie>>>13,ie&=8191;var fe=oe;fe+=_*d,fe+=E*p,fe+=A*ae,fe+=I*te,fe+=R*J,oe=fe>>>13,fe&=8191,fe+=W*Z,fe+=Y*C,fe+=F*g,fe+=z*P,fe+=$*j,oe+=fe>>>13,fe&=8191,oe=(oe<<2)+oe|0,oe=oe+de|0,de=oe&8191,oe=oe>>>13,x+=oe,_=de,E=x,A=ne,I=q,R=H,W=V,Y=y,F=k,z=ie,$=fe,f+=16,h-=16}this._h[0]=_,this._h[1]=E,this._h[2]=A,this._h[3]=I,this._h[4]=R,this._h[5]=W,this._h[6]=Y,this._h[7]=F,this._h[8]=z,this._h[9]=$},c.prototype.finish=function(l,f){f===void 0&&(f=0);var h=new Uint16Array(10),m,_,E,A;if(this._leftover){for(A=this._leftover,this._buffer[A++]=1;A<16;A++)this._buffer[A]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(m=this._h[1]>>>13,this._h[1]&=8191,A=2;A<10;A++)this._h[A]+=m,m=this._h[A]>>>13,this._h[A]&=8191;for(this._h[0]+=m*5,m=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=m,m=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=m,h[0]=this._h[0]+5,m=h[0]>>>13,h[0]&=8191,A=1;A<10;A++)h[A]=this._h[A]+m,m=h[A]>>>13,h[A]&=8191;for(h[9]-=8192,_=(m^1)-1,A=0;A<10;A++)h[A]&=_;for(_=~_,A=0;A<10;A++)this._h[A]=this._h[A]&_|h[A];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,E=this._h[0]+this._pad[0],this._h[0]=E&65535,A=1;A<8;A++)E=(this._h[A]+this._pad[A]|0)+(E>>>16)|0,this._h[A]=E&65535;return l[f+0]=this._h[0]>>>0,l[f+1]=this._h[0]>>>8,l[f+2]=this._h[1]>>>0,l[f+3]=this._h[1]>>>8,l[f+4]=this._h[2]>>>0,l[f+5]=this._h[2]>>>8,l[f+6]=this._h[3]>>>0,l[f+7]=this._h[3]>>>8,l[f+8]=this._h[4]>>>0,l[f+9]=this._h[4]>>>8,l[f+10]=this._h[5]>>>0,l[f+11]=this._h[5]>>>8,l[f+12]=this._h[6]>>>0,l[f+13]=this._h[6]>>>8,l[f+14]=this._h[7]>>>0,l[f+15]=this._h[7]>>>8,this._finished=!0,this},c.prototype.update=function(l){var f=0,h=l.length,m;if(this._leftover){m=16-this._leftover,m>h&&(m=h);for(var _=0;_<m;_++)this._buffer[this._leftover+_]=l[f+_];if(h-=m,f+=m,this._leftover+=m,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(h>=16&&(m=h-h%16,this._blocks(l,f,m),f+=m,h-=m),h){for(var _=0;_<h;_++)this._buffer[this._leftover+_]=l[f+_];this._leftover+=h}return this},c.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var l=new Uint8Array(16);return this.finish(l),l},c.prototype.clean=function(){return r.wipe(this._buffer),r.wipe(this._r),r.wipe(this._h),r.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},c}();t.Poly1305=n;function i(c,l){var f=new n(c);f.update(l);var h=f.digest();return f.clean(),h}t.oneTimeAuth=i;function s(c,l){return c.length!==t.DIGEST_LENGTH||l.length!==t.DIGEST_LENGTH?!1:e.equal(c,l)}t.equal=s}(O1),function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ul,r=O1,n=fn,i=ct,s=ns;t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var c=new Uint8Array(16),l=function(){function f(h){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,h.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(h)}return f.prototype.seal=function(h,m,_,E){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var A=new Uint8Array(16);A.set(h,A.length-h.length);var I=new Uint8Array(32);e.stream(this._key,A,I,4);var R=m.length+this.tagLength,W;if(E){if(E.length!==R)throw new Error("ChaCha20Poly1305: incorrect destination length");W=E}else W=new Uint8Array(R);return e.streamXOR(this._key,A,m,W,4),this._authenticate(W.subarray(W.length-this.tagLength,W.length),I,W.subarray(0,W.length-this.tagLength),_),n.wipe(A),W},f.prototype.open=function(h,m,_,E){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(m.length<this.tagLength)return null;var A=new Uint8Array(16);A.set(h,A.length-h.length);var I=new Uint8Array(32);e.stream(this._key,A,I,4);var R=new Uint8Array(this.tagLength);if(this._authenticate(R,I,m.subarray(0,m.length-this.tagLength),_),!s.equal(R,m.subarray(m.length-this.tagLength,m.length)))return null;var W=m.length-this.tagLength,Y;if(E){if(E.length!==W)throw new Error("ChaCha20Poly1305: incorrect destination length");Y=E}else Y=new Uint8Array(W);return e.streamXOR(this._key,A,m.subarray(0,m.length-this.tagLength),Y,4),n.wipe(A),Y},f.prototype.clean=function(){return n.wipe(this._key),this},f.prototype._authenticate=function(h,m,_,E){var A=new r.Poly1305(m);E&&(A.update(E),E.length%16>0&&A.update(c.subarray(E.length%16))),A.update(_),_.length%16>0&&A.update(c.subarray(_.length%16));var I=new Uint8Array(8);E&&i.writeUint64LE(E.length,I),A.update(I),i.writeUint64LE(_.length,I),A.update(I);for(var R=A.digest(),W=0;W<R.length;W++)h[W]=R[W];A.clean(),n.wipe(R),n.wipe(I)},f}();t.ChaCha20Poly1305=l}(Kh);var M1={},Wa={},Qh={};Object.defineProperty(Qh,"__esModule",{value:!0});function H6(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}Qh.isSerializableHash=H6,Object.defineProperty(Wa,"__esModule",{value:!0});var ci=Qh,K6=ns,W6=fn,T1=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i<n.length;i++)n[i]^=54;this._inner.update(n);for(var i=0;i<n.length;i++)n[i]^=106;this._outer.update(n),ci.isSerializableHash(this._inner)&&ci.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),W6.wipe(n)}return t.prototype.reset=function(){if(!ci.isSerializableHash(this._inner)||!ci.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},t.prototype.clean=function(){ci.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),ci.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(e){return this._inner.update(e),this},t.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)},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype.saveState=function(){if(!ci.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(e){if(!ci.isSerializableHash(this._inner)||!ci.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},t.prototype.cleanSavedState=function(e){if(!ci.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},t}();Wa.HMAC=T1;function V6(t,e,r){var n=new T1(t,e);n.update(r);var i=n.digest();return n.clean(),i}Wa.hmac=V6,Wa.equal=K6.equal,Object.defineProperty(M1,"__esModule",{value:!0});var $1=Wa,N1=fn,G6=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=$1.hmac(this._hash,n,r);this._hmac=new $1.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.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},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n<r.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),r[n]=this._buffer[this._bufpos++];return r},t.prototype.clean=function(){this._hmac.clean(),N1.wipe(this._buffer),N1.wipe(this._counter),this._bufpos=0},t}(),Y6=M1.HKDF=G6,Fo={},dl={},pl={};Object.defineProperty(pl,"__esModule",{value:!0}),pl.BrowserRandomSource=void 0;const R1=65536;class J6{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 r=new Uint8Array(e);for(let n=0;n<r.length;n+=R1)this._crypto.getRandomValues(r.subarray(n,n+Math.min(r.length-n,R1)));return r}}pl.BrowserRandomSource=J6;function Q6(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var gl={},Z6={},X6=Object.freeze({__proto__:null,default:Z6}),e5=Us(X6);Object.defineProperty(gl,"__esModule",{value:!0}),gl.NodeRandomSource=void 0;const t5=fn;class r5{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Q6<"u"){const e=e5;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 r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(e);for(let i=0;i<n.length;i++)n[i]=r[i];return(0,t5.wipe)(r),n}}gl.NodeRandomSource=r5,Object.defineProperty(dl,"__esModule",{value:!0}),dl.SystemRandomSource=void 0;const n5=pl,i5=gl;class s5{constructor(){if(this.isAvailable=!1,this.name="",this._source=new n5.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new i5.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)}}dl.SystemRandomSource=s5,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=dl,r=ct,n=fn;t.defaultRandomSource=new e.SystemRandomSource;function i(h,m=t.defaultRandomSource){return m.randomBytes(h)}t.randomBytes=i;function s(h=t.defaultRandomSource){const m=i(4,h),_=(0,r.readUint32LE)(m);return(0,n.wipe)(m),_}t.randomUint32=s;const c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function l(h,m=c,_=t.defaultRandomSource){if(m.length<2)throw new Error("randomString charset is too short");if(m.length>256)throw new Error("randomString charset is too long");let E="";const A=m.length,I=256-256%A;for(;h>0;){const R=i(Math.ceil(h*256/I),_);for(let W=0;W<R.length&&h>0;W++){const Y=R[W];Y<I&&(E+=m.charAt(Y%A),h--)}(0,n.wipe)(R)}return E}t.randomString=l;function f(h,m=c,_=t.defaultRandomSource){const E=Math.ceil(h/(Math.log(m.length)/Math.LN2));return l(E,m,_)}t.randomStringForEntropy=f}(Fo);var ml={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ct,r=fn;t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var n=function(){function l(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.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 l.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},l.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},l.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._temp),this.reset()},l.prototype.update=function(f,h){if(h===void 0&&(h=f.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var m=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&h>0;)this._buffer[this._bufferLength++]=f[m++],h--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(m=s(this._temp,this._state,f,m,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=f[m++],h--;return this},l.prototype.finish=function(f){if(!this._finished){var h=this._bytesHashed,m=this._bufferLength,_=h/536870912|0,E=h<<3,A=h%64<56?64:128;this._buffer[m]=128;for(var I=m+1;I<A-8;I++)this._buffer[I]=0;e.writeUint32BE(_,this._buffer,A-8),e.writeUint32BE(E,this._buffer,A-4),s(this._temp,this._state,this._buffer,0,A),this._finished=!0}for(var I=0;I<this.digestLength/4;I++)e.writeUint32BE(this._state[I],f,I*4);return this},l.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},l.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}},l.prototype.restoreState=function(f){return this._state.set(f.state),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},l.prototype.cleanSavedState=function(f){r.wipe(f.state),f.buffer&&r.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},l}();t.SHA256=n;var i=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 s(l,f,h,m,_){for(;_>=64;){for(var E=f[0],A=f[1],I=f[2],R=f[3],W=f[4],Y=f[5],F=f[6],z=f[7],$=0;$<16;$++){var j=m+$*4;l[$]=e.readUint32BE(h,j)}for(var $=16;$<64;$++){var P=l[$-2],g=(P>>>17|P<<32-17)^(P>>>19|P<<32-19)^P>>>10;P=l[$-15];var C=(P>>>7|P<<32-7)^(P>>>18|P<<32-18)^P>>>3;l[$]=(g+l[$-7]|0)+(C+l[$-16]|0)}for(var $=0;$<64;$++){var g=(((W>>>6|W<<26)^(W>>>11|W<<21)^(W>>>25|W<<7))+(W&Y^~W&F)|0)+(z+(i[$]+l[$]|0)|0)|0,C=((E>>>2|E<<32-2)^(E>>>13|E<<32-13)^(E>>>22|E<<32-22))+(E&A^E&I^A&I)|0;z=F,F=Y,Y=W,W=R+g|0,R=I,I=A,A=E,E=g+C|0}f[0]+=E,f[1]+=A,f[2]+=I,f[3]+=R,f[4]+=W,f[5]+=Y,f[6]+=F,f[7]+=z,m+=64,_-=64}return m}function c(l){var f=new n;f.update(l);var h=f.digest();return f.clean(),h}t.hash=c})(ml);var Zh={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=Fo,r=fn;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n($){const j=new Float64Array(16);if($)for(let P=0;P<$.length;P++)j[P]=$[P];return j}const i=new Uint8Array(32);i[0]=9;const s=n([56129,1]);function c($){let j=1;for(let P=0;P<16;P++){let g=$[P]+j+65535;j=Math.floor(g/65536),$[P]=g-j*65536}$[0]+=j-1+37*(j-1)}function l($,j,P){const g=~(P-1);for(let C=0;C<16;C++){const Z=g&($[C]^j[C]);$[C]^=Z,j[C]^=Z}}function f($,j){const P=n(),g=n();for(let C=0;C<16;C++)g[C]=j[C];c(g),c(g),c(g);for(let C=0;C<2;C++){P[0]=g[0]-65517;for(let J=1;J<15;J++)P[J]=g[J]-65535-(P[J-1]>>16&1),P[J-1]&=65535;P[15]=g[15]-32767-(P[14]>>16&1);const Z=P[15]>>16&1;P[14]&=65535,l(g,P,1-Z)}for(let C=0;C<16;C++)$[2*C]=g[C]&255,$[2*C+1]=g[C]>>8}function h($,j){for(let P=0;P<16;P++)$[P]=j[2*P]+(j[2*P+1]<<8);$[15]&=32767}function m($,j,P){for(let g=0;g<16;g++)$[g]=j[g]+P[g]}function _($,j,P){for(let g=0;g<16;g++)$[g]=j[g]-P[g]}function E($,j,P){let g,C,Z=0,J=0,te=0,ae=0,p=0,d=0,b=0,D=0,M=0,N=0,U=0,O=0,v=0,L=0,oe=0,de=0,x=0,ne=0,q=0,H=0,V=0,y=0,k=0,ie=0,fe=0,ue=0,Oe=0,Me=0,Ie=0,Pt=0,ze=0,Ce=P[0],Fe=P[1],Ee=P[2],Ae=P[3],Ge=P[4],we=P[5],xe=P[6],Be=P[7],be=P[8],Pe=P[9],je=P[10],Te=P[11],$e=P[12],lt=P[13],Re=P[14],Ne=P[15];g=j[0],Z+=g*Ce,J+=g*Fe,te+=g*Ee,ae+=g*Ae,p+=g*Ge,d+=g*we,b+=g*xe,D+=g*Be,M+=g*be,N+=g*Pe,U+=g*je,O+=g*Te,v+=g*$e,L+=g*lt,oe+=g*Re,de+=g*Ne,g=j[1],J+=g*Ce,te+=g*Fe,ae+=g*Ee,p+=g*Ae,d+=g*Ge,b+=g*we,D+=g*xe,M+=g*Be,N+=g*be,U+=g*Pe,O+=g*je,v+=g*Te,L+=g*$e,oe+=g*lt,de+=g*Re,x+=g*Ne,g=j[2],te+=g*Ce,ae+=g*Fe,p+=g*Ee,d+=g*Ae,b+=g*Ge,D+=g*we,M+=g*xe,N+=g*Be,U+=g*be,O+=g*Pe,v+=g*je,L+=g*Te,oe+=g*$e,de+=g*lt,x+=g*Re,ne+=g*Ne,g=j[3],ae+=g*Ce,p+=g*Fe,d+=g*Ee,b+=g*Ae,D+=g*Ge,M+=g*we,N+=g*xe,U+=g*Be,O+=g*be,v+=g*Pe,L+=g*je,oe+=g*Te,de+=g*$e,x+=g*lt,ne+=g*Re,q+=g*Ne,g=j[4],p+=g*Ce,d+=g*Fe,b+=g*Ee,D+=g*Ae,M+=g*Ge,N+=g*we,U+=g*xe,O+=g*Be,v+=g*be,L+=g*Pe,oe+=g*je,de+=g*Te,x+=g*$e,ne+=g*lt,q+=g*Re,H+=g*Ne,g=j[5],d+=g*Ce,b+=g*Fe,D+=g*Ee,M+=g*Ae,N+=g*Ge,U+=g*we,O+=g*xe,v+=g*Be,L+=g*be,oe+=g*Pe,de+=g*je,x+=g*Te,ne+=g*$e,q+=g*lt,H+=g*Re,V+=g*Ne,g=j[6],b+=g*Ce,D+=g*Fe,M+=g*Ee,N+=g*Ae,U+=g*Ge,O+=g*we,v+=g*xe,L+=g*Be,oe+=g*be,de+=g*Pe,x+=g*je,ne+=g*Te,q+=g*$e,H+=g*lt,V+=g*Re,y+=g*Ne,g=j[7],D+=g*Ce,M+=g*Fe,N+=g*Ee,U+=g*Ae,O+=g*Ge,v+=g*we,L+=g*xe,oe+=g*Be,de+=g*be,x+=g*Pe,ne+=g*je,q+=g*Te,H+=g*$e,V+=g*lt,y+=g*Re,k+=g*Ne,g=j[8],M+=g*Ce,N+=g*Fe,U+=g*Ee,O+=g*Ae,v+=g*Ge,L+=g*we,oe+=g*xe,de+=g*Be,x+=g*be,ne+=g*Pe,q+=g*je,H+=g*Te,V+=g*$e,y+=g*lt,k+=g*Re,ie+=g*Ne,g=j[9],N+=g*Ce,U+=g*Fe,O+=g*Ee,v+=g*Ae,L+=g*Ge,oe+=g*we,de+=g*xe,x+=g*Be,ne+=g*be,q+=g*Pe,H+=g*je,V+=g*Te,y+=g*$e,k+=g*lt,ie+=g*Re,fe+=g*Ne,g=j[10],U+=g*Ce,O+=g*Fe,v+=g*Ee,L+=g*Ae,oe+=g*Ge,de+=g*we,x+=g*xe,ne+=g*Be,q+=g*be,H+=g*Pe,V+=g*je,y+=g*Te,k+=g*$e,ie+=g*lt,fe+=g*Re,ue+=g*Ne,g=j[11],O+=g*Ce,v+=g*Fe,L+=g*Ee,oe+=g*Ae,de+=g*Ge,x+=g*we,ne+=g*xe,q+=g*Be,H+=g*be,V+=g*Pe,y+=g*je,k+=g*Te,ie+=g*$e,fe+=g*lt,ue+=g*Re,Oe+=g*Ne,g=j[12],v+=g*Ce,L+=g*Fe,oe+=g*Ee,de+=g*Ae,x+=g*Ge,ne+=g*we,q+=g*xe,H+=g*Be,V+=g*be,y+=g*Pe,k+=g*je,ie+=g*Te,fe+=g*$e,ue+=g*lt,Oe+=g*Re,Me+=g*Ne,g=j[13],L+=g*Ce,oe+=g*Fe,de+=g*Ee,x+=g*Ae,ne+=g*Ge,q+=g*we,H+=g*xe,V+=g*Be,y+=g*be,k+=g*Pe,ie+=g*je,fe+=g*Te,ue+=g*$e,Oe+=g*lt,Me+=g*Re,Ie+=g*Ne,g=j[14],oe+=g*Ce,de+=g*Fe,x+=g*Ee,ne+=g*Ae,q+=g*Ge,H+=g*we,V+=g*xe,y+=g*Be,k+=g*be,ie+=g*Pe,fe+=g*je,ue+=g*Te,Oe+=g*$e,Me+=g*lt,Ie+=g*Re,Pt+=g*Ne,g=j[15],de+=g*Ce,x+=g*Fe,ne+=g*Ee,q+=g*Ae,H+=g*Ge,V+=g*we,y+=g*xe,k+=g*Be,ie+=g*be,fe+=g*Pe,ue+=g*je,Oe+=g*Te,Me+=g*$e,Ie+=g*lt,Pt+=g*Re,ze+=g*Ne,Z+=38*x,J+=38*ne,te+=38*q,ae+=38*H,p+=38*V,d+=38*y,b+=38*k,D+=38*ie,M+=38*fe,N+=38*ue,U+=38*Oe,O+=38*Me,v+=38*Ie,L+=38*Pt,oe+=38*ze,C=1,g=Z+C+65535,C=Math.floor(g/65536),Z=g-C*65536,g=J+C+65535,C=Math.floor(g/65536),J=g-C*65536,g=te+C+65535,C=Math.floor(g/65536),te=g-C*65536,g=ae+C+65535,C=Math.floor(g/65536),ae=g-C*65536,g=p+C+65535,C=Math.floor(g/65536),p=g-C*65536,g=d+C+65535,C=Math.floor(g/65536),d=g-C*65536,g=b+C+65535,C=Math.floor(g/65536),b=g-C*65536,g=D+C+65535,C=Math.floor(g/65536),D=g-C*65536,g=M+C+65535,C=Math.floor(g/65536),M=g-C*65536,g=N+C+65535,C=Math.floor(g/65536),N=g-C*65536,g=U+C+65535,C=Math.floor(g/65536),U=g-C*65536,g=O+C+65535,C=Math.floor(g/65536),O=g-C*65536,g=v+C+65535,C=Math.floor(g/65536),v=g-C*65536,g=L+C+65535,C=Math.floor(g/65536),L=g-C*65536,g=oe+C+65535,C=Math.floor(g/65536),oe=g-C*65536,g=de+C+65535,C=Math.floor(g/65536),de=g-C*65536,Z+=C-1+37*(C-1),C=1,g=Z+C+65535,C=Math.floor(g/65536),Z=g-C*65536,g=J+C+65535,C=Math.floor(g/65536),J=g-C*65536,g=te+C+65535,C=Math.floor(g/65536),te=g-C*65536,g=ae+C+65535,C=Math.floor(g/65536),ae=g-C*65536,g=p+C+65535,C=Math.floor(g/65536),p=g-C*65536,g=d+C+65535,C=Math.floor(g/65536),d=g-C*65536,g=b+C+65535,C=Math.floor(g/65536),b=g-C*65536,g=D+C+65535,C=Math.floor(g/65536),D=g-C*65536,g=M+C+65535,C=Math.floor(g/65536),M=g-C*65536,g=N+C+65535,C=Math.floor(g/65536),N=g-C*65536,g=U+C+65535,C=Math.floor(g/65536),U=g-C*65536,g=O+C+65535,C=Math.floor(g/65536),O=g-C*65536,g=v+C+65535,C=Math.floor(g/65536),v=g-C*65536,g=L+C+65535,C=Math.floor(g/65536),L=g-C*65536,g=oe+C+65535,C=Math.floor(g/65536),oe=g-C*65536,g=de+C+65535,C=Math.floor(g/65536),de=g-C*65536,Z+=C-1+37*(C-1),$[0]=Z,$[1]=J,$[2]=te,$[3]=ae,$[4]=p,$[5]=d,$[6]=b,$[7]=D,$[8]=M,$[9]=N,$[10]=U,$[11]=O,$[12]=v,$[13]=L,$[14]=oe,$[15]=de}function A($,j){E($,j,j)}function I($,j){const P=n();for(let g=0;g<16;g++)P[g]=j[g];for(let g=253;g>=0;g--)A(P,P),g!==2&&g!==4&&E(P,P,j);for(let g=0;g<16;g++)$[g]=P[g]}function R($,j){const P=new Uint8Array(32),g=new Float64Array(80),C=n(),Z=n(),J=n(),te=n(),ae=n(),p=n();for(let M=0;M<31;M++)P[M]=$[M];P[31]=$[31]&127|64,P[0]&=248,h(g,j);for(let M=0;M<16;M++)Z[M]=g[M];C[0]=te[0]=1;for(let M=254;M>=0;--M){const N=P[M>>>3]>>>(M&7)&1;l(C,Z,N),l(J,te,N),m(ae,C,J),_(C,C,J),m(J,Z,te),_(Z,Z,te),A(te,ae),A(p,C),E(C,J,C),E(J,Z,ae),m(ae,C,J),_(C,C,J),A(Z,C),_(J,te,p),E(C,J,s),m(C,C,te),E(J,J,C),E(C,te,p),E(te,Z,g),A(Z,ae),l(C,Z,N),l(J,te,N)}for(let M=0;M<16;M++)g[M+16]=C[M],g[M+32]=J[M],g[M+48]=Z[M],g[M+64]=te[M];const d=g.subarray(32),b=g.subarray(16);I(d,d),E(b,b,d);const D=new Uint8Array(32);return f(D,b),D}t.scalarMult=R;function W($){return R($,i)}t.scalarMultBase=W;function Y($){if($.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const j=new Uint8Array($);return{publicKey:W(j),secretKey:j}}t.generateKeyPairFromSeed=Y;function F($){const j=(0,e.randomBytes)(32,$),P=Y(j);return(0,r.wipe)(j),P}t.generateKeyPair=F;function z($,j,P=!1){if($.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(j.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const g=R($,j);if(P){let C=0;for(let Z=0;Z<g.length;Z++)C|=g[Z];if(C===0)throw new Error("X25519: invalid shared key")}return g}t.sharedKey=z})(Zh);function Xh(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function L1(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Xh(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function ef(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=L1(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return Xh(r)}function o5(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),c=s.charCodeAt(0);if(r[c]!==255)throw new TypeError(s+" is ambiguous");r[c]=i}var l=t.length,f=t.charAt(0),h=Math.log(l)/Math.log(256),m=Math.log(256)/Math.log(l);function _(I){if(I instanceof Uint8Array||(ArrayBuffer.isView(I)?I=new Uint8Array(I.buffer,I.byteOffset,I.byteLength):Array.isArray(I)&&(I=Uint8Array.from(I))),!(I instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(I.length===0)return"";for(var R=0,W=0,Y=0,F=I.length;Y!==F&&I[Y]===0;)Y++,R++;for(var z=(F-Y)*m+1>>>0,$=new Uint8Array(z);Y!==F;){for(var j=I[Y],P=0,g=z-1;(j!==0||P<W)&&g!==-1;g--,P++)j+=256*$[g]>>>0,$[g]=j%l>>>0,j=j/l>>>0;if(j!==0)throw new Error("Non-zero carry");W=P,Y++}for(var C=z-W;C!==z&&$[C]===0;)C++;for(var Z=f.repeat(R);C<z;++C)Z+=t.charAt($[C]);return Z}function E(I){if(typeof I!="string")throw new TypeError("Expected String");if(I.length===0)return new Uint8Array;var R=0;if(I[R]!==" "){for(var W=0,Y=0;I[R]===f;)W++,R++;for(var F=(I.length-R)*h+1>>>0,z=new Uint8Array(F);I[R];){var $=r[I.charCodeAt(R)];if($===255)return;for(var j=0,P=F-1;($!==0||j<Y)&&P!==-1;P--,j++)$+=l*z[P]>>>0,z[P]=$%256>>>0,$=$/256>>>0;if($!==0)throw new Error("Non-zero carry");Y=j,R++}if(I[R]!==" "){for(var g=F-Y;g!==F&&z[g]===0;)g++;for(var C=new Uint8Array(W+(F-g)),Z=W;g!==F;)C[Z++]=z[g++];return C}}}function A(I){var R=E(I);if(R)return R;throw new Error(`Non-${e} character`)}return{encode:_,decodeUnsafe:E,decode:A}}var a5=o5,c5=a5;const B1=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},l5=t=>new TextEncoder().encode(t),u5=t=>new TextDecoder().decode(t);class h5{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class f5{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}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 U1(this,e)}}class d5{constructor(e){this.decoders=e}or(e){return U1(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const U1=(t,e)=>new d5({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class p5{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new h5(e,r,n),this.decoder=new f5(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const vl=({name:t,prefix:e,encode:r,decode:n})=>new p5(t,e,r,n),Va=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=c5(r,e);return vl({prefix:t,name:e,encode:n,decode:s=>B1(i(s))})},g5=(t,e,r,n)=>{const i={};for(let m=0;m<e.length;++m)i[e[m]]=m;let s=t.length;for(;t[s-1]==="=";)--s;const c=new Uint8Array(s*r/8|0);let l=0,f=0,h=0;for(let m=0;m<s;++m){const _=i[t[m]];if(_===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|_,l+=r,l>=8&&(l-=8,c[h++]=255&f>>l)}if(l>=r||255&f<<8-l)throw new SyntaxError("Unexpected end of data");return c},m5=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let s="",c=0,l=0;for(let f=0;f<t.length;++f)for(l=l<<8|t[f],c+=8;c>r;)c-=r,s+=e[i&l>>c];if(c&&(s+=e[i&l<<r-c]),n)for(;s.length*r&7;)s+="=";return s},Cr=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>vl({prefix:e,name:t,encode(i){return m5(i,n,r)},decode(i){return g5(i,n,r,t)}}),v5=vl({prefix:"\0",name:"identity",encode:t=>u5(t),decode:t=>l5(t)});var y5=Object.freeze({__proto__:null,identity:v5});const w5=Cr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var b5=Object.freeze({__proto__:null,base2:w5});const _5=Cr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var E5=Object.freeze({__proto__:null,base8:_5});const A5=Va({prefix:"9",name:"base10",alphabet:"0123456789"});var x5=Object.freeze({__proto__:null,base10:A5});const S5=Cr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),I5=Cr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var D5=Object.freeze({__proto__:null,base16:S5,base16upper:I5});const C5=Cr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),O5=Cr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),P5=Cr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),M5=Cr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),T5=Cr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$5=Cr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),N5=Cr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),R5=Cr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),L5=Cr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var B5=Object.freeze({__proto__:null,base32:C5,base32upper:O5,base32pad:P5,base32padupper:M5,base32hex:T5,base32hexupper:$5,base32hexpad:N5,base32hexpadupper:R5,base32z:L5});const U5=Va({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),F5=Va({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var j5=Object.freeze({__proto__:null,base36:U5,base36upper:F5});const k5=Va({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),q5=Va({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var z5=Object.freeze({__proto__:null,base58btc:k5,base58flickr:q5});const H5=Cr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),K5=Cr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),W5=Cr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),V5=Cr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var G5=Object.freeze({__proto__:null,base64:H5,base64pad:K5,base64url:W5,base64urlpad:V5});const F1=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}"),Y5=F1.reduce((t,e,r)=>(t[r]=e,t),[]),J5=F1.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Q5(t){return t.reduce((e,r)=>(e+=Y5[r],e),"")}function Z5(t){const e=[];for(const r of t){const n=J5[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const X5=vl({prefix:"\u{1F680}",name:"base256emoji",encode:Q5,decode:Z5});var e_=Object.freeze({__proto__:null,base256emoji:X5}),t_=k1,j1=128,r_=127,n_=~r_,i_=Math.pow(2,31);function k1(t,e,r){e=e||[],r=r||0;for(var n=r;t>=i_;)e[r++]=t&255|j1,t/=128;for(;t&n_;)e[r++]=t&255|j1,t>>>=7;return e[r]=t|0,k1.bytes=r-n+1,e}var s_=tf,o_=128,q1=127;function tf(t,n){var r=0,n=n||0,i=0,s=n,c,l=t.length;do{if(s>=l)throw tf.bytes=0,new RangeError("Could not decode varint");c=t[s++],r+=i<28?(c&q1)<<i:(c&q1)*Math.pow(2,i),i+=7}while(c>=o_);return tf.bytes=s-n,r}var a_=Math.pow(2,7),c_=Math.pow(2,14),l_=Math.pow(2,21),u_=Math.pow(2,28),h_=Math.pow(2,35),f_=Math.pow(2,42),d_=Math.pow(2,49),p_=Math.pow(2,56),g_=Math.pow(2,63),m_=function(t){return t<a_?1:t<c_?2:t<l_?3:t<u_?4:t<h_?5:t<f_?6:t<d_?7:t<p_?8:t<g_?9:10},v_={encode:t_,decode:s_,encodingLength:m_},z1=v_;const H1=(t,e,r=0)=>(z1.encode(t,e,r),e),K1=t=>z1.encodingLength(t),rf=(t,e)=>{const r=e.byteLength,n=K1(t),i=n+K1(r),s=new Uint8Array(i+r);return H1(t,s,0),H1(r,s,n),s.set(e,i),new y_(t,r,e,s)};class y_{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const W1=({name:t,code:e,encode:r})=>new w_(t,e,r);class w_{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?rf(this.code,r):r.then(n=>rf(this.code,n))}else throw Error("Unknown type, must be binary type")}}const V1=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),b_=W1({name:"sha2-256",code:18,encode:V1("SHA-256")}),__=W1({name:"sha2-512",code:19,encode:V1("SHA-512")});var E_=Object.freeze({__proto__:null,sha256:b_,sha512:__});const G1=0,A_="identity",Y1=B1;var x_=Object.freeze({__proto__:null,identity:{code:G1,name:A_,encode:Y1,digest:t=>rf(G1,Y1(t))}});new TextEncoder,new TextDecoder;const J1={...y5,...b5,...E5,...x5,...D5,...B5,...j5,...z5,...G5,...e_};({...E_,...x_});function Q1(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Z1=Q1("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),nf=Q1("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=L1(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),X1={utf8:Z1,"utf-8":Z1,hex:J1.base16,latin1:nf,ascii:nf,binary:nf,...J1};function Xr(t,e="utf8"){const r=X1[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Xh(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function Fr(t,e="utf8"){const r=X1[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}const S_={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 yl(t){const[e,r]=t.split(I_);return{namespace:e,reference:r}}function eg(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...i.accounts)}),r}function tg(t,e){return t.includes(":")?[t]:e.chains||[]}var D_=Object.defineProperty,rg=Object.getOwnPropertySymbols,C_=Object.prototype.hasOwnProperty,O_=Object.prototype.propertyIsEnumerable,ng=(t,e,r)=>e in t?D_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ig=(t,e)=>{for(var r in e||(e={}))C_.call(e,r)&&ng(t,r,e[r]);if(rg)for(var r of rg(e))O_.call(e,r)&&ng(t,r,e[r]);return t};const P_="ReactNative",dn={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},M_="js";function Ga(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function jo(){return!kh()&&!!qh()&&navigator.product===P_}function ko(){return!Ga()&&!!qh()&&!!kh()}function Ya(){return jo()?dn.reactNative:Ga()?dn.node:ko()?dn.browser:dn.unknown}function T_(){var t;try{return jo()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function $_(t,e){let r=Ka.parse(t);return r=ig(ig({},r),e),t=Ka.stringify(r),t}function N_(){return v1()||{name:"",description:"",url:"",icons:[""]}}function R_(){if(Ya()===dn.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:n}=global.Platform;return[r,n].join("-")}const t=b3();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function L_(){var t;const e=Ya();return e===dn.browser?[e,((t=m1())==null?void 0:t.host)||"unknown"].join(":"):e}function B_(t,e,r){const n=R_(),i=L_();return[[t,e].join("-"),[M_,r].join("-"),n,i].join("/")}function U_({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:c,bundleId:l}){const f=r.split("?"),h=B_(t,e,n),m={auth:i,ua:h,projectId:s,useOnCloseEvent:c||void 0,origin:l||void 0},_=$_(f[1]||"",m);return f[0]+"?"+_}function qs(t,e){return t.filter(r=>e.includes(r)).length===t.length}function sg(t){return Object.fromEntries(t.entries())}function og(t){return new Map(Object.entries(t))}function zs(t=_e.FIVE_MINUTES,e){const r=_e.toMiliseconds(t||_e.FIVE_MINUTES);let n,i,s;return{resolve:c=>{s&&n&&(clearTimeout(s),n(c))},reject:c=>{s&&i&&(clearTimeout(s),i(c))},done:()=>new Promise((c,l)=>{s=setTimeout(()=>{l(new Error(e))},r),n=c,i=l})}}function Ja(t,e,r){return new Promise(async(n,i)=>{const s=setTimeout(()=>i(new Error(r)),e);try{const c=await t;n(c)}catch(c){i(c)}clearTimeout(s)})}function ag(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.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: ${t}`)}function F_(t){return ag("topic",t)}function j_(t){return ag("id",t)}function cg(t){const[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function Nr(t,e){return _e.fromMiliseconds((e||Date.now())+_e.toMiliseconds(t))}function is(t){return Date.now()>=_e.toMiliseconds(t)}function wt(t,e){return`${t}${e?`:${e}`:""}`}function wl(t=[],e=[]){return[...new Set([...t,...e])]}async function k_({id:t,topic:e,wcDeepLink:r}){try{if(!r)return;const n=typeof r=="string"?JSON.parse(r):r;let i=n?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));const s=`${i}/wc?requestId=${t}&sessionTopic=${e}`,c=Ya();c===dn.browser?s.startsWith("https://")||s.startsWith("http://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):c===dn.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}async function q_(t,e){try{return await t.getItem(e)||(ko()?localStorage.getItem(e):void 0)}catch(r){console.error(r)}}var lg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function z_(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var ug={exports:{}};/**
15
+ * [js-sha3]{@link https://github.com/emn178/js-sha3}
16
+ *
17
+ * @version 0.8.0
18
+ * @author Chen, Yi-Cyuan [emn178@gmail.com]
19
+ * @copyright Chen, Yi-Cyuan 2015-2018
20
+ * @license MIT
21
+ */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var s=!n&&typeof self=="object",c=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;c?i=lg:s&&(i=self);var l=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,f=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",h="0123456789abcdef".split(""),m=[31,7936,2031616,520093696],_=[4,1024,262144,67108864],E=[1,256,65536,16777216],A=[6,1536,393216,100663296],I=[0,8,16,24],R=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],W=[224,256,384,512],Y=[128,256],F=["hex","buffer","arrayBuffer","array","digest"],z={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}),f&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(x){return typeof x=="object"&&x.buffer&&x.buffer.constructor===ArrayBuffer});for(var $=function(x,ne,q){return function(H){return new L(x,ne,x).update(H)[q]()}},j=function(x,ne,q){return function(H,V){return new L(x,ne,V).update(H)[q]()}},P=function(x,ne,q){return function(H,V,y,k){return d["cshake"+x].update(H,V,y,k)[q]()}},g=function(x,ne,q){return function(H,V,y,k){return d["kmac"+x].update(H,V,y,k)[q]()}},C=function(x,ne,q,H){for(var V=0;V<F.length;++V){var y=F[V];x[y]=ne(q,H,y)}return x},Z=function(x,ne){var q=$(x,ne,"hex");return q.create=function(){return new L(x,ne,x)},q.update=function(H){return q.create().update(H)},C(q,$,x,ne)},J=function(x,ne){var q=j(x,ne,"hex");return q.create=function(H){return new L(x,ne,H)},q.update=function(H,V){return q.create(V).update(H)},C(q,j,x,ne)},te=function(x,ne){var q=z[x],H=P(x,ne,"hex");return H.create=function(V,y,k){return!y&&!k?d["shake"+x].create(V):new L(x,ne,V).bytepad([y,k],q)},H.update=function(V,y,k,ie){return H.create(y,k,ie).update(V)},C(H,P,x,ne)},ae=function(x,ne){var q=z[x],H=g(x,ne,"hex");return H.create=function(V,y,k){return new oe(x,ne,y).bytepad(["KMAC",k],q).bytepad([V],q)},H.update=function(V,y,k,ie){return H.create(V,k,ie).update(y)},C(H,g,x,ne)},p=[{name:"keccak",padding:E,bits:W,createMethod:Z},{name:"sha3",padding:A,bits:W,createMethod:Z},{name:"shake",padding:m,bits:Y,createMethod:J},{name:"cshake",padding:_,bits:Y,createMethod:te},{name:"kmac",padding:_,bits:Y,createMethod:ae}],d={},b=[],D=0;D<p.length;++D)for(var M=p[D],N=M.bits,U=0;U<N.length;++U){var O=M.name+"_"+N[U];if(b.push(O),d[O]=M.createMethod(N[U],M.padding),M.name!=="sha3"){var v=M.name+N[U];b.push(v),d[v]=d[O]}}function L(x,ne,q){this.blocks=[],this.s=[],this.padding=ne,this.outputBits=q,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(x<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=q>>5,this.extraBytes=(q&31)>>3;for(var H=0;H<50;++H)this.s[H]=0}L.prototype.update=function(x){if(this.finalized)throw new Error(r);var ne,q=typeof x;if(q!=="string"){if(q==="object"){if(x===null)throw new Error(e);if(f&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!f||!ArrayBuffer.isView(x)))throw new Error(e)}else throw new Error(e);ne=!0}for(var H=this.blocks,V=this.byteCount,y=x.length,k=this.blockCount,ie=0,fe=this.s,ue,Oe;ie<y;){if(this.reset)for(this.reset=!1,H[0]=this.block,ue=1;ue<k+1;++ue)H[ue]=0;if(ne)for(ue=this.start;ie<y&&ue<V;++ie)H[ue>>2]|=x[ie]<<I[ue++&3];else for(ue=this.start;ie<y&&ue<V;++ie)Oe=x.charCodeAt(ie),Oe<128?H[ue>>2]|=Oe<<I[ue++&3]:Oe<2048?(H[ue>>2]|=(192|Oe>>6)<<I[ue++&3],H[ue>>2]|=(128|Oe&63)<<I[ue++&3]):Oe<55296||Oe>=57344?(H[ue>>2]|=(224|Oe>>12)<<I[ue++&3],H[ue>>2]|=(128|Oe>>6&63)<<I[ue++&3],H[ue>>2]|=(128|Oe&63)<<I[ue++&3]):(Oe=65536+((Oe&1023)<<10|x.charCodeAt(++ie)&1023),H[ue>>2]|=(240|Oe>>18)<<I[ue++&3],H[ue>>2]|=(128|Oe>>12&63)<<I[ue++&3],H[ue>>2]|=(128|Oe>>6&63)<<I[ue++&3],H[ue>>2]|=(128|Oe&63)<<I[ue++&3]);if(this.lastByteIndex=ue,ue>=V){for(this.start=ue-V,this.block=H[k],ue=0;ue<k;++ue)fe[ue]^=H[ue];de(fe),this.reset=!0}else this.start=ue}return this},L.prototype.encode=function(x,ne){var q=x&255,H=1,V=[q];for(x=x>>8,q=x&255;q>0;)V.unshift(q),x=x>>8,q=x&255,++H;return ne?V.push(H):V.unshift(H),this.update(V),V.length},L.prototype.encodeString=function(x){var ne,q=typeof x;if(q!=="string"){if(q==="object"){if(x===null)throw new Error(e);if(f&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!f||!ArrayBuffer.isView(x)))throw new Error(e)}else throw new Error(e);ne=!0}var H=0,V=x.length;if(ne)H=V;else for(var y=0;y<x.length;++y){var k=x.charCodeAt(y);k<128?H+=1:k<2048?H+=2:k<55296||k>=57344?H+=3:(k=65536+((k&1023)<<10|x.charCodeAt(++y)&1023),H+=4)}return H+=this.encode(H*8),this.update(x),H},L.prototype.bytepad=function(x,ne){for(var q=this.encode(ne),H=0;H<x.length;++H)q+=this.encodeString(x[H]);var V=ne-q%ne,y=[];return y.length=V,this.update(y),this},L.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var x=this.blocks,ne=this.lastByteIndex,q=this.blockCount,H=this.s;if(x[ne>>2]|=this.padding[ne&3],this.lastByteIndex===this.byteCount)for(x[0]=x[q],ne=1;ne<q+1;++ne)x[ne]=0;for(x[q-1]|=2147483648,ne=0;ne<q;++ne)H[ne]^=x[ne];de(H)}},L.prototype.toString=L.prototype.hex=function(){this.finalize();for(var x=this.blockCount,ne=this.s,q=this.outputBlocks,H=this.extraBytes,V=0,y=0,k="",ie;y<q;){for(V=0;V<x&&y<q;++V,++y)ie=ne[V],k+=h[ie>>4&15]+h[ie&15]+h[ie>>12&15]+h[ie>>8&15]+h[ie>>20&15]+h[ie>>16&15]+h[ie>>28&15]+h[ie>>24&15];y%x===0&&(de(ne),V=0)}return H&&(ie=ne[V],k+=h[ie>>4&15]+h[ie&15],H>1&&(k+=h[ie>>12&15]+h[ie>>8&15]),H>2&&(k+=h[ie>>20&15]+h[ie>>16&15])),k},L.prototype.arrayBuffer=function(){this.finalize();var x=this.blockCount,ne=this.s,q=this.outputBlocks,H=this.extraBytes,V=0,y=0,k=this.outputBits>>3,ie;H?ie=new ArrayBuffer(q+1<<2):ie=new ArrayBuffer(k);for(var fe=new Uint32Array(ie);y<q;){for(V=0;V<x&&y<q;++V,++y)fe[y]=ne[V];y%x===0&&de(ne)}return H&&(fe[V]=ne[V],ie=ie.slice(0,k)),ie},L.prototype.buffer=L.prototype.arrayBuffer,L.prototype.digest=L.prototype.array=function(){this.finalize();for(var x=this.blockCount,ne=this.s,q=this.outputBlocks,H=this.extraBytes,V=0,y=0,k=[],ie,fe;y<q;){for(V=0;V<x&&y<q;++V,++y)ie=y<<2,fe=ne[V],k[ie]=fe&255,k[ie+1]=fe>>8&255,k[ie+2]=fe>>16&255,k[ie+3]=fe>>24&255;y%x===0&&de(ne)}return H&&(ie=y<<2,fe=ne[V],k[ie]=fe&255,H>1&&(k[ie+1]=fe>>8&255),H>2&&(k[ie+2]=fe>>16&255)),k};function oe(x,ne,q){L.call(this,x,ne,q)}oe.prototype=new L,oe.prototype.finalize=function(){return this.encode(this.outputBits,!0),L.prototype.finalize.call(this)};var de=function(x){var ne,q,H,V,y,k,ie,fe,ue,Oe,Me,Ie,Pt,ze,Ce,Fe,Ee,Ae,Ge,we,xe,Be,be,Pe,je,Te,$e,lt,Re,Ne,nr,dt,Et,ir,St,Ot,Vr,Ye,He,Rt,Je,Ve,Mt,Xe,et,Lt,tt,Qe,Ft,Ze,ke,Ht,rt,jt,ri,kt,vt,Bn,Un,Fn,jn,kn,xr;for(H=0;H<48;H+=2)V=x[0]^x[10]^x[20]^x[30]^x[40],y=x[1]^x[11]^x[21]^x[31]^x[41],k=x[2]^x[12]^x[22]^x[32]^x[42],ie=x[3]^x[13]^x[23]^x[33]^x[43],fe=x[4]^x[14]^x[24]^x[34]^x[44],ue=x[5]^x[15]^x[25]^x[35]^x[45],Oe=x[6]^x[16]^x[26]^x[36]^x[46],Me=x[7]^x[17]^x[27]^x[37]^x[47],Ie=x[8]^x[18]^x[28]^x[38]^x[48],Pt=x[9]^x[19]^x[29]^x[39]^x[49],ne=Ie^(k<<1|ie>>>31),q=Pt^(ie<<1|k>>>31),x[0]^=ne,x[1]^=q,x[10]^=ne,x[11]^=q,x[20]^=ne,x[21]^=q,x[30]^=ne,x[31]^=q,x[40]^=ne,x[41]^=q,ne=V^(fe<<1|ue>>>31),q=y^(ue<<1|fe>>>31),x[2]^=ne,x[3]^=q,x[12]^=ne,x[13]^=q,x[22]^=ne,x[23]^=q,x[32]^=ne,x[33]^=q,x[42]^=ne,x[43]^=q,ne=k^(Oe<<1|Me>>>31),q=ie^(Me<<1|Oe>>>31),x[4]^=ne,x[5]^=q,x[14]^=ne,x[15]^=q,x[24]^=ne,x[25]^=q,x[34]^=ne,x[35]^=q,x[44]^=ne,x[45]^=q,ne=fe^(Ie<<1|Pt>>>31),q=ue^(Pt<<1|Ie>>>31),x[6]^=ne,x[7]^=q,x[16]^=ne,x[17]^=q,x[26]^=ne,x[27]^=q,x[36]^=ne,x[37]^=q,x[46]^=ne,x[47]^=q,ne=Oe^(V<<1|y>>>31),q=Me^(y<<1|V>>>31),x[8]^=ne,x[9]^=q,x[18]^=ne,x[19]^=q,x[28]^=ne,x[29]^=q,x[38]^=ne,x[39]^=q,x[48]^=ne,x[49]^=q,ze=x[0],Ce=x[1],Lt=x[11]<<4|x[10]>>>28,tt=x[10]<<4|x[11]>>>28,lt=x[20]<<3|x[21]>>>29,Re=x[21]<<3|x[20]>>>29,Fn=x[31]<<9|x[30]>>>23,jn=x[30]<<9|x[31]>>>23,Ve=x[40]<<18|x[41]>>>14,Mt=x[41]<<18|x[40]>>>14,ir=x[2]<<1|x[3]>>>31,St=x[3]<<1|x[2]>>>31,Fe=x[13]<<12|x[12]>>>20,Ee=x[12]<<12|x[13]>>>20,Qe=x[22]<<10|x[23]>>>22,Ft=x[23]<<10|x[22]>>>22,Ne=x[33]<<13|x[32]>>>19,nr=x[32]<<13|x[33]>>>19,kn=x[42]<<2|x[43]>>>30,xr=x[43]<<2|x[42]>>>30,jt=x[5]<<30|x[4]>>>2,ri=x[4]<<30|x[5]>>>2,Ot=x[14]<<6|x[15]>>>26,Vr=x[15]<<6|x[14]>>>26,Ae=x[25]<<11|x[24]>>>21,Ge=x[24]<<11|x[25]>>>21,Ze=x[34]<<15|x[35]>>>17,ke=x[35]<<15|x[34]>>>17,dt=x[45]<<29|x[44]>>>3,Et=x[44]<<29|x[45]>>>3,Pe=x[6]<<28|x[7]>>>4,je=x[7]<<28|x[6]>>>4,kt=x[17]<<23|x[16]>>>9,vt=x[16]<<23|x[17]>>>9,Ye=x[26]<<25|x[27]>>>7,He=x[27]<<25|x[26]>>>7,we=x[36]<<21|x[37]>>>11,xe=x[37]<<21|x[36]>>>11,Ht=x[47]<<24|x[46]>>>8,rt=x[46]<<24|x[47]>>>8,Xe=x[8]<<27|x[9]>>>5,et=x[9]<<27|x[8]>>>5,Te=x[18]<<20|x[19]>>>12,$e=x[19]<<20|x[18]>>>12,Bn=x[29]<<7|x[28]>>>25,Un=x[28]<<7|x[29]>>>25,Rt=x[38]<<8|x[39]>>>24,Je=x[39]<<8|x[38]>>>24,Be=x[48]<<14|x[49]>>>18,be=x[49]<<14|x[48]>>>18,x[0]=ze^~Fe&Ae,x[1]=Ce^~Ee&Ge,x[10]=Pe^~Te&lt,x[11]=je^~$e&Re,x[20]=ir^~Ot&Ye,x[21]=St^~Vr&He,x[30]=Xe^~Lt&Qe,x[31]=et^~tt&Ft,x[40]=jt^~kt&Bn,x[41]=ri^~vt&Un,x[2]=Fe^~Ae&we,x[3]=Ee^~Ge&xe,x[12]=Te^~lt&Ne,x[13]=$e^~Re&nr,x[22]=Ot^~Ye&Rt,x[23]=Vr^~He&Je,x[32]=Lt^~Qe&Ze,x[33]=tt^~Ft&ke,x[42]=kt^~Bn&Fn,x[43]=vt^~Un&jn,x[4]=Ae^~we&Be,x[5]=Ge^~xe&be,x[14]=lt^~Ne&dt,x[15]=Re^~nr&Et,x[24]=Ye^~Rt&Ve,x[25]=He^~Je&Mt,x[34]=Qe^~Ze&Ht,x[35]=Ft^~ke&rt,x[44]=Bn^~Fn&kn,x[45]=Un^~jn&xr,x[6]=we^~Be&ze,x[7]=xe^~be&Ce,x[16]=Ne^~dt&Pe,x[17]=nr^~Et&je,x[26]=Rt^~Ve&ir,x[27]=Je^~Mt&St,x[36]=Ze^~Ht&Xe,x[37]=ke^~rt&et,x[46]=Fn^~kn&jt,x[47]=jn^~xr&ri,x[8]=Be^~ze&Fe,x[9]=be^~Ce&Ee,x[18]=dt^~Pe&Te,x[19]=Et^~je&$e,x[28]=Ve^~ir&Ot,x[29]=Mt^~St&Vr,x[38]=Ht^~Xe&Lt,x[39]=rt^~et&tt,x[48]=kn^~jt&kt,x[49]=xr^~ri&vt,x[0]^=R[H],x[1]^=R[H+1]};if(l)t.exports=d;else for(D=0;D<b.length;++D)i[b[D]]=d[b[D]]})()})(ug);var H_=ug.exports;const K_="logger/5.7.0";let hg=!1,fg=!1;const bl={debug:1,default:2,info:2,warning:3,error:4,off:5};let dg=bl.default,sf=null;function W_(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}const pg=W_();var of;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(of||(of={}));var Qn;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Qn||(Qn={}));const gg="0123456789abcdef";class ut{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();bl[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(dg>bl[n])&&console.log.apply(console,r)}debug(...e){this._log(ut.levels.DEBUG,e)}info(...e){this._log(ut.levels.INFO,e)}warn(...e){this._log(ut.levels.WARNING,e)}makeError(e,r,n){if(fg)return this.makeError("censored error",r,{});r||(r=ut.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(f=>{const h=n[f];try{if(h instanceof Uint8Array){let m="";for(let _=0;_<h.length;_++)m+=gg[h[_]>>4],m+=gg[h[_]&15];i.push(f+"=Uint8Array(0x"+m+")")}else i.push(f+"="+JSON.stringify(h))}catch{i.push(f+"="+JSON.stringify(n[f].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const s=e;let c="";switch(r){case Qn.NUMERIC_FAULT:{c="NUMERIC_FAULT";const f=e;switch(f){case"overflow":case"underflow":case"division-by-zero":c+="-"+f;break;case"negative-power":case"negative-width":c+="-unsupported";break;case"unbound-bitwise-result":c+="-unbound-result";break}break}case Qn.CALL_EXCEPTION:case Qn.INSUFFICIENT_FUNDS:case Qn.MISSING_NEW:case Qn.NONCE_EXPIRED:case Qn.REPLACEMENT_UNDERPRICED:case Qn.TRANSACTION_REPLACED:case Qn.UNPREDICTABLE_GAS_LIMIT:c=r;break}c&&(e+=" [ See: https://links.ethers.org/v5-errors-"+c+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const l=new Error(e);return l.reason=s,l.code=r,Object.keys(n).forEach(function(f){l[f]=n[f]}),l}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,ut.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){pg&&this.throwError("platform missing String.prototype.normalize",ut.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:pg})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,ut.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,ut.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",e<r&&this.throwError("missing argument"+n,ut.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+n,ut.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",ut.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",ut.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",ut.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return sf||(sf=new ut(K_)),sf}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",ut.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),hg){if(!e)return;this.globalLogger().throwError("error censorship permanent",ut.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}fg=!!e,hg=!!r}static setLogLevel(e){const r=bl[e.toLowerCase()];if(r==null){ut.globalLogger().warn("invalid log level - "+e);return}dg=r}static from(e){return new ut(e)}}ut.errors=Qn,ut.levels=of;const V_="bytes/5.7.0",lr=new ut(V_);function mg(t){return!!t.toHexString}function qo(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return qo(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function G_(t){return pn(t)&&!(t.length%2)||zo(t)}function vg(t){return typeof t=="number"&&t==t&&t%1===0}function zo(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!vg(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!vg(r)||r<0||r>=256)return!1}return!0}function or(t,e){if(e||(e={}),typeof t=="number"){lr.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),qo(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),mg(t)&&(t=t.toHexString()),pn(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":lr.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;i<r.length;i+=2)n.push(parseInt(r.substring(i,i+2),16));return qo(new Uint8Array(n))}return zo(t)?qo(new Uint8Array(t)):lr.throwArgumentError("invalid arrayify value","value",t)}function Y_(t){const e=t.map(i=>or(i)),r=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(r);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),qo(n)}function J_(t,e){t=or(t),t.length>e&&lr.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),qo(r)}function pn(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const af="0123456789abcdef";function jr(t,e){if(e||(e={}),typeof t=="number"){lr.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=af[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),mg(t))return t.toHexString();if(pn(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":lr.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(zo(t)){let r="0x";for(let n=0;n<t.length;n++){let i=t[n];r+=af[(i&240)>>4]+af[i&15]}return r}return lr.throwArgumentError("invalid hexlify value","value",t)}function Q_(t){if(typeof t!="string")t=jr(t);else if(!pn(t)||t.length%2)return null;return(t.length-2)/2}function yg(t,e,r){return typeof t!="string"?t=jr(t):(!pn(t)||t.length%2)&&lr.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function li(t,e){for(typeof t!="string"?t=jr(t):pn(t)||lr.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&lr.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function wg(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(G_(t)){let r=or(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=jr(r.slice(0,32)),e.s=jr(r.slice(32,64))):r.length===65?(e.r=jr(r.slice(0,32)),e.s=jr(r.slice(32,64)),e.v=r[64]):lr.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:lr.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=jr(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=J_(or(e._vs),32);e._vs=jr(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&lr.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const c=jr(i);e.s==null?e.s=c:e.s!==c&&lr.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?lr.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&lr.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!pn(e.r)?lr.throwArgumentError("signature missing or invalid r","signature",t):e.r=li(e.r,32),e.s==null||!pn(e.s)?lr.throwArgumentError("signature missing or invalid s","signature",t):e.s=li(e.s,32);const r=or(e.s);r[0]>=128&&lr.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=jr(r);e._vs&&(pn(e._vs)||lr.throwArgumentError("signature invalid _vs","signature",t),e._vs=li(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&lr.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function cf(t){return"0x"+H_.keccak_256(or(t))}var bg={exports:{}},Z_={},X_=Object.freeze({__proto__:null,default:Z_}),e8=z_(X_);(function(t){(function(e,r){function n(p,d){if(!p)throw new Error(d||"Assertion failed")}function i(p,d){p.super_=d;var b=function(){};b.prototype=d.prototype,p.prototype=new b,p.prototype.constructor=p}function s(p,d,b){if(s.isBN(p))return p;this.negative=0,this.words=null,this.length=0,this.red=null,p!==null&&((d==="le"||d==="be")&&(b=d,d=10),this._init(p||0,d||10,b||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=e8.Buffer}catch{}s.isBN=function(p){return p instanceof s?!0:p!==null&&typeof p=="object"&&p.constructor.wordSize===s.wordSize&&Array.isArray(p.words)},s.max=function(p,d){return p.cmp(d)>0?p:d},s.min=function(p,d){return p.cmp(d)<0?p:d},s.prototype._init=function(p,d,b){if(typeof p=="number")return this._initNumber(p,d,b);if(typeof p=="object")return this._initArray(p,d,b);d==="hex"&&(d=16),n(d===(d|0)&&d>=2&&d<=36),p=p.toString().replace(/\s+/g,"");var D=0;p[0]==="-"&&(D++,this.negative=1),D<p.length&&(d===16?this._parseHex(p,D,b):(this._parseBase(p,d,D),b==="le"&&this._initArray(this.toArray(),d,b)))},s.prototype._initNumber=function(p,d,b){p<0&&(this.negative=1,p=-p),p<67108864?(this.words=[p&67108863],this.length=1):p<4503599627370496?(this.words=[p&67108863,p/67108864&67108863],this.length=2):(n(p<9007199254740992),this.words=[p&67108863,p/67108864&67108863,1],this.length=3),b==="le"&&this._initArray(this.toArray(),d,b)},s.prototype._initArray=function(p,d,b){if(n(typeof p.length=="number"),p.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(p.length/3),this.words=new Array(this.length);for(var D=0;D<this.length;D++)this.words[D]=0;var M,N,U=0;if(b==="be")for(D=p.length-1,M=0;D>=0;D-=3)N=p[D]|p[D-1]<<8|p[D-2]<<16,this.words[M]|=N<<U&67108863,this.words[M+1]=N>>>26-U&67108863,U+=24,U>=26&&(U-=26,M++);else if(b==="le")for(D=0,M=0;D<p.length;D+=3)N=p[D]|p[D+1]<<8|p[D+2]<<16,this.words[M]|=N<<U&67108863,this.words[M+1]=N>>>26-U&67108863,U+=24,U>=26&&(U-=26,M++);return this._strip()};function l(p,d){var b=p.charCodeAt(d);if(b>=48&&b<=57)return b-48;if(b>=65&&b<=70)return b-55;if(b>=97&&b<=102)return b-87;n(!1,"Invalid character in "+p)}function f(p,d,b){var D=l(p,b);return b-1>=d&&(D|=l(p,b-1)<<4),D}s.prototype._parseHex=function(p,d,b){this.length=Math.ceil((p.length-d)/6),this.words=new Array(this.length);for(var D=0;D<this.length;D++)this.words[D]=0;var M=0,N=0,U;if(b==="be")for(D=p.length-1;D>=d;D-=2)U=f(p,d,D)<<M,this.words[N]|=U&67108863,M>=18?(M-=18,N+=1,this.words[N]|=U>>>26):M+=8;else{var O=p.length-d;for(D=O%2===0?d+1:d;D<p.length;D+=2)U=f(p,d,D)<<M,this.words[N]|=U&67108863,M>=18?(M-=18,N+=1,this.words[N]|=U>>>26):M+=8}this._strip()};function h(p,d,b,D){for(var M=0,N=0,U=Math.min(p.length,b),O=d;O<U;O++){var v=p.charCodeAt(O)-48;M*=D,v>=49?N=v-49+10:v>=17?N=v-17+10:N=v,n(v>=0&&N<D,"Invalid character"),M+=N}return M}s.prototype._parseBase=function(p,d,b){this.words=[0],this.length=1;for(var D=0,M=1;M<=67108863;M*=d)D++;D--,M=M/d|0;for(var N=p.length-b,U=N%D,O=Math.min(N,N-U)+b,v=0,L=b;L<O;L+=D)v=h(p,L,L+D,d),this.imuln(M),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v);if(U!==0){var oe=1;for(v=h(p,L,p.length,d),L=0;L<U;L++)oe*=d;this.imuln(oe),this.words[0]+v<67108864?this.words[0]+=v:this._iaddn(v)}this._strip()},s.prototype.copy=function(p){p.words=new Array(this.length);for(var d=0;d<this.length;d++)p.words[d]=this.words[d];p.length=this.length,p.negative=this.negative,p.red=this.red};function m(p,d){p.words=d.words,p.length=d.length,p.negative=d.negative,p.red=d.red}if(s.prototype._move=function(p){m(p,this)},s.prototype.clone=function(){var p=new s(null);return this.copy(p),p},s.prototype._expand=function(p){for(;this.length<p;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=_}catch{s.prototype.inspect=_}else s.prototype.inspect=_;function _(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var E=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],A=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],I=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(p,d){p=p||10,d=d|0||1;var b;if(p===16||p==="hex"){b="";for(var D=0,M=0,N=0;N<this.length;N++){var U=this.words[N],O=((U<<D|M)&16777215).toString(16);M=U>>>24-D&16777215,D+=2,D>=26&&(D-=26,N--),M!==0||N!==this.length-1?b=E[6-O.length]+O+b:b=O+b}for(M!==0&&(b=M.toString(16)+b);b.length%d!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}if(p===(p|0)&&p>=2&&p<=36){var v=A[p],L=I[p];b="";var oe=this.clone();for(oe.negative=0;!oe.isZero();){var de=oe.modrn(L).toString(p);oe=oe.idivn(L),oe.isZero()?b=de+b:b=E[v-de.length]+de+b}for(this.isZero()&&(b="0"+b);b.length%d!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var p=this.words[0];return this.length===2?p+=this.words[1]*67108864:this.length===3&&this.words[2]===1?p+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-p:p},s.prototype.toJSON=function(){return this.toString(16,2)},c&&(s.prototype.toBuffer=function(p,d){return this.toArrayLike(c,p,d)}),s.prototype.toArray=function(p,d){return this.toArrayLike(Array,p,d)};var R=function(p,d){return p.allocUnsafe?p.allocUnsafe(d):new p(d)};s.prototype.toArrayLike=function(p,d,b){this._strip();var D=this.byteLength(),M=b||Math.max(1,D);n(D<=M,"byte array longer than desired length"),n(M>0,"Requested array length <= 0");var N=R(p,M),U=d==="le"?"LE":"BE";return this["_toArrayLike"+U](N,D),N},s.prototype._toArrayLikeLE=function(p,d){for(var b=0,D=0,M=0,N=0;M<this.length;M++){var U=this.words[M]<<N|D;p[b++]=U&255,b<p.length&&(p[b++]=U>>8&255),b<p.length&&(p[b++]=U>>16&255),N===6?(b<p.length&&(p[b++]=U>>24&255),D=0,N=0):(D=U>>>24,N+=2)}if(b<p.length)for(p[b++]=D;b<p.length;)p[b++]=0},s.prototype._toArrayLikeBE=function(p,d){for(var b=p.length-1,D=0,M=0,N=0;M<this.length;M++){var U=this.words[M]<<N|D;p[b--]=U&255,b>=0&&(p[b--]=U>>8&255),b>=0&&(p[b--]=U>>16&255),N===6?(b>=0&&(p[b--]=U>>24&255),D=0,N=0):(D=U>>>24,N+=2)}if(b>=0)for(p[b--]=D;b>=0;)p[b--]=0},Math.clz32?s.prototype._countBits=function(p){return 32-Math.clz32(p)}:s.prototype._countBits=function(p){var d=p,b=0;return d>=4096&&(b+=13,d>>>=13),d>=64&&(b+=7,d>>>=7),d>=8&&(b+=4,d>>>=4),d>=2&&(b+=2,d>>>=2),b+d},s.prototype._zeroBits=function(p){if(p===0)return 26;var d=p,b=0;return d&8191||(b+=13,d>>>=13),d&127||(b+=7,d>>>=7),d&15||(b+=4,d>>>=4),d&3||(b+=2,d>>>=2),d&1||b++,b},s.prototype.bitLength=function(){var p=this.words[this.length-1],d=this._countBits(p);return(this.length-1)*26+d};function W(p){for(var d=new Array(p.bitLength()),b=0;b<d.length;b++){var D=b/26|0,M=b%26;d[b]=p.words[D]>>>M&1}return d}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var p=0,d=0;d<this.length;d++){var b=this._zeroBits(this.words[d]);if(p+=b,b!==26)break}return p},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(p){return this.negative!==0?this.abs().inotn(p).iaddn(1):this.clone()},s.prototype.fromTwos=function(p){return this.testn(p-1)?this.notn(p).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(p){for(;this.length<p.length;)this.words[this.length++]=0;for(var d=0;d<p.length;d++)this.words[d]=this.words[d]|p.words[d];return this._strip()},s.prototype.ior=function(p){return n((this.negative|p.negative)===0),this.iuor(p)},s.prototype.or=function(p){return this.length>p.length?this.clone().ior(p):p.clone().ior(this)},s.prototype.uor=function(p){return this.length>p.length?this.clone().iuor(p):p.clone().iuor(this)},s.prototype.iuand=function(p){var d;this.length>p.length?d=p:d=this;for(var b=0;b<d.length;b++)this.words[b]=this.words[b]&p.words[b];return this.length=d.length,this._strip()},s.prototype.iand=function(p){return n((this.negative|p.negative)===0),this.iuand(p)},s.prototype.and=function(p){return this.length>p.length?this.clone().iand(p):p.clone().iand(this)},s.prototype.uand=function(p){return this.length>p.length?this.clone().iuand(p):p.clone().iuand(this)},s.prototype.iuxor=function(p){var d,b;this.length>p.length?(d=this,b=p):(d=p,b=this);for(var D=0;D<b.length;D++)this.words[D]=d.words[D]^b.words[D];if(this!==d)for(;D<d.length;D++)this.words[D]=d.words[D];return this.length=d.length,this._strip()},s.prototype.ixor=function(p){return n((this.negative|p.negative)===0),this.iuxor(p)},s.prototype.xor=function(p){return this.length>p.length?this.clone().ixor(p):p.clone().ixor(this)},s.prototype.uxor=function(p){return this.length>p.length?this.clone().iuxor(p):p.clone().iuxor(this)},s.prototype.inotn=function(p){n(typeof p=="number"&&p>=0);var d=Math.ceil(p/26)|0,b=p%26;this._expand(d),b>0&&d--;for(var D=0;D<d;D++)this.words[D]=~this.words[D]&67108863;return b>0&&(this.words[D]=~this.words[D]&67108863>>26-b),this._strip()},s.prototype.notn=function(p){return this.clone().inotn(p)},s.prototype.setn=function(p,d){n(typeof p=="number"&&p>=0);var b=p/26|0,D=p%26;return this._expand(b+1),d?this.words[b]=this.words[b]|1<<D:this.words[b]=this.words[b]&~(1<<D),this._strip()},s.prototype.iadd=function(p){var d;if(this.negative!==0&&p.negative===0)return this.negative=0,d=this.isub(p),this.negative^=1,this._normSign();if(this.negative===0&&p.negative!==0)return p.negative=0,d=this.isub(p),p.negative=1,d._normSign();var b,D;this.length>p.length?(b=this,D=p):(b=p,D=this);for(var M=0,N=0;N<D.length;N++)d=(b.words[N]|0)+(D.words[N]|0)+M,this.words[N]=d&67108863,M=d>>>26;for(;M!==0&&N<b.length;N++)d=(b.words[N]|0)+M,this.words[N]=d&67108863,M=d>>>26;if(this.length=b.length,M!==0)this.words[this.length]=M,this.length++;else if(b!==this)for(;N<b.length;N++)this.words[N]=b.words[N];return this},s.prototype.add=function(p){var d;return p.negative!==0&&this.negative===0?(p.negative=0,d=this.sub(p),p.negative^=1,d):p.negative===0&&this.negative!==0?(this.negative=0,d=p.sub(this),this.negative=1,d):this.length>p.length?this.clone().iadd(p):p.clone().iadd(this)},s.prototype.isub=function(p){if(p.negative!==0){p.negative=0;var d=this.iadd(p);return p.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(p),this.negative=1,this._normSign();var b=this.cmp(p);if(b===0)return this.negative=0,this.length=1,this.words[0]=0,this;var D,M;b>0?(D=this,M=p):(D=p,M=this);for(var N=0,U=0;U<M.length;U++)d=(D.words[U]|0)-(M.words[U]|0)+N,N=d>>26,this.words[U]=d&67108863;for(;N!==0&&U<D.length;U++)d=(D.words[U]|0)+N,N=d>>26,this.words[U]=d&67108863;if(N===0&&U<D.length&&D!==this)for(;U<D.length;U++)this.words[U]=D.words[U];return this.length=Math.max(this.length,U),D!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(p){return this.clone().isub(p)};function Y(p,d,b){b.negative=d.negative^p.negative;var D=p.length+d.length|0;b.length=D,D=D-1|0;var M=p.words[0]|0,N=d.words[0]|0,U=M*N,O=U&67108863,v=U/67108864|0;b.words[0]=O;for(var L=1;L<D;L++){for(var oe=v>>>26,de=v&67108863,x=Math.min(L,d.length-1),ne=Math.max(0,L-p.length+1);ne<=x;ne++){var q=L-ne|0;M=p.words[q]|0,N=d.words[ne]|0,U=M*N+de,oe+=U/67108864|0,de=U&67108863}b.words[L]=de|0,v=oe|0}return v!==0?b.words[L]=v|0:b.length--,b._strip()}var F=function(p,d,b){var D=p.words,M=d.words,N=b.words,U=0,O,v,L,oe=D[0]|0,de=oe&8191,x=oe>>>13,ne=D[1]|0,q=ne&8191,H=ne>>>13,V=D[2]|0,y=V&8191,k=V>>>13,ie=D[3]|0,fe=ie&8191,ue=ie>>>13,Oe=D[4]|0,Me=Oe&8191,Ie=Oe>>>13,Pt=D[5]|0,ze=Pt&8191,Ce=Pt>>>13,Fe=D[6]|0,Ee=Fe&8191,Ae=Fe>>>13,Ge=D[7]|0,we=Ge&8191,xe=Ge>>>13,Be=D[8]|0,be=Be&8191,Pe=Be>>>13,je=D[9]|0,Te=je&8191,$e=je>>>13,lt=M[0]|0,Re=lt&8191,Ne=lt>>>13,nr=M[1]|0,dt=nr&8191,Et=nr>>>13,ir=M[2]|0,St=ir&8191,Ot=ir>>>13,Vr=M[3]|0,Ye=Vr&8191,He=Vr>>>13,Rt=M[4]|0,Je=Rt&8191,Ve=Rt>>>13,Mt=M[5]|0,Xe=Mt&8191,et=Mt>>>13,Lt=M[6]|0,tt=Lt&8191,Qe=Lt>>>13,Ft=M[7]|0,Ze=Ft&8191,ke=Ft>>>13,Ht=M[8]|0,rt=Ht&8191,jt=Ht>>>13,ri=M[9]|0,kt=ri&8191,vt=ri>>>13;b.negative=p.negative^d.negative,b.length=19,O=Math.imul(de,Re),v=Math.imul(de,Ne),v=v+Math.imul(x,Re)|0,L=Math.imul(x,Ne);var Bn=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Bn>>>26)|0,Bn&=67108863,O=Math.imul(q,Re),v=Math.imul(q,Ne),v=v+Math.imul(H,Re)|0,L=Math.imul(H,Ne),O=O+Math.imul(de,dt)|0,v=v+Math.imul(de,Et)|0,v=v+Math.imul(x,dt)|0,L=L+Math.imul(x,Et)|0;var Un=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Un>>>26)|0,Un&=67108863,O=Math.imul(y,Re),v=Math.imul(y,Ne),v=v+Math.imul(k,Re)|0,L=Math.imul(k,Ne),O=O+Math.imul(q,dt)|0,v=v+Math.imul(q,Et)|0,v=v+Math.imul(H,dt)|0,L=L+Math.imul(H,Et)|0,O=O+Math.imul(de,St)|0,v=v+Math.imul(de,Ot)|0,v=v+Math.imul(x,St)|0,L=L+Math.imul(x,Ot)|0;var Fn=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,O=Math.imul(fe,Re),v=Math.imul(fe,Ne),v=v+Math.imul(ue,Re)|0,L=Math.imul(ue,Ne),O=O+Math.imul(y,dt)|0,v=v+Math.imul(y,Et)|0,v=v+Math.imul(k,dt)|0,L=L+Math.imul(k,Et)|0,O=O+Math.imul(q,St)|0,v=v+Math.imul(q,Ot)|0,v=v+Math.imul(H,St)|0,L=L+Math.imul(H,Ot)|0,O=O+Math.imul(de,Ye)|0,v=v+Math.imul(de,He)|0,v=v+Math.imul(x,Ye)|0,L=L+Math.imul(x,He)|0;var jn=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(jn>>>26)|0,jn&=67108863,O=Math.imul(Me,Re),v=Math.imul(Me,Ne),v=v+Math.imul(Ie,Re)|0,L=Math.imul(Ie,Ne),O=O+Math.imul(fe,dt)|0,v=v+Math.imul(fe,Et)|0,v=v+Math.imul(ue,dt)|0,L=L+Math.imul(ue,Et)|0,O=O+Math.imul(y,St)|0,v=v+Math.imul(y,Ot)|0,v=v+Math.imul(k,St)|0,L=L+Math.imul(k,Ot)|0,O=O+Math.imul(q,Ye)|0,v=v+Math.imul(q,He)|0,v=v+Math.imul(H,Ye)|0,L=L+Math.imul(H,He)|0,O=O+Math.imul(de,Je)|0,v=v+Math.imul(de,Ve)|0,v=v+Math.imul(x,Je)|0,L=L+Math.imul(x,Ve)|0;var kn=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(kn>>>26)|0,kn&=67108863,O=Math.imul(ze,Re),v=Math.imul(ze,Ne),v=v+Math.imul(Ce,Re)|0,L=Math.imul(Ce,Ne),O=O+Math.imul(Me,dt)|0,v=v+Math.imul(Me,Et)|0,v=v+Math.imul(Ie,dt)|0,L=L+Math.imul(Ie,Et)|0,O=O+Math.imul(fe,St)|0,v=v+Math.imul(fe,Ot)|0,v=v+Math.imul(ue,St)|0,L=L+Math.imul(ue,Ot)|0,O=O+Math.imul(y,Ye)|0,v=v+Math.imul(y,He)|0,v=v+Math.imul(k,Ye)|0,L=L+Math.imul(k,He)|0,O=O+Math.imul(q,Je)|0,v=v+Math.imul(q,Ve)|0,v=v+Math.imul(H,Je)|0,L=L+Math.imul(H,Ve)|0,O=O+Math.imul(de,Xe)|0,v=v+Math.imul(de,et)|0,v=v+Math.imul(x,Xe)|0,L=L+Math.imul(x,et)|0;var xr=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(xr>>>26)|0,xr&=67108863,O=Math.imul(Ee,Re),v=Math.imul(Ee,Ne),v=v+Math.imul(Ae,Re)|0,L=Math.imul(Ae,Ne),O=O+Math.imul(ze,dt)|0,v=v+Math.imul(ze,Et)|0,v=v+Math.imul(Ce,dt)|0,L=L+Math.imul(Ce,Et)|0,O=O+Math.imul(Me,St)|0,v=v+Math.imul(Me,Ot)|0,v=v+Math.imul(Ie,St)|0,L=L+Math.imul(Ie,Ot)|0,O=O+Math.imul(fe,Ye)|0,v=v+Math.imul(fe,He)|0,v=v+Math.imul(ue,Ye)|0,L=L+Math.imul(ue,He)|0,O=O+Math.imul(y,Je)|0,v=v+Math.imul(y,Ve)|0,v=v+Math.imul(k,Je)|0,L=L+Math.imul(k,Ve)|0,O=O+Math.imul(q,Xe)|0,v=v+Math.imul(q,et)|0,v=v+Math.imul(H,Xe)|0,L=L+Math.imul(H,et)|0,O=O+Math.imul(de,tt)|0,v=v+Math.imul(de,Qe)|0,v=v+Math.imul(x,tt)|0,L=L+Math.imul(x,Qe)|0;var Ii=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Ii>>>26)|0,Ii&=67108863,O=Math.imul(we,Re),v=Math.imul(we,Ne),v=v+Math.imul(xe,Re)|0,L=Math.imul(xe,Ne),O=O+Math.imul(Ee,dt)|0,v=v+Math.imul(Ee,Et)|0,v=v+Math.imul(Ae,dt)|0,L=L+Math.imul(Ae,Et)|0,O=O+Math.imul(ze,St)|0,v=v+Math.imul(ze,Ot)|0,v=v+Math.imul(Ce,St)|0,L=L+Math.imul(Ce,Ot)|0,O=O+Math.imul(Me,Ye)|0,v=v+Math.imul(Me,He)|0,v=v+Math.imul(Ie,Ye)|0,L=L+Math.imul(Ie,He)|0,O=O+Math.imul(fe,Je)|0,v=v+Math.imul(fe,Ve)|0,v=v+Math.imul(ue,Je)|0,L=L+Math.imul(ue,Ve)|0,O=O+Math.imul(y,Xe)|0,v=v+Math.imul(y,et)|0,v=v+Math.imul(k,Xe)|0,L=L+Math.imul(k,et)|0,O=O+Math.imul(q,tt)|0,v=v+Math.imul(q,Qe)|0,v=v+Math.imul(H,tt)|0,L=L+Math.imul(H,Qe)|0,O=O+Math.imul(de,Ze)|0,v=v+Math.imul(de,ke)|0,v=v+Math.imul(x,Ze)|0,L=L+Math.imul(x,ke)|0;var mo=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(mo>>>26)|0,mo&=67108863,O=Math.imul(be,Re),v=Math.imul(be,Ne),v=v+Math.imul(Pe,Re)|0,L=Math.imul(Pe,Ne),O=O+Math.imul(we,dt)|0,v=v+Math.imul(we,Et)|0,v=v+Math.imul(xe,dt)|0,L=L+Math.imul(xe,Et)|0,O=O+Math.imul(Ee,St)|0,v=v+Math.imul(Ee,Ot)|0,v=v+Math.imul(Ae,St)|0,L=L+Math.imul(Ae,Ot)|0,O=O+Math.imul(ze,Ye)|0,v=v+Math.imul(ze,He)|0,v=v+Math.imul(Ce,Ye)|0,L=L+Math.imul(Ce,He)|0,O=O+Math.imul(Me,Je)|0,v=v+Math.imul(Me,Ve)|0,v=v+Math.imul(Ie,Je)|0,L=L+Math.imul(Ie,Ve)|0,O=O+Math.imul(fe,Xe)|0,v=v+Math.imul(fe,et)|0,v=v+Math.imul(ue,Xe)|0,L=L+Math.imul(ue,et)|0,O=O+Math.imul(y,tt)|0,v=v+Math.imul(y,Qe)|0,v=v+Math.imul(k,tt)|0,L=L+Math.imul(k,Qe)|0,O=O+Math.imul(q,Ze)|0,v=v+Math.imul(q,ke)|0,v=v+Math.imul(H,Ze)|0,L=L+Math.imul(H,ke)|0,O=O+Math.imul(de,rt)|0,v=v+Math.imul(de,jt)|0,v=v+Math.imul(x,rt)|0,L=L+Math.imul(x,jt)|0;var Di=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Di>>>26)|0,Di&=67108863,O=Math.imul(Te,Re),v=Math.imul(Te,Ne),v=v+Math.imul($e,Re)|0,L=Math.imul($e,Ne),O=O+Math.imul(be,dt)|0,v=v+Math.imul(be,Et)|0,v=v+Math.imul(Pe,dt)|0,L=L+Math.imul(Pe,Et)|0,O=O+Math.imul(we,St)|0,v=v+Math.imul(we,Ot)|0,v=v+Math.imul(xe,St)|0,L=L+Math.imul(xe,Ot)|0,O=O+Math.imul(Ee,Ye)|0,v=v+Math.imul(Ee,He)|0,v=v+Math.imul(Ae,Ye)|0,L=L+Math.imul(Ae,He)|0,O=O+Math.imul(ze,Je)|0,v=v+Math.imul(ze,Ve)|0,v=v+Math.imul(Ce,Je)|0,L=L+Math.imul(Ce,Ve)|0,O=O+Math.imul(Me,Xe)|0,v=v+Math.imul(Me,et)|0,v=v+Math.imul(Ie,Xe)|0,L=L+Math.imul(Ie,et)|0,O=O+Math.imul(fe,tt)|0,v=v+Math.imul(fe,Qe)|0,v=v+Math.imul(ue,tt)|0,L=L+Math.imul(ue,Qe)|0,O=O+Math.imul(y,Ze)|0,v=v+Math.imul(y,ke)|0,v=v+Math.imul(k,Ze)|0,L=L+Math.imul(k,ke)|0,O=O+Math.imul(q,rt)|0,v=v+Math.imul(q,jt)|0,v=v+Math.imul(H,rt)|0,L=L+Math.imul(H,jt)|0,O=O+Math.imul(de,kt)|0,v=v+Math.imul(de,vt)|0,v=v+Math.imul(x,kt)|0,L=L+Math.imul(x,vt)|0;var vo=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(vo>>>26)|0,vo&=67108863,O=Math.imul(Te,dt),v=Math.imul(Te,Et),v=v+Math.imul($e,dt)|0,L=Math.imul($e,Et),O=O+Math.imul(be,St)|0,v=v+Math.imul(be,Ot)|0,v=v+Math.imul(Pe,St)|0,L=L+Math.imul(Pe,Ot)|0,O=O+Math.imul(we,Ye)|0,v=v+Math.imul(we,He)|0,v=v+Math.imul(xe,Ye)|0,L=L+Math.imul(xe,He)|0,O=O+Math.imul(Ee,Je)|0,v=v+Math.imul(Ee,Ve)|0,v=v+Math.imul(Ae,Je)|0,L=L+Math.imul(Ae,Ve)|0,O=O+Math.imul(ze,Xe)|0,v=v+Math.imul(ze,et)|0,v=v+Math.imul(Ce,Xe)|0,L=L+Math.imul(Ce,et)|0,O=O+Math.imul(Me,tt)|0,v=v+Math.imul(Me,Qe)|0,v=v+Math.imul(Ie,tt)|0,L=L+Math.imul(Ie,Qe)|0,O=O+Math.imul(fe,Ze)|0,v=v+Math.imul(fe,ke)|0,v=v+Math.imul(ue,Ze)|0,L=L+Math.imul(ue,ke)|0,O=O+Math.imul(y,rt)|0,v=v+Math.imul(y,jt)|0,v=v+Math.imul(k,rt)|0,L=L+Math.imul(k,jt)|0,O=O+Math.imul(q,kt)|0,v=v+Math.imul(q,vt)|0,v=v+Math.imul(H,kt)|0,L=L+Math.imul(H,vt)|0;var yo=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(yo>>>26)|0,yo&=67108863,O=Math.imul(Te,St),v=Math.imul(Te,Ot),v=v+Math.imul($e,St)|0,L=Math.imul($e,Ot),O=O+Math.imul(be,Ye)|0,v=v+Math.imul(be,He)|0,v=v+Math.imul(Pe,Ye)|0,L=L+Math.imul(Pe,He)|0,O=O+Math.imul(we,Je)|0,v=v+Math.imul(we,Ve)|0,v=v+Math.imul(xe,Je)|0,L=L+Math.imul(xe,Ve)|0,O=O+Math.imul(Ee,Xe)|0,v=v+Math.imul(Ee,et)|0,v=v+Math.imul(Ae,Xe)|0,L=L+Math.imul(Ae,et)|0,O=O+Math.imul(ze,tt)|0,v=v+Math.imul(ze,Qe)|0,v=v+Math.imul(Ce,tt)|0,L=L+Math.imul(Ce,Qe)|0,O=O+Math.imul(Me,Ze)|0,v=v+Math.imul(Me,ke)|0,v=v+Math.imul(Ie,Ze)|0,L=L+Math.imul(Ie,ke)|0,O=O+Math.imul(fe,rt)|0,v=v+Math.imul(fe,jt)|0,v=v+Math.imul(ue,rt)|0,L=L+Math.imul(ue,jt)|0,O=O+Math.imul(y,kt)|0,v=v+Math.imul(y,vt)|0,v=v+Math.imul(k,kt)|0,L=L+Math.imul(k,vt)|0;var Ci=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Ci>>>26)|0,Ci&=67108863,O=Math.imul(Te,Ye),v=Math.imul(Te,He),v=v+Math.imul($e,Ye)|0,L=Math.imul($e,He),O=O+Math.imul(be,Je)|0,v=v+Math.imul(be,Ve)|0,v=v+Math.imul(Pe,Je)|0,L=L+Math.imul(Pe,Ve)|0,O=O+Math.imul(we,Xe)|0,v=v+Math.imul(we,et)|0,v=v+Math.imul(xe,Xe)|0,L=L+Math.imul(xe,et)|0,O=O+Math.imul(Ee,tt)|0,v=v+Math.imul(Ee,Qe)|0,v=v+Math.imul(Ae,tt)|0,L=L+Math.imul(Ae,Qe)|0,O=O+Math.imul(ze,Ze)|0,v=v+Math.imul(ze,ke)|0,v=v+Math.imul(Ce,Ze)|0,L=L+Math.imul(Ce,ke)|0,O=O+Math.imul(Me,rt)|0,v=v+Math.imul(Me,jt)|0,v=v+Math.imul(Ie,rt)|0,L=L+Math.imul(Ie,jt)|0,O=O+Math.imul(fe,kt)|0,v=v+Math.imul(fe,vt)|0,v=v+Math.imul(ue,kt)|0,L=L+Math.imul(ue,vt)|0;var Is=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Is>>>26)|0,Is&=67108863,O=Math.imul(Te,Je),v=Math.imul(Te,Ve),v=v+Math.imul($e,Je)|0,L=Math.imul($e,Ve),O=O+Math.imul(be,Xe)|0,v=v+Math.imul(be,et)|0,v=v+Math.imul(Pe,Xe)|0,L=L+Math.imul(Pe,et)|0,O=O+Math.imul(we,tt)|0,v=v+Math.imul(we,Qe)|0,v=v+Math.imul(xe,tt)|0,L=L+Math.imul(xe,Qe)|0,O=O+Math.imul(Ee,Ze)|0,v=v+Math.imul(Ee,ke)|0,v=v+Math.imul(Ae,Ze)|0,L=L+Math.imul(Ae,ke)|0,O=O+Math.imul(ze,rt)|0,v=v+Math.imul(ze,jt)|0,v=v+Math.imul(Ce,rt)|0,L=L+Math.imul(Ce,jt)|0,O=O+Math.imul(Me,kt)|0,v=v+Math.imul(Me,vt)|0,v=v+Math.imul(Ie,kt)|0,L=L+Math.imul(Ie,vt)|0;var Ds=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Ds>>>26)|0,Ds&=67108863,O=Math.imul(Te,Xe),v=Math.imul(Te,et),v=v+Math.imul($e,Xe)|0,L=Math.imul($e,et),O=O+Math.imul(be,tt)|0,v=v+Math.imul(be,Qe)|0,v=v+Math.imul(Pe,tt)|0,L=L+Math.imul(Pe,Qe)|0,O=O+Math.imul(we,Ze)|0,v=v+Math.imul(we,ke)|0,v=v+Math.imul(xe,Ze)|0,L=L+Math.imul(xe,ke)|0,O=O+Math.imul(Ee,rt)|0,v=v+Math.imul(Ee,jt)|0,v=v+Math.imul(Ae,rt)|0,L=L+Math.imul(Ae,jt)|0,O=O+Math.imul(ze,kt)|0,v=v+Math.imul(ze,vt)|0,v=v+Math.imul(Ce,kt)|0,L=L+Math.imul(Ce,vt)|0;var Gr=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,O=Math.imul(Te,tt),v=Math.imul(Te,Qe),v=v+Math.imul($e,tt)|0,L=Math.imul($e,Qe),O=O+Math.imul(be,Ze)|0,v=v+Math.imul(be,ke)|0,v=v+Math.imul(Pe,Ze)|0,L=L+Math.imul(Pe,ke)|0,O=O+Math.imul(we,rt)|0,v=v+Math.imul(we,jt)|0,v=v+Math.imul(xe,rt)|0,L=L+Math.imul(xe,jt)|0,O=O+Math.imul(Ee,kt)|0,v=v+Math.imul(Ee,vt)|0,v=v+Math.imul(Ae,kt)|0,L=L+Math.imul(Ae,vt)|0;var wo=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(wo>>>26)|0,wo&=67108863,O=Math.imul(Te,Ze),v=Math.imul(Te,ke),v=v+Math.imul($e,Ze)|0,L=Math.imul($e,ke),O=O+Math.imul(be,rt)|0,v=v+Math.imul(be,jt)|0,v=v+Math.imul(Pe,rt)|0,L=L+Math.imul(Pe,jt)|0,O=O+Math.imul(we,kt)|0,v=v+Math.imul(we,vt)|0,v=v+Math.imul(xe,kt)|0,L=L+Math.imul(xe,vt)|0;var bo=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(bo>>>26)|0,bo&=67108863,O=Math.imul(Te,rt),v=Math.imul(Te,jt),v=v+Math.imul($e,rt)|0,L=Math.imul($e,jt),O=O+Math.imul(be,kt)|0,v=v+Math.imul(be,vt)|0,v=v+Math.imul(Pe,kt)|0,L=L+Math.imul(Pe,vt)|0;var _o=(U+O|0)+((v&8191)<<13)|0;U=(L+(v>>>13)|0)+(_o>>>26)|0,_o&=67108863,O=Math.imul(Te,kt),v=Math.imul(Te,vt),v=v+Math.imul($e,kt)|0,L=Math.imul($e,vt);var Eo=(U+O|0)+((v&8191)<<13)|0;return U=(L+(v>>>13)|0)+(Eo>>>26)|0,Eo&=67108863,N[0]=Bn,N[1]=Un,N[2]=Fn,N[3]=jn,N[4]=kn,N[5]=xr,N[6]=Ii,N[7]=mo,N[8]=Di,N[9]=vo,N[10]=yo,N[11]=Ci,N[12]=Is,N[13]=Ds,N[14]=Gr,N[15]=wo,N[16]=bo,N[17]=_o,N[18]=Eo,U!==0&&(N[19]=U,b.length++),b};Math.imul||(F=Y);function z(p,d,b){b.negative=d.negative^p.negative,b.length=p.length+d.length;for(var D=0,M=0,N=0;N<b.length-1;N++){var U=M;M=0;for(var O=D&67108863,v=Math.min(N,d.length-1),L=Math.max(0,N-p.length+1);L<=v;L++){var oe=N-L,de=p.words[oe]|0,x=d.words[L]|0,ne=de*x,q=ne&67108863;U=U+(ne/67108864|0)|0,q=q+O|0,O=q&67108863,U=U+(q>>>26)|0,M+=U>>>26,U&=67108863}b.words[N]=O,D=U,U=M}return D!==0?b.words[N]=D:b.length--,b._strip()}function $(p,d,b){return z(p,d,b)}s.prototype.mulTo=function(p,d){var b,D=this.length+p.length;return this.length===10&&p.length===10?b=F(this,p,d):D<63?b=Y(this,p,d):D<1024?b=z(this,p,d):b=$(this,p,d),b},s.prototype.mul=function(p){var d=new s(null);return d.words=new Array(this.length+p.length),this.mulTo(p,d)},s.prototype.mulf=function(p){var d=new s(null);return d.words=new Array(this.length+p.length),$(this,p,d)},s.prototype.imul=function(p){return this.clone().mulTo(p,this)},s.prototype.imuln=function(p){var d=p<0;d&&(p=-p),n(typeof p=="number"),n(p<67108864);for(var b=0,D=0;D<this.length;D++){var M=(this.words[D]|0)*p,N=(M&67108863)+(b&67108863);b>>=26,b+=M/67108864|0,b+=N>>>26,this.words[D]=N&67108863}return b!==0&&(this.words[D]=b,this.length++),d?this.ineg():this},s.prototype.muln=function(p){return this.clone().imuln(p)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(p){var d=W(p);if(d.length===0)return new s(1);for(var b=this,D=0;D<d.length&&d[D]===0;D++,b=b.sqr());if(++D<d.length)for(var M=b.sqr();D<d.length;D++,M=M.sqr())d[D]!==0&&(b=b.mul(M));return b},s.prototype.iushln=function(p){n(typeof p=="number"&&p>=0);var d=p%26,b=(p-d)/26,D=67108863>>>26-d<<26-d,M;if(d!==0){var N=0;for(M=0;M<this.length;M++){var U=this.words[M]&D,O=(this.words[M]|0)-U<<d;this.words[M]=O|N,N=U>>>26-d}N&&(this.words[M]=N,this.length++)}if(b!==0){for(M=this.length-1;M>=0;M--)this.words[M+b]=this.words[M];for(M=0;M<b;M++)this.words[M]=0;this.length+=b}return this._strip()},s.prototype.ishln=function(p){return n(this.negative===0),this.iushln(p)},s.prototype.iushrn=function(p,d,b){n(typeof p=="number"&&p>=0);var D;d?D=(d-d%26)/26:D=0;var M=p%26,N=Math.min((p-M)/26,this.length),U=67108863^67108863>>>M<<M,O=b;if(D-=N,D=Math.max(0,D),O){for(var v=0;v<N;v++)O.words[v]=this.words[v];O.length=N}if(N!==0)if(this.length>N)for(this.length-=N,v=0;v<this.length;v++)this.words[v]=this.words[v+N];else this.words[0]=0,this.length=1;var L=0;for(v=this.length-1;v>=0&&(L!==0||v>=D);v--){var oe=this.words[v]|0;this.words[v]=L<<26-M|oe>>>M,L=oe&U}return O&&L!==0&&(O.words[O.length++]=L),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(p,d,b){return n(this.negative===0),this.iushrn(p,d,b)},s.prototype.shln=function(p){return this.clone().ishln(p)},s.prototype.ushln=function(p){return this.clone().iushln(p)},s.prototype.shrn=function(p){return this.clone().ishrn(p)},s.prototype.ushrn=function(p){return this.clone().iushrn(p)},s.prototype.testn=function(p){n(typeof p=="number"&&p>=0);var d=p%26,b=(p-d)/26,D=1<<d;if(this.length<=b)return!1;var M=this.words[b];return!!(M&D)},s.prototype.imaskn=function(p){n(typeof p=="number"&&p>=0);var d=p%26,b=(p-d)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=b)return this;if(d!==0&&b++,this.length=Math.min(b,this.length),d!==0){var D=67108863^67108863>>>d<<d;this.words[this.length-1]&=D}return this._strip()},s.prototype.maskn=function(p){return this.clone().imaskn(p)},s.prototype.iaddn=function(p){return n(typeof p=="number"),n(p<67108864),p<0?this.isubn(-p):this.negative!==0?this.length===1&&(this.words[0]|0)<=p?(this.words[0]=p-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(p),this.negative=1,this):this._iaddn(p)},s.prototype._iaddn=function(p){this.words[0]+=p;for(var d=0;d<this.length&&this.words[d]>=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},s.prototype.isubn=function(p){if(n(typeof p=="number"),n(p<67108864),p<0)return this.iaddn(-p);if(this.negative!==0)return this.negative=0,this.iaddn(p),this.negative=1,this;if(this.words[0]-=p,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d<this.length&&this.words[d]<0;d++)this.words[d]+=67108864,this.words[d+1]-=1;return this._strip()},s.prototype.addn=function(p){return this.clone().iaddn(p)},s.prototype.subn=function(p){return this.clone().isubn(p)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(p,d,b){var D=p.length+b,M;this._expand(D);var N,U=0;for(M=0;M<p.length;M++){N=(this.words[M+b]|0)+U;var O=(p.words[M]|0)*d;N-=O&67108863,U=(N>>26)-(O/67108864|0),this.words[M+b]=N&67108863}for(;M<this.length-b;M++)N=(this.words[M+b]|0)+U,U=N>>26,this.words[M+b]=N&67108863;if(U===0)return this._strip();for(n(U===-1),U=0,M=0;M<this.length;M++)N=-(this.words[M]|0)+U,U=N>>26,this.words[M]=N&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(p,d){var b=this.length-p.length,D=this.clone(),M=p,N=M.words[M.length-1]|0,U=this._countBits(N);b=26-U,b!==0&&(M=M.ushln(b),D.iushln(b),N=M.words[M.length-1]|0);var O=D.length-M.length,v;if(d!=="mod"){v=new s(null),v.length=O+1,v.words=new Array(v.length);for(var L=0;L<v.length;L++)v.words[L]=0}var oe=D.clone()._ishlnsubmul(M,1,O);oe.negative===0&&(D=oe,v&&(v.words[O]=1));for(var de=O-1;de>=0;de--){var x=(D.words[M.length+de]|0)*67108864+(D.words[M.length+de-1]|0);for(x=Math.min(x/N|0,67108863),D._ishlnsubmul(M,x,de);D.negative!==0;)x--,D.negative=0,D._ishlnsubmul(M,1,de),D.isZero()||(D.negative^=1);v&&(v.words[de]=x)}return v&&v._strip(),D._strip(),d!=="div"&&b!==0&&D.iushrn(b),{div:v||null,mod:D}},s.prototype.divmod=function(p,d,b){if(n(!p.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var D,M,N;return this.negative!==0&&p.negative===0?(N=this.neg().divmod(p,d),d!=="mod"&&(D=N.div.neg()),d!=="div"&&(M=N.mod.neg(),b&&M.negative!==0&&M.iadd(p)),{div:D,mod:M}):this.negative===0&&p.negative!==0?(N=this.divmod(p.neg(),d),d!=="mod"&&(D=N.div.neg()),{div:D,mod:N.mod}):this.negative&p.negative?(N=this.neg().divmod(p.neg(),d),d!=="div"&&(M=N.mod.neg(),b&&M.negative!==0&&M.isub(p)),{div:N.div,mod:M}):p.length>this.length||this.cmp(p)<0?{div:new s(0),mod:this}:p.length===1?d==="div"?{div:this.divn(p.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(p.words[0]))}:{div:this.divn(p.words[0]),mod:new s(this.modrn(p.words[0]))}:this._wordDiv(p,d)},s.prototype.div=function(p){return this.divmod(p,"div",!1).div},s.prototype.mod=function(p){return this.divmod(p,"mod",!1).mod},s.prototype.umod=function(p){return this.divmod(p,"mod",!0).mod},s.prototype.divRound=function(p){var d=this.divmod(p);if(d.mod.isZero())return d.div;var b=d.div.negative!==0?d.mod.isub(p):d.mod,D=p.ushrn(1),M=p.andln(1),N=b.cmp(D);return N<0||M===1&&N===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(p){var d=p<0;d&&(p=-p),n(p<=67108863);for(var b=(1<<26)%p,D=0,M=this.length-1;M>=0;M--)D=(b*D+(this.words[M]|0))%p;return d?-D:D},s.prototype.modn=function(p){return this.modrn(p)},s.prototype.idivn=function(p){var d=p<0;d&&(p=-p),n(p<=67108863);for(var b=0,D=this.length-1;D>=0;D--){var M=(this.words[D]|0)+b*67108864;this.words[D]=M/p|0,b=M%p}return this._strip(),d?this.ineg():this},s.prototype.divn=function(p){return this.clone().idivn(p)},s.prototype.egcd=function(p){n(p.negative===0),n(!p.isZero());var d=this,b=p.clone();d.negative!==0?d=d.umod(p):d=d.clone();for(var D=new s(1),M=new s(0),N=new s(0),U=new s(1),O=0;d.isEven()&&b.isEven();)d.iushrn(1),b.iushrn(1),++O;for(var v=b.clone(),L=d.clone();!d.isZero();){for(var oe=0,de=1;!(d.words[0]&de)&&oe<26;++oe,de<<=1);if(oe>0)for(d.iushrn(oe);oe-- >0;)(D.isOdd()||M.isOdd())&&(D.iadd(v),M.isub(L)),D.iushrn(1),M.iushrn(1);for(var x=0,ne=1;!(b.words[0]&ne)&&x<26;++x,ne<<=1);if(x>0)for(b.iushrn(x);x-- >0;)(N.isOdd()||U.isOdd())&&(N.iadd(v),U.isub(L)),N.iushrn(1),U.iushrn(1);d.cmp(b)>=0?(d.isub(b),D.isub(N),M.isub(U)):(b.isub(d),N.isub(D),U.isub(M))}return{a:N,b:U,gcd:b.iushln(O)}},s.prototype._invmp=function(p){n(p.negative===0),n(!p.isZero());var d=this,b=p.clone();d.negative!==0?d=d.umod(p):d=d.clone();for(var D=new s(1),M=new s(0),N=b.clone();d.cmpn(1)>0&&b.cmpn(1)>0;){for(var U=0,O=1;!(d.words[0]&O)&&U<26;++U,O<<=1);if(U>0)for(d.iushrn(U);U-- >0;)D.isOdd()&&D.iadd(N),D.iushrn(1);for(var v=0,L=1;!(b.words[0]&L)&&v<26;++v,L<<=1);if(v>0)for(b.iushrn(v);v-- >0;)M.isOdd()&&M.iadd(N),M.iushrn(1);d.cmp(b)>=0?(d.isub(b),D.isub(M)):(b.isub(d),M.isub(D))}var oe;return d.cmpn(1)===0?oe=D:oe=M,oe.cmpn(0)<0&&oe.iadd(p),oe},s.prototype.gcd=function(p){if(this.isZero())return p.abs();if(p.isZero())return this.abs();var d=this.clone(),b=p.clone();d.negative=0,b.negative=0;for(var D=0;d.isEven()&&b.isEven();D++)d.iushrn(1),b.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;b.isEven();)b.iushrn(1);var M=d.cmp(b);if(M<0){var N=d;d=b,b=N}else if(M===0||b.cmpn(1)===0)break;d.isub(b)}while(!0);return b.iushln(D)},s.prototype.invm=function(p){return this.egcd(p).a.umod(p)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(p){return this.words[0]&p},s.prototype.bincn=function(p){n(typeof p=="number");var d=p%26,b=(p-d)/26,D=1<<d;if(this.length<=b)return this._expand(b+1),this.words[b]|=D,this;for(var M=D,N=b;M!==0&&N<this.length;N++){var U=this.words[N]|0;U+=M,M=U>>>26,U&=67108863,this.words[N]=U}return M!==0&&(this.words[N]=M,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(p){var d=p<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var b;if(this.length>1)b=1;else{d&&(p=-p),n(p<=67108863,"Number is too big");var D=this.words[0]|0;b=D===p?0:D<p?-1:1}return this.negative!==0?-b|0:b},s.prototype.cmp=function(p){if(this.negative!==0&&p.negative===0)return-1;if(this.negative===0&&p.negative!==0)return 1;var d=this.ucmp(p);return this.negative!==0?-d|0:d},s.prototype.ucmp=function(p){if(this.length>p.length)return 1;if(this.length<p.length)return-1;for(var d=0,b=this.length-1;b>=0;b--){var D=this.words[b]|0,M=p.words[b]|0;if(D!==M){D<M?d=-1:D>M&&(d=1);break}}return d},s.prototype.gtn=function(p){return this.cmpn(p)===1},s.prototype.gt=function(p){return this.cmp(p)===1},s.prototype.gten=function(p){return this.cmpn(p)>=0},s.prototype.gte=function(p){return this.cmp(p)>=0},s.prototype.ltn=function(p){return this.cmpn(p)===-1},s.prototype.lt=function(p){return this.cmp(p)===-1},s.prototype.lten=function(p){return this.cmpn(p)<=0},s.prototype.lte=function(p){return this.cmp(p)<=0},s.prototype.eqn=function(p){return this.cmpn(p)===0},s.prototype.eq=function(p){return this.cmp(p)===0},s.red=function(p){return new te(p)},s.prototype.toRed=function(p){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),p.convertTo(this)._forceRed(p)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(p){return this.red=p,this},s.prototype.forceRed=function(p){return n(!this.red,"Already a number in reduction context"),this._forceRed(p)},s.prototype.redAdd=function(p){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,p)},s.prototype.redIAdd=function(p){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,p)},s.prototype.redSub=function(p){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,p)},s.prototype.redISub=function(p){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,p)},s.prototype.redShl=function(p){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,p)},s.prototype.redMul=function(p){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.mul(this,p)},s.prototype.redIMul=function(p){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,p),this.red.imul(this,p)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(p){return n(this.red&&!p.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,p)};var j={k256:null,p224:null,p192:null,p25519:null};function P(p,d){this.name=p,this.p=new s(d,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}P.prototype._tmp=function(){var p=new s(null);return p.words=new Array(Math.ceil(this.n/13)),p},P.prototype.ireduce=function(p){var d=p,b;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),b=d.bitLength();while(b>this.n);var D=b<this.n?-1:d.ucmp(this.p);return D===0?(d.words[0]=0,d.length=1):D>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},P.prototype.split=function(p,d){p.iushrn(this.n,0,d)},P.prototype.imulK=function(p){return p.imul(this.k)};function g(){P.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(g,P),g.prototype.split=function(p,d){for(var b=4194303,D=Math.min(p.length,9),M=0;M<D;M++)d.words[M]=p.words[M];if(d.length=D,p.length<=9){p.words[0]=0,p.length=1;return}var N=p.words[9];for(d.words[d.length++]=N&b,M=10;M<p.length;M++){var U=p.words[M]|0;p.words[M-10]=(U&b)<<4|N>>>22,N=U}N>>>=22,p.words[M-10]=N,N===0&&p.length>10?p.length-=10:p.length-=9},g.prototype.imulK=function(p){p.words[p.length]=0,p.words[p.length+1]=0,p.length+=2;for(var d=0,b=0;b<p.length;b++){var D=p.words[b]|0;d+=D*977,p.words[b]=d&67108863,d=D*64+(d/67108864|0)}return p.words[p.length-1]===0&&(p.length--,p.words[p.length-1]===0&&p.length--),p};function C(){P.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(C,P);function Z(){P.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(Z,P);function J(){P.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(J,P),J.prototype.imulK=function(p){for(var d=0,b=0;b<p.length;b++){var D=(p.words[b]|0)*19+d,M=D&67108863;D>>>=26,p.words[b]=M,d=D}return d!==0&&(p.words[p.length++]=d),p},s._prime=function(p){if(j[p])return j[p];var d;if(p==="k256")d=new g;else if(p==="p224")d=new C;else if(p==="p192")d=new Z;else if(p==="p25519")d=new J;else throw new Error("Unknown prime "+p);return j[p]=d,d};function te(p){if(typeof p=="string"){var d=s._prime(p);this.m=d.p,this.prime=d}else n(p.gtn(1),"modulus must be greater than 1"),this.m=p,this.prime=null}te.prototype._verify1=function(p){n(p.negative===0,"red works only with positives"),n(p.red,"red works only with red numbers")},te.prototype._verify2=function(p,d){n((p.negative|d.negative)===0,"red works only with positives"),n(p.red&&p.red===d.red,"red works only with red numbers")},te.prototype.imod=function(p){return this.prime?this.prime.ireduce(p)._forceRed(this):(m(p,p.umod(this.m)._forceRed(this)),p)},te.prototype.neg=function(p){return p.isZero()?p.clone():this.m.sub(p)._forceRed(this)},te.prototype.add=function(p,d){this._verify2(p,d);var b=p.add(d);return b.cmp(this.m)>=0&&b.isub(this.m),b._forceRed(this)},te.prototype.iadd=function(p,d){this._verify2(p,d);var b=p.iadd(d);return b.cmp(this.m)>=0&&b.isub(this.m),b},te.prototype.sub=function(p,d){this._verify2(p,d);var b=p.sub(d);return b.cmpn(0)<0&&b.iadd(this.m),b._forceRed(this)},te.prototype.isub=function(p,d){this._verify2(p,d);var b=p.isub(d);return b.cmpn(0)<0&&b.iadd(this.m),b},te.prototype.shl=function(p,d){return this._verify1(p),this.imod(p.ushln(d))},te.prototype.imul=function(p,d){return this._verify2(p,d),this.imod(p.imul(d))},te.prototype.mul=function(p,d){return this._verify2(p,d),this.imod(p.mul(d))},te.prototype.isqr=function(p){return this.imul(p,p.clone())},te.prototype.sqr=function(p){return this.mul(p,p)},te.prototype.sqrt=function(p){if(p.isZero())return p.clone();var d=this.m.andln(3);if(n(d%2===1),d===3){var b=this.m.add(new s(1)).iushrn(2);return this.pow(p,b)}for(var D=this.m.subn(1),M=0;!D.isZero()&&D.andln(1)===0;)M++,D.iushrn(1);n(!D.isZero());var N=new s(1).toRed(this),U=N.redNeg(),O=this.m.subn(1).iushrn(1),v=this.m.bitLength();for(v=new s(2*v*v).toRed(this);this.pow(v,O).cmp(U)!==0;)v.redIAdd(U);for(var L=this.pow(v,D),oe=this.pow(p,D.addn(1).iushrn(1)),de=this.pow(p,D),x=M;de.cmp(N)!==0;){for(var ne=de,q=0;ne.cmp(N)!==0;q++)ne=ne.redSqr();n(q<x);var H=this.pow(L,new s(1).iushln(x-q-1));oe=oe.redMul(H),L=H.redSqr(),de=de.redMul(L),x=q}return oe},te.prototype.invm=function(p){var d=p._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},te.prototype.pow=function(p,d){if(d.isZero())return new s(1).toRed(this);if(d.cmpn(1)===0)return p.clone();var b=4,D=new Array(1<<b);D[0]=new s(1).toRed(this),D[1]=p;for(var M=2;M<D.length;M++)D[M]=this.mul(D[M-1],p);var N=D[0],U=0,O=0,v=d.bitLength()%26;for(v===0&&(v=26),M=d.length-1;M>=0;M--){for(var L=d.words[M],oe=v-1;oe>=0;oe--){var de=L>>oe&1;if(N!==D[0]&&(N=this.sqr(N)),de===0&&U===0){O=0;continue}U<<=1,U|=de,O++,!(O!==b&&(M!==0||oe!==0))&&(N=this.mul(N,D[U]),O=0,U=0)}v=26}return N},te.prototype.convertTo=function(p){var d=p.umod(this.m);return d===p?d.clone():d},te.prototype.convertFrom=function(p){var d=p.clone();return d.red=null,d},s.mont=function(p){return new ae(p)};function ae(p){te.call(this,p),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(ae,te),ae.prototype.convertTo=function(p){return this.imod(p.ushln(this.shift))},ae.prototype.convertFrom=function(p){var d=this.imod(p.mul(this.rinv));return d.red=null,d},ae.prototype.imul=function(p,d){if(p.isZero()||d.isZero())return p.words[0]=0,p.length=1,p;var b=p.imul(d),D=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=b.isub(D).iushrn(this.shift),N=M;return M.cmp(this.m)>=0?N=M.isub(this.m):M.cmpn(0)<0&&(N=M.iadd(this.m)),N._forceRed(this)},ae.prototype.mul=function(p,d){if(p.isZero()||d.isZero())return new s(0)._forceRed(this);var b=p.mul(d),D=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),M=b.isub(D).iushrn(this.shift),N=M;return M.cmp(this.m)>=0?N=M.isub(this.m):M.cmpn(0)<0&&(N=M.iadd(this.m)),N._forceRed(this)},ae.prototype.invm=function(p){var d=this.imod(p._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(t,lg)})(bg);var st=bg.exports;const _g="bignumber/5.7.0";var _l=st.BN;const Ni=new ut(_g),lf={},Eg=9007199254740991;function t8(t){return t!=null&&(Qt.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||pn(t)||typeof t=="bigint"||zo(t))}let Ag=!1;class Qt{constructor(e,r){e!==lf&&Ni.throwError("cannot call constructor directly; use BigNumber.from",ut.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return en(bt(this).fromTwos(e))}toTwos(e){return en(bt(this).toTwos(e))}abs(){return this._hex[0]==="-"?Qt.from(this._hex.substring(1)):this}add(e){return en(bt(this).add(bt(e)))}sub(e){return en(bt(this).sub(bt(e)))}div(e){return Qt.from(e).isZero()&&Cn("division-by-zero","div"),en(bt(this).div(bt(e)))}mul(e){return en(bt(this).mul(bt(e)))}mod(e){const r=bt(e);return r.isNeg()&&Cn("division-by-zero","mod"),en(bt(this).umod(r))}pow(e){const r=bt(e);return r.isNeg()&&Cn("negative-power","pow"),en(bt(this).pow(r))}and(e){const r=bt(e);return(this.isNegative()||r.isNeg())&&Cn("unbound-bitwise-result","and"),en(bt(this).and(r))}or(e){const r=bt(e);return(this.isNegative()||r.isNeg())&&Cn("unbound-bitwise-result","or"),en(bt(this).or(r))}xor(e){const r=bt(e);return(this.isNegative()||r.isNeg())&&Cn("unbound-bitwise-result","xor"),en(bt(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&Cn("negative-width","mask"),en(bt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Cn("negative-width","shl"),en(bt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Cn("negative-width","shr"),en(bt(this).shrn(e))}eq(e){return bt(this).eq(bt(e))}lt(e){return bt(this).lt(bt(e))}lte(e){return bt(this).lte(bt(e))}gt(e){return bt(this).gt(bt(e))}gte(e){return bt(this).gte(bt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return bt(this).isZero()}toNumber(){try{return bt(this).toNumber()}catch{Cn("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ni.throwError("this platform does not support BigInt",ut.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Ag||(Ag=!0,Ni.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ni.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ut.errors.UNEXPECTED_ARGUMENT,{}):Ni.throwError("BigNumber.toString does not accept parameters",ut.errors.UNEXPECTED_ARGUMENT,{})),bt(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Qt)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Qt(lf,Qa(e)):e.match(/^-?[0-9]+$/)?new Qt(lf,Qa(new _l(e))):Ni.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Cn("underflow","BigNumber.from",e),(e>=Eg||e<=-Eg)&&Cn("overflow","BigNumber.from",e),Qt.from(String(e));const r=e;if(typeof r=="bigint")return Qt.from(r.toString());if(zo(r))return Qt.from(jr(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return Qt.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(pn(n)||n[0]==="-"&&pn(n.substring(1))))return Qt.from(n)}return Ni.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Qa(t){if(typeof t!="string")return Qa(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ni.throwArgumentError("invalid hex","value",t),t=Qa(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function en(t){return Qt.from(Qa(t))}function bt(t){const e=Qt.from(t).toHexString();return e[0]==="-"?new _l("-"+e.substring(3),16):new _l(e.substring(2),16)}function Cn(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),Ni.throwError(t,ut.errors.NUMERIC_FAULT,n)}function r8(t){return new _l(t,36).toString(16)}const kr=new ut(_g),Za={},xg=Qt.from(0),Sg=Qt.from(-1);function Ig(t,e,r,n){const i={fault:e,operation:r};return n!==void 0&&(i.value=n),kr.throwError(t,ut.errors.NUMERIC_FAULT,i)}let Xa="0";for(;Xa.length<256;)Xa+=Xa;function uf(t){if(typeof t!="number")try{t=Qt.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+Xa.substring(0,t):kr.throwArgumentError("invalid decimal size","decimals",t)}function hf(t,e){e==null&&(e=0);const r=uf(e);t=Qt.from(t);const n=t.lt(xg);n&&(t=t.mul(Sg));let i=t.mod(r).toString();for(;i.length<r.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=t.div(r).toString();return r.length===1?t=s:t=s+"."+i,n&&(t="-"+t),t}function Ri(t,e){e==null&&(e=0);const r=uf(e);(typeof t!="string"||!t.match(/^-?[0-9.]+$/))&&kr.throwArgumentError("invalid decimal value","value",t);const n=t.substring(0,1)==="-";n&&(t=t.substring(1)),t==="."&&kr.throwArgumentError("missing value","value",t);const i=t.split(".");i.length>2&&kr.throwArgumentError("too many decimal points","value",t);let s=i[0],c=i[1];for(s||(s="0"),c||(c="0");c[c.length-1]==="0";)c=c.substring(0,c.length-1);for(c.length>r.length-1&&Ig("fractional component exceeds decimals","underflow","parseFixed"),c===""&&(c="0");c.length<r.length-1;)c+="0";const l=Qt.from(s),f=Qt.from(c);let h=l.mul(r).add(f);return n&&(h=h.mul(Sg)),h}class Ho{constructor(e,r,n,i){e!==Za&&kr.throwError("cannot use FixedFormat constructor; use FixedFormat.from",ut.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=r,this.width=n,this.decimals=i,this.name=(r?"":"u")+"fixed"+String(n)+"x"+String(i),this._multiplier=uf(i),Object.freeze(this)}static from(e){if(e instanceof Ho)return e;typeof e=="number"&&(e=`fixed128x${e}`);let r=!0,n=128,i=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")r=!1;else{const s=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);s||kr.throwArgumentError("invalid fixed format","format",e),r=s[1]!=="u",n=parseInt(s[2]),i=parseInt(s[3])}}else if(e){const s=(c,l,f)=>e[c]==null?f:(typeof e[c]!==l&&kr.throwArgumentError("invalid fixed format ("+c+" not "+l+")","format."+c,e[c]),e[c]);r=s("signed","boolean",r),n=s("width","number",n),i=s("decimals","number",i)}return n%8&&kr.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),i>80&&kr.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new Ho(Za,r,n,i)}}class Or{constructor(e,r,n,i){e!==Za&&kr.throwError("cannot use FixedNumber constructor; use FixedNumber.from",ut.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=r,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&kr.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const r=Ri(this._value,this.format.decimals),n=Ri(e._value,e.format.decimals);return Or.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const r=Ri(this._value,this.format.decimals),n=Ri(e._value,e.format.decimals);return Or.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const r=Ri(this._value,this.format.decimals),n=Ri(e._value,e.format.decimals);return Or.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const r=Ri(this._value,this.format.decimals),n=Ri(e._value,e.format.decimals);return Or.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=Or.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(Dg.toFormat(r.format))),r}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=Or.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(Dg.toFormat(r.format))),r}round(e){e==null&&(e=0);const r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&kr.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;const n=Or.from("1"+Xa.substring(0,e),this.format),i=n8.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).floor().divUnsafe(n)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&kr.throwArgumentError("invalid byte width","width",e);const r=Qt.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return li(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Or.fromString(this._value,e)}static fromValue(e,r,n){return n==null&&r!=null&&!t8(r)&&(n=r,r=null),r==null&&(r=0),n==null&&(n="fixed"),Or.fromString(hf(e,r),Ho.from(n))}static fromString(e,r){r==null&&(r="fixed");const n=Ho.from(r),i=Ri(e,n.decimals);!n.signed&&i.lt(xg)&&Ig("unsigned value cannot be negative","overflow","value",e);let s=null;n.signed?s=i.toTwos(n.width).toHexString():(s=i.toHexString(),s=li(s,n.width/8));const c=hf(i,n.decimals);return new Or(Za,s,c,n)}static fromBytes(e,r){r==null&&(r="fixed");const n=Ho.from(r);if(or(e).length>n.width/8)throw new Error("overflow");let i=Qt.from(e);n.signed&&(i=i.fromTwos(n.width));const s=i.toTwos((n.signed?0:1)+n.width).toHexString(),c=hf(i,n.decimals);return new Or(Za,s,c,n)}static from(e,r){if(typeof e=="string")return Or.fromString(e,r);if(zo(e))return Or.fromBytes(e,r);try{return Or.fromValue(e,0,r)}catch(n){if(n.code!==ut.errors.INVALID_ARGUMENT)throw n}return kr.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}}const Dg=Or.from(1),n8=Or.from("0.5"),i8="strings/5.7.0",Cg=new ut(i8);var El;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(El||(El={}));var Ko;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Ko||(Ko={}));function s8(t,e,r,n,i){return Cg.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function Og(t,e,r,n,i){if(t===Ko.BAD_PREFIX||t===Ko.UNEXPECTED_CONTINUE){let s=0;for(let c=e+1;c<r.length&&r[c]>>6===2;c++)s++;return s}return t===Ko.OVERRUN?r.length-e-1:0}function o8(t,e,r,n,i){return t===Ko.OVERLONG?(n.push(i),0):(n.push(65533),Og(t,e,r))}Object.freeze({error:s8,ignore:Og,replace:o8});function ff(t,e=El.current){e!=El.current&&(Cg.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n<t.length;n++){const i=t.charCodeAt(n);if(i<128)r.push(i);else if(i<2048)r.push(i>>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const s=t.charCodeAt(n);if(n>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const c=65536+((i&1023)<<10)+(s&1023);r.push(c>>18|240),r.push(c>>12&63|128),r.push(c>>6&63|128),r.push(c&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return or(r)}function a8(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e}function df(t,e){e||(e=function(i){return[parseInt(i,16)]});let r=0,n={};return t.split(",").forEach(i=>{let s=i.split(":");r+=parseInt(s[0],16),n[r]=e(s[1])}),n}function Pg(t){let e=0;return t.split(",").map(r=>{let n=r.split("-");n.length===1?n[1]="0":n[1]===""&&(n[1]="1");let i=e+parseInt(n[0],16);return e=parseInt(n[1],16),{l:i,h:e}})}Pg("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),df("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),df("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),df("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",a8),Pg("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const Mg="hash/5.7.0";function c8(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return or(e)}function Tg(t,e){e==null&&(e=1);const r=[],n=r.forEach,i=function(s,c){n.call(s,function(l){c>0&&Array.isArray(l)?i(l,c-1):r.push(l)})};return i(t,e),r}function l8(t){const e={};for(let r=0;r<t.length;r++){const n=t[r];e[n[0]]=n[1]}return e}function u8(t){let e=0;function r(){return t[e++]<<8|t[e++]}let n=r(),i=1,s=[0,1];for(let j=1;j<n;j++)s.push(i+=r());let c=r(),l=e;e+=c;let f=0,h=0;function m(){return f==0&&(h=h<<8|t[e++],f=8),h>>--f&1}const _=31,E=Math.pow(2,_),A=E>>>1,I=A>>1,R=E-1;let W=0;for(let j=0;j<_;j++)W=W<<1|m();let Y=[],F=0,z=E;for(;;){let j=Math.floor(((W-F+1)*i-1)/z),P=0,g=n;for(;g-P>1;){let J=P+g>>>1;j<s[J]?g=J:P=J}if(P==0)break;Y.push(P);let C=F+Math.floor(z*s[P]/i),Z=F+Math.floor(z*s[P+1]/i)-1;for(;!((C^Z)&A);)W=W<<1&R|m(),C=C<<1&R,Z=Z<<1&R|1;for(;C&~Z&I;)W=W&A|W<<1&R>>>1|m(),C=C<<1^A,Z=(Z^A)<<1|A|1;F=C,z=1+Z-C}let $=n-4;return Y.map(j=>{switch(j-$){case 3:return $+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return $+256+(t[l++]<<8|t[l++]);case 1:return $+t[l++];default:return j-1}})}function h8(t){let e=0;return()=>t[e++]}function f8(t){return h8(u8(t))}function d8(t){return t&1?~t>>1:t>>1}function p8(t,e){let r=Array(t);for(let n=0;n<t;n++)r[n]=1+e();return r}function $g(t,e){let r=Array(t);for(let n=0,i=-1;n<t;n++)r[n]=i+=1+e();return r}function g8(t,e){let r=Array(t);for(let n=0,i=0;n<t;n++)r[n]=i+=d8(e());return r}function Al(t,e){let r=$g(t(),t),n=t(),i=$g(n,t),s=p8(n,t);for(let c=0;c<n;c++)for(let l=0;l<s[c];l++)r.push(i[c]+l);return e?r.map(c=>e[c]):r}function m8(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(y8(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(w8(r,t))}return l8(Tg(e))}function v8(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function Ng(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;i<e;i++)g8(t,r).forEach((s,c)=>n[c].push(s));return n}function y8(t,e){let r=1+e(),n=e(),i=v8(e),s=Ng(i.length,1+t,e);return Tg(s.map((c,l)=>{const f=c[0],h=c.slice(1);return Array(i[l]).fill(void 0).map((m,_)=>{let E=_*n;return[f+_*r,h.map(A=>A+E)]})}))}function w8(t,e){let r=1+e();return Ng(r,1+t,e).map(n=>[n[0],n.slice(1)])}function b8(t){let e=Al(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let h=Al(t,e);if(h.length==0)break;n.push({set:new Set(h),node:r()})}n.sort((h,m)=>m.set.size-h.set.size);let i=t(),s=i%3;i=i/3|0;let c=!!(i&1);i>>=1;let l=i==1,f=i==2;return{branches:n,valid:s,fe0f:c,save:l,check:f}}}function _8(){return f8(c8("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const xl=_8();new Set(Al(xl)),new Set(Al(xl)),m8(xl),b8(xl),new ut(Mg),new Uint8Array(32).fill(0);const E8=`Ethereum Signed Message:
22
+ `;function Rg(t){return typeof t=="string"&&(t=ff(t)),cf(Y_([ff(E8),ff(String(t.length)),t]))}const A8="rlp/5.7.0";new ut(A8);const x8="address/5.7.0",ec=new ut(x8);function Lg(t){pn(t,20)||ec.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=or(cf(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const S8=9007199254740991;function I8(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const pf={};for(let t=0;t<10;t++)pf[String(t)]=String(t);for(let t=0;t<26;t++)pf[String.fromCharCode(65+t)]=String(10+t);const Bg=Math.floor(I8(S8));function D8(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>pf[n]).join("");for(;e.length>=Bg;){let n=e.substring(0,Bg);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function C8(t){let e=null;if(typeof t!="string"&&ec.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Lg(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&ec.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==D8(t)&&ec.throwArgumentError("bad icap checksum","address",t),e=r8(t.substring(4));e.length<40;)e="0"+e;e=Lg("0x"+e)}else ec.throwArgumentError("invalid address","address",t);return e}const O8="properties/5.7.0";new ut(O8);function tc(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}new ut(Mg),new Uint8Array(32).fill(0),Qt.from(-1);const P8=Qt.from(0),M8=Qt.from(1);Qt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),li(M8.toHexString(),32),li(P8.toHexString(),32);var ui={},_t={},rc=Ug;function Ug(t,e){if(!t)throw new Error(e||"Assertion failed")}Ug.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var gf={exports:{}};typeof Object.create=="function"?gf.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:gf.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var T8=rc,$8=gf.exports;_t.inherits=$8;function N8(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function R8(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var s=t.charCodeAt(i);s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=s&63|128):N8(t,i)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128)}else for(i=0;i<t.length;i++)r[i]=t[i]|0;return r}_t.toArray=R8;function L8(t){for(var e="",r=0;r<t.length;r++)e+=jg(t[r].toString(16));return e}_t.toHex=L8;function Fg(t){var e=t>>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}_t.htonl=Fg;function B8(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];e==="little"&&(i=Fg(i)),r+=kg(i.toString(16))}return r}_t.toHex32=B8;function jg(t){return t.length===1?"0"+t:t}_t.zero2=jg;function kg(t){return t.length===7?"0"+t:t.length===6?"00"+t:t.length===5?"000"+t:t.length===4?"0000"+t:t.length===3?"00000"+t:t.length===2?"000000"+t:t.length===1?"0000000"+t:t}_t.zero8=kg;function U8(t,e,r,n){var i=r-e;T8(i%4===0);for(var s=new Array(i/4),c=0,l=e;c<s.length;c++,l+=4){var f;n==="big"?f=t[l]<<24|t[l+1]<<16|t[l+2]<<8|t[l+3]:f=t[l+3]<<24|t[l+2]<<16|t[l+1]<<8|t[l],s[c]=f>>>0}return s}_t.join32=U8;function F8(t,e){for(var r=new Array(t.length*4),n=0,i=0;n<t.length;n++,i+=4){var s=t[n];e==="big"?(r[i]=s>>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=s&255)}return r}_t.split32=F8;function j8(t,e){return t>>>e|t<<32-e}_t.rotr32=j8;function k8(t,e){return t<<e|t>>>32-e}_t.rotl32=k8;function q8(t,e){return t+e>>>0}_t.sum32=q8;function z8(t,e,r){return t+e+r>>>0}_t.sum32_3=z8;function H8(t,e,r,n){return t+e+r+n>>>0}_t.sum32_4=H8;function K8(t,e,r,n,i){return t+e+r+n+i>>>0}_t.sum32_5=K8;function W8(t,e,r,n){var i=t[e],s=t[e+1],c=n+s>>>0,l=(c<n?1:0)+r+i;t[e]=l>>>0,t[e+1]=c}_t.sum64=W8;function V8(t,e,r,n){var i=e+n>>>0,s=(i<e?1:0)+t+r;return s>>>0}_t.sum64_hi=V8;function G8(t,e,r,n){var i=e+n;return i>>>0}_t.sum64_lo=G8;function Y8(t,e,r,n,i,s,c,l){var f=0,h=e;h=h+n>>>0,f+=h<e?1:0,h=h+s>>>0,f+=h<s?1:0,h=h+l>>>0,f+=h<l?1:0;var m=t+r+i+c+f;return m>>>0}_t.sum64_4_hi=Y8;function J8(t,e,r,n,i,s,c,l){var f=e+n+s+l;return f>>>0}_t.sum64_4_lo=J8;function Q8(t,e,r,n,i,s,c,l,f,h){var m=0,_=e;_=_+n>>>0,m+=_<e?1:0,_=_+s>>>0,m+=_<s?1:0,_=_+l>>>0,m+=_<l?1:0,_=_+h>>>0,m+=_<h?1:0;var E=t+r+i+c+f+m;return E>>>0}_t.sum64_5_hi=Q8;function Z8(t,e,r,n,i,s,c,l,f,h){var m=e+n+s+l+h;return m>>>0}_t.sum64_5_lo=Z8;function X8(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}_t.rotr64_hi=X8;function e4(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}_t.rotr64_lo=e4;function t4(t,e,r){return t>>>r}_t.shr64_hi=t4;function r4(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}_t.shr64_lo=r4;var Wo={},qg=_t,n4=rc;function Sl(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Wo.BlockHash=Sl,Sl.prototype.update=function(t,e){if(t=qg.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),this.pending.length===0&&(this.pending=null),t=qg.join32(t,0,t.length-r,this.endian);for(var n=0;n<t.length;n+=this._delta32)this._update(t,n,n+this._delta32)}return this},Sl.prototype.digest=function(t){return this.update(this._pad()),n4(this.pending===null),this._digest(t)},Sl.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(t<<=3,this.endian==="big"){for(var s=8;s<this.padLength;s++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=t>>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=t&255}else for(n[i++]=t&255,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,s=8;s<this.padLength;s++)n[i++]=0;return n};var Vo={},hi={},i4=_t,fi=i4.rotr32;function s4(t,e,r,n){if(t===0)return zg(e,r,n);if(t===1||t===3)return Kg(e,r,n);if(t===2)return Hg(e,r,n)}hi.ft_1=s4;function zg(t,e,r){return t&e^~t&r}hi.ch32=zg;function Hg(t,e,r){return t&e^t&r^e&r}hi.maj32=Hg;function Kg(t,e,r){return t^e^r}hi.p32=Kg;function o4(t){return fi(t,2)^fi(t,13)^fi(t,22)}hi.s0_256=o4;function a4(t){return fi(t,6)^fi(t,11)^fi(t,25)}hi.s1_256=a4;function c4(t){return fi(t,7)^fi(t,18)^t>>>3}hi.g0_256=c4;function l4(t){return fi(t,17)^fi(t,19)^t>>>10}hi.g1_256=l4;var Go=_t,u4=Wo,h4=hi,mf=Go.rotl32,nc=Go.sum32,f4=Go.sum32_5,d4=h4.ft_1,Wg=u4.BlockHash,p4=[1518500249,1859775393,2400959708,3395469782];function di(){if(!(this instanceof di))return new di;Wg.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Go.inherits(di,Wg);var g4=di;di.blockSize=512,di.outSize=160,di.hmacStrength=80,di.padLength=64,di.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=mf(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var i=this.h[0],s=this.h[1],c=this.h[2],l=this.h[3],f=this.h[4];for(n=0;n<r.length;n++){var h=~~(n/20),m=f4(mf(i,5),d4(h,s,c,l),f,r[n],p4[h]);f=l,l=c,c=mf(s,30),s=i,i=m}this.h[0]=nc(this.h[0],i),this.h[1]=nc(this.h[1],s),this.h[2]=nc(this.h[2],c),this.h[3]=nc(this.h[3],l),this.h[4]=nc(this.h[4],f)},di.prototype._digest=function(t){return t==="hex"?Go.toHex32(this.h,"big"):Go.split32(this.h,"big")};var Yo=_t,m4=Wo,Jo=hi,v4=rc,Zn=Yo.sum32,y4=Yo.sum32_4,w4=Yo.sum32_5,b4=Jo.ch32,_4=Jo.maj32,E4=Jo.s0_256,A4=Jo.s1_256,x4=Jo.g0_256,S4=Jo.g1_256,Vg=m4.BlockHash,I4=[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 pi(){if(!(this instanceof pi))return new pi;Vg.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=I4,this.W=new Array(64)}Yo.inherits(pi,Vg);var Gg=pi;pi.blockSize=512,pi.outSize=256,pi.hmacStrength=192,pi.padLength=64,pi.prototype._update=function(t,e){for(var r=this.W,n=0;n<16;n++)r[n]=t[e+n];for(;n<r.length;n++)r[n]=y4(S4(r[n-2]),r[n-7],x4(r[n-15]),r[n-16]);var i=this.h[0],s=this.h[1],c=this.h[2],l=this.h[3],f=this.h[4],h=this.h[5],m=this.h[6],_=this.h[7];for(v4(this.k.length===r.length),n=0;n<r.length;n++){var E=w4(_,A4(f),b4(f,h,m),this.k[n],r[n]),A=Zn(E4(i),_4(i,s,c));_=m,m=h,h=f,f=Zn(l,E),l=c,c=s,s=i,i=Zn(E,A)}this.h[0]=Zn(this.h[0],i),this.h[1]=Zn(this.h[1],s),this.h[2]=Zn(this.h[2],c),this.h[3]=Zn(this.h[3],l),this.h[4]=Zn(this.h[4],f),this.h[5]=Zn(this.h[5],h),this.h[6]=Zn(this.h[6],m),this.h[7]=Zn(this.h[7],_)},pi.prototype._digest=function(t){return t==="hex"?Yo.toHex32(this.h,"big"):Yo.split32(this.h,"big")};var vf=_t,Yg=Gg;function Li(){if(!(this instanceof Li))return new Li;Yg.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}vf.inherits(Li,Yg);var D4=Li;Li.blockSize=512,Li.outSize=224,Li.hmacStrength=192,Li.padLength=64,Li.prototype._digest=function(t){return t==="hex"?vf.toHex32(this.h.slice(0,7),"big"):vf.split32(this.h.slice(0,7),"big")};var tn=_t,C4=Wo,O4=rc,gi=tn.rotr64_hi,mi=tn.rotr64_lo,Jg=tn.shr64_hi,Qg=tn.shr64_lo,ss=tn.sum64,yf=tn.sum64_hi,wf=tn.sum64_lo,P4=tn.sum64_4_hi,M4=tn.sum64_4_lo,T4=tn.sum64_5_hi,$4=tn.sum64_5_lo,Zg=C4.BlockHash,N4=[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 Xn(){if(!(this instanceof Xn))return new Xn;Zg.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=N4,this.W=new Array(160)}tn.inherits(Xn,Zg);var Xg=Xn;Xn.blockSize=1024,Xn.outSize=512,Xn.hmacStrength=192,Xn.padLength=128,Xn.prototype._prepareBlock=function(t,e){for(var r=this.W,n=0;n<32;n++)r[n]=t[e+n];for(;n<r.length;n+=2){var i=K4(r[n-4],r[n-3]),s=W4(r[n-4],r[n-3]),c=r[n-14],l=r[n-13],f=z4(r[n-30],r[n-29]),h=H4(r[n-30],r[n-29]),m=r[n-32],_=r[n-31];r[n]=P4(i,s,c,l,f,h,m,_),r[n+1]=M4(i,s,c,l,f,h,m,_)}},Xn.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,n=this.h[0],i=this.h[1],s=this.h[2],c=this.h[3],l=this.h[4],f=this.h[5],h=this.h[6],m=this.h[7],_=this.h[8],E=this.h[9],A=this.h[10],I=this.h[11],R=this.h[12],W=this.h[13],Y=this.h[14],F=this.h[15];O4(this.k.length===r.length);for(var z=0;z<r.length;z+=2){var $=Y,j=F,P=k4(_,E),g=q4(_,E),C=R4(_,E,A,I,R),Z=L4(_,E,A,I,R,W),J=this.k[z],te=this.k[z+1],ae=r[z],p=r[z+1],d=T4($,j,P,g,C,Z,J,te,ae,p),b=$4($,j,P,g,C,Z,J,te,ae,p);$=F4(n,i),j=j4(n,i),P=B4(n,i,s,c,l),g=U4(n,i,s,c,l,f);var D=yf($,j,P,g),M=wf($,j,P,g);Y=R,F=W,R=A,W=I,A=_,I=E,_=yf(h,m,d,b),E=wf(m,m,d,b),h=l,m=f,l=s,f=c,s=n,c=i,n=yf(d,b,D,M),i=wf(d,b,D,M)}ss(this.h,0,n,i),ss(this.h,2,s,c),ss(this.h,4,l,f),ss(this.h,6,h,m),ss(this.h,8,_,E),ss(this.h,10,A,I),ss(this.h,12,R,W),ss(this.h,14,Y,F)},Xn.prototype._digest=function(t){return t==="hex"?tn.toHex32(this.h,"big"):tn.split32(this.h,"big")};function R4(t,e,r,n,i){var s=t&r^~t&i;return s<0&&(s+=4294967296),s}function L4(t,e,r,n,i,s){var c=e&n^~e&s;return c<0&&(c+=4294967296),c}function B4(t,e,r,n,i){var s=t&r^t&i^r&i;return s<0&&(s+=4294967296),s}function U4(t,e,r,n,i,s){var c=e&n^e&s^n&s;return c<0&&(c+=4294967296),c}function F4(t,e){var r=gi(t,e,28),n=gi(e,t,2),i=gi(e,t,7),s=r^n^i;return s<0&&(s+=4294967296),s}function j4(t,e){var r=mi(t,e,28),n=mi(e,t,2),i=mi(e,t,7),s=r^n^i;return s<0&&(s+=4294967296),s}function k4(t,e){var r=gi(t,e,14),n=gi(t,e,18),i=gi(e,t,9),s=r^n^i;return s<0&&(s+=4294967296),s}function q4(t,e){var r=mi(t,e,14),n=mi(t,e,18),i=mi(e,t,9),s=r^n^i;return s<0&&(s+=4294967296),s}function z4(t,e){var r=gi(t,e,1),n=gi(t,e,8),i=Jg(t,e,7),s=r^n^i;return s<0&&(s+=4294967296),s}function H4(t,e){var r=mi(t,e,1),n=mi(t,e,8),i=Qg(t,e,7),s=r^n^i;return s<0&&(s+=4294967296),s}function K4(t,e){var r=gi(t,e,19),n=gi(e,t,29),i=Jg(t,e,6),s=r^n^i;return s<0&&(s+=4294967296),s}function W4(t,e){var r=mi(t,e,19),n=mi(e,t,29),i=Qg(t,e,6),s=r^n^i;return s<0&&(s+=4294967296),s}var bf=_t,em=Xg;function Bi(){if(!(this instanceof Bi))return new Bi;em.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}bf.inherits(Bi,em);var V4=Bi;Bi.blockSize=1024,Bi.outSize=384,Bi.hmacStrength=192,Bi.padLength=128,Bi.prototype._digest=function(t){return t==="hex"?bf.toHex32(this.h.slice(0,12),"big"):bf.split32(this.h.slice(0,12),"big")},Vo.sha1=g4,Vo.sha224=D4,Vo.sha256=Gg,Vo.sha384=V4,Vo.sha512=Xg;var tm={},Hs=_t,G4=Wo,Il=Hs.rotl32,rm=Hs.sum32,ic=Hs.sum32_3,nm=Hs.sum32_4,im=G4.BlockHash;function vi(){if(!(this instanceof vi))return new vi;im.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Hs.inherits(vi,im),tm.ripemd160=vi,vi.blockSize=512,vi.outSize=160,vi.hmacStrength=192,vi.padLength=64,vi.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],i=this.h[2],s=this.h[3],c=this.h[4],l=r,f=n,h=i,m=s,_=c,E=0;E<80;E++){var A=rm(Il(nm(r,sm(E,n,i,s),t[Q4[E]+e],Y4(E)),X4[E]),c);r=c,c=s,s=Il(i,10),i=n,n=A,A=rm(Il(nm(l,sm(79-E,f,h,m),t[Z4[E]+e],J4(E)),eE[E]),_),l=_,_=m,m=Il(h,10),h=f,f=A}A=ic(this.h[1],i,m),this.h[1]=ic(this.h[2],s,_),this.h[2]=ic(this.h[3],c,l),this.h[3]=ic(this.h[4],r,f),this.h[4]=ic(this.h[0],n,h),this.h[0]=A},vi.prototype._digest=function(t){return t==="hex"?Hs.toHex32(this.h,"little"):Hs.split32(this.h,"little")};function sm(t,e,r,n){return t<=15?e^r^n:t<=31?e&r|~e&n:t<=47?(e|~r)^n:t<=63?e&n|r&~n:e^(r|~n)}function Y4(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function J4(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var Q4=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Z4=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],X4=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],eE=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],tE=_t,rE=rc;function Qo(t,e,r){if(!(this instanceof Qo))return new Qo(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(tE.toArray(e,r))}var nE=Qo;Qo.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),rE(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=new this.Hash().update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=new this.Hash().update(t)},Qo.prototype.update=function(t,e){return this.inner.update(t,e),this},Qo.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=t;e.utils=_t,e.common=Wo,e.sha=Vo,e.ripemd=tm,e.hmac=nE,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(ui);function Zo(t,e,r){return r={path:e,exports:{},require:function(n,i){return iE(n,i??r.path)}},t(r,r.exports),r.exports}function iE(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var _f=om;function om(t,e){if(!t)throw new Error(e||"Assertion failed")}om.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var ei=Zo(function(t,e){var r=e;function n(c,l){if(Array.isArray(c))return c.slice();if(!c)return[];var f=[];if(typeof c!="string"){for(var h=0;h<c.length;h++)f[h]=c[h]|0;return f}if(l==="hex"){c=c.replace(/[^a-z0-9]+/ig,""),c.length%2!==0&&(c="0"+c);for(var h=0;h<c.length;h+=2)f.push(parseInt(c[h]+c[h+1],16))}else for(var h=0;h<c.length;h++){var m=c.charCodeAt(h),_=m>>8,E=m&255;_?f.push(_,E):f.push(E)}return f}r.toArray=n;function i(c){return c.length===1?"0"+c:c}r.zero2=i;function s(c){for(var l="",f=0;f<c.length;f++)l+=i(c[f].toString(16));return l}r.toHex=s,r.encode=function(c,l){return l==="hex"?s(c):c}}),gn=Zo(function(t,e){var r=e;r.assert=_f,r.toArray=ei.toArray,r.zero2=ei.zero2,r.toHex=ei.toHex,r.encode=ei.encode;function n(f,h,m){var _=new Array(Math.max(f.bitLength(),m)+1);_.fill(0);for(var E=1<<h+1,A=f.clone(),I=0;I<_.length;I++){var R,W=A.andln(E-1);A.isOdd()?(W>(E>>1)-1?R=(E>>1)-W:R=W,A.isubn(R)):R=0,_[I]=R,A.iushrn(1)}return _}r.getNAF=n;function i(f,h){var m=[[],[]];f=f.clone(),h=h.clone();for(var _=0,E=0,A;f.cmpn(-_)>0||h.cmpn(-E)>0;){var I=f.andln(3)+_&3,R=h.andln(3)+E&3;I===3&&(I=-1),R===3&&(R=-1);var W;I&1?(A=f.andln(7)+_&7,(A===3||A===5)&&R===2?W=-I:W=I):W=0,m[0].push(W);var Y;R&1?(A=h.andln(7)+E&7,(A===3||A===5)&&I===2?Y=-R:Y=R):Y=0,m[1].push(Y),2*_===W+1&&(_=1-_),2*E===Y+1&&(E=1-E),f.iushrn(1),h.iushrn(1)}return m}r.getJSF=i;function s(f,h,m){var _="_"+h;f.prototype[h]=function(){return this[_]!==void 0?this[_]:this[_]=m.call(this)}}r.cachedProperty=s;function c(f){return typeof f=="string"?r.toArray(f,"hex"):f}r.parseBytes=c;function l(f){return new st(f,"hex","le")}r.intFromLE=l}),Dl=gn.getNAF,sE=gn.getJSF,Cl=gn.assert;function os(t,e){this.type=t,this.p=new st(e.p,16),this.red=e.prime?st.red(e.prime):st.mont(this.p),this.zero=new st(0).toRed(this.red),this.one=new st(1).toRed(this.red),this.two=new st(2).toRed(this.red),this.n=e.n&&new st(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ks=os;os.prototype.point=function(){throw new Error("Not implemented")},os.prototype.validate=function(){throw new Error("Not implemented")},os.prototype._fixedNafMul=function(t,e){Cl(t.precomputed);var r=t._getDoubles(),n=Dl(e,1,this._bitLength),i=(1<<r.step+1)-(r.step%2===0?2:1);i/=3;var s=[],c,l;for(c=0;c<n.length;c+=r.step){l=0;for(var f=c+r.step-1;f>=c;f--)l=(l<<1)+n[f];s.push(l)}for(var h=this.jpoint(null,null,null),m=this.jpoint(null,null,null),_=i;_>0;_--){for(c=0;c<s.length;c++)l=s[c],l===_?m=m.mixedAdd(r.points[c]):l===-_&&(m=m.mixedAdd(r.points[c].neg()));h=h.add(m)}return h.toP()},os.prototype._wnafMul=function(t,e){var r=4,n=t._getNAFPoints(r);r=n.wnd;for(var i=n.points,s=Dl(e,r,this._bitLength),c=this.jpoint(null,null,null),l=s.length-1;l>=0;l--){for(var f=0;l>=0&&s[l]===0;l--)f++;if(l>=0&&f++,c=c.dblp(f),l<0)break;var h=s[l];Cl(h!==0),t.type==="affine"?h>0?c=c.mixedAdd(i[h-1>>1]):c=c.mixedAdd(i[-h-1>>1].neg()):h>0?c=c.add(i[h-1>>1]):c=c.add(i[-h-1>>1].neg())}return t.type==="affine"?c.toP():c},os.prototype._wnafMulAdd=function(t,e,r,n,i){var s=this._wnafT1,c=this._wnafT2,l=this._wnafT3,f=0,h,m,_;for(h=0;h<n;h++){_=e[h];var E=_._getNAFPoints(t);s[h]=E.wnd,c[h]=E.points}for(h=n-1;h>=1;h-=2){var A=h-1,I=h;if(s[A]!==1||s[I]!==1){l[A]=Dl(r[A],s[A],this._bitLength),l[I]=Dl(r[I],s[I],this._bitLength),f=Math.max(l[A].length,f),f=Math.max(l[I].length,f);continue}var R=[e[A],null,null,e[I]];e[A].y.cmp(e[I].y)===0?(R[1]=e[A].add(e[I]),R[2]=e[A].toJ().mixedAdd(e[I].neg())):e[A].y.cmp(e[I].y.redNeg())===0?(R[1]=e[A].toJ().mixedAdd(e[I]),R[2]=e[A].add(e[I].neg())):(R[1]=e[A].toJ().mixedAdd(e[I]),R[2]=e[A].toJ().mixedAdd(e[I].neg()));var W=[-3,-1,-5,-7,0,7,5,1,3],Y=sE(r[A],r[I]);for(f=Math.max(Y[0].length,f),l[A]=new Array(f),l[I]=new Array(f),m=0;m<f;m++){var F=Y[0][m]|0,z=Y[1][m]|0;l[A][m]=W[(F+1)*3+(z+1)],l[I][m]=0,c[A]=R}}var $=this.jpoint(null,null,null),j=this._wnafT4;for(h=f;h>=0;h--){for(var P=0;h>=0;){var g=!0;for(m=0;m<n;m++)j[m]=l[m][h]|0,j[m]!==0&&(g=!1);if(!g)break;P++,h--}if(h>=0&&P++,$=$.dblp(P),h<0)break;for(m=0;m<n;m++){var C=j[m];C!==0&&(C>0?_=c[m][C-1>>1]:C<0&&(_=c[m][-C-1>>1].neg()),_.type==="affine"?$=$.mixedAdd(_):$=$.add(_))}}for(h=0;h<n;h++)c[h]=null;return i?$:$.toP()};function On(t,e){this.curve=t,this.type=e,this.precomputed=null}os.BasePoint=On,On.prototype.eq=function(){throw new Error("Not implemented")},On.prototype.validate=function(){return this.curve.validate(this)},os.prototype.decodePoint=function(t,e){t=gn.toArray(t,e);var r=this.p.byteLength();if((t[0]===4||t[0]===6||t[0]===7)&&t.length-1===2*r){t[0]===6?Cl(t[t.length-1]%2===0):t[0]===7&&Cl(t[t.length-1]%2===1);var n=this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));return n}else if((t[0]===2||t[0]===3)&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),t[0]===3);throw new Error("Unknown point format")},On.prototype.encodeCompressed=function(t){return this.encode(t,!0)},On.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},On.prototype.encode=function(t,e){return gn.encode(this._encode(e),t)},On.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},On.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return e?e.points.length>=Math.ceil((t.bitLength()+1)/e.step):!1},On.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<e;i+=t){for(var s=0;s<t;s++)n=n.dbl();r.push(n)}return{step:t,points:r}},On.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,n=r===1?null:this.dbl(),i=1;i<r;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},On.prototype._getBeta=function(){return null},On.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var Ef=Zo(function(t){typeof Object.create=="function"?t.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}}),oE=gn.assert;function Pn(t){Ks.call(this,"short",t),this.a=new st(t.a,16).toRed(this.red),this.b=new st(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Ef(Pn,Ks);var aE=Pn;Pn.prototype._getEndomorphism=function(t){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var e,r;if(t.beta)e=new st(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=n[0].cmp(n[1])<0?n[0]:n[1],e=e.toRed(this.red)}if(t.lambda)r=new st(t.lambda,16);else{var i=this._getEndoRoots(this.n);this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))===0?r=i[0]:(r=i[1],oE(this.g.mul(r).x.cmp(this.g.x.redMul(e))===0))}var s;return t.basis?s=t.basis.map(function(c){return{a:new st(c.a,16),b:new st(c.b,16)}}):s=this._getEndoBasis(r),{beta:e,lambda:r,basis:s}}},Pn.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:st.mont(t),r=new st(2).toRed(e).redInvm(),n=r.redNeg(),i=new st(3).toRed(e).redNeg().redSqrt().redMul(r),s=n.redAdd(i).fromRed(),c=n.redSub(i).fromRed();return[s,c]},Pn.prototype._getEndoBasis=function(t){for(var e=this.n.ushrn(Math.floor(this.n.bitLength()/2)),r=t,n=this.n.clone(),i=new st(1),s=new st(0),c=new st(0),l=new st(1),f,h,m,_,E,A,I,R=0,W,Y;r.cmpn(0)!==0;){var F=n.div(r);W=n.sub(F.mul(r)),Y=c.sub(F.mul(i));var z=l.sub(F.mul(s));if(!m&&W.cmp(e)<0)f=I.neg(),h=i,m=W.neg(),_=Y;else if(m&&++R===2)break;I=W,n=r,r=W,c=i,i=Y,l=s,s=z}E=W.neg(),A=Y;var $=m.sqr().add(_.sqr()),j=E.sqr().add(A.sqr());return j.cmp($)>=0&&(E=f,A=h),m.negative&&(m=m.neg(),_=_.neg()),E.negative&&(E=E.neg(),A=A.neg()),[{a:m,b:_},{a:E,b:A}]},Pn.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),c=i.mul(r.a),l=s.mul(n.a),f=i.mul(r.b),h=s.mul(n.b),m=t.sub(c).sub(l),_=f.add(h).neg();return{k1:m,k2:_}},Pn.prototype.pointFromX=function(t,e){t=new st(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(n.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},Pn.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return r.redSqr().redISub(i).cmpn(0)===0},Pn.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s<t.length;s++){var c=this._endoSplit(e[s]),l=t[s],f=l._getBeta();c.k1.negative&&(c.k1.ineg(),l=l.neg(!0)),c.k2.negative&&(c.k2.ineg(),f=f.neg(!0)),n[s*2]=l,n[s*2+1]=f,i[s*2]=c.k1,i[s*2+1]=c.k2}for(var h=this._wnafMulAdd(1,n,i,s*2,r),m=0;m<s*2;m++)n[m]=null,i[m]=null;return h};function br(t,e,r,n){Ks.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new st(e,16),this.y=new st(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}Ef(br,Ks.BasePoint),Pn.prototype.point=function(t,e,r){return new br(this,t,e,r)},Pn.prototype.pointFromJSON=function(t,e){return br.fromJSON(this,t,e)},br.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(i){return r.point(i.x.redMul(r.endo.beta),i.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},br.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},br.fromJSON=function(t,e,r){typeof e=="string"&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(c){return t.point(c[0],c[1],r)}var s=e[2];return n.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[n].concat(s.doubles.points.map(i))},naf:s.naf&&{wnd:s.naf.wnd,points:[n].concat(s.naf.points.map(i))}},n},br.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},br.prototype.isInfinity=function(){return this.inf},br.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var e=this.y.redSub(t.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},br.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),s=i.redSqr().redISub(this.x.redAdd(this.x)),c=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,c)},br.prototype.getX=function(){return this.x.fromRed()},br.prototype.getY=function(){return this.y.fromRed()},br.prototype.mul=function(t){return t=new st(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},br.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},br.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},br.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)},br.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(i){return i.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},br.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function Pr(t,e,r,n){Ks.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new st(0)):(this.x=new st(e,16),this.y=new st(r,16),this.z=new st(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Ef(Pr,Ks.BasePoint),Pn.prototype.jpoint=function(t,e,r){return new Pr(this,t,e,r)},Pr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},Pr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Pr.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),c=t.y.redMul(r.redMul(this.z)),l=n.redSub(i),f=s.redSub(c);if(l.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=l.redSqr(),m=h.redMul(l),_=n.redMul(h),E=f.redSqr().redIAdd(m).redISub(_).redISub(_),A=f.redMul(_.redISub(E)).redISub(s.redMul(m)),I=this.z.redMul(t.z).redMul(l);return this.curve.jpoint(E,A,I)},Pr.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,s=t.y.redMul(e).redMul(this.z),c=r.redSub(n),l=i.redSub(s);if(c.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=c.redSqr(),h=f.redMul(c),m=r.redMul(f),_=l.redSqr().redIAdd(h).redISub(m).redISub(m),E=l.redMul(m.redISub(_)).redISub(i.redMul(h)),A=this.z.redMul(c);return this.curve.jpoint(_,E,A)},Pr.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,s=this.x,c=this.y,l=this.z,f=l.redSqr().redSqr(),h=c.redAdd(c);for(e=0;e<t;e++){var m=s.redSqr(),_=h.redSqr(),E=_.redSqr(),A=m.redAdd(m).redIAdd(m).redIAdd(n.redMul(f)),I=s.redMul(_),R=A.redSqr().redISub(I.redAdd(I)),W=I.redISub(R),Y=A.redMul(W);Y=Y.redIAdd(Y).redISub(E);var F=h.redMul(l);e+1<t&&(f=f.redMul(E)),s=R,l=F,h=Y}return this.curve.jpoint(s,h.redMul(i),l)},Pr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Pr.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),c=this.x.redAdd(i).redSqr().redISub(n).redISub(s);c=c.redIAdd(c);var l=n.redAdd(n).redIAdd(n),f=l.redSqr().redISub(c).redISub(c),h=s.redIAdd(s);h=h.redIAdd(h),h=h.redIAdd(h),t=f,e=l.redMul(c.redISub(f)).redISub(h),r=this.y.redAdd(this.y)}else{var m=this.x.redSqr(),_=this.y.redSqr(),E=_.redSqr(),A=this.x.redAdd(_).redSqr().redISub(m).redISub(E);A=A.redIAdd(A);var I=m.redAdd(m).redIAdd(m),R=I.redSqr(),W=E.redIAdd(E);W=W.redIAdd(W),W=W.redIAdd(W),t=R.redISub(A).redISub(A),e=I.redMul(A.redISub(t)).redISub(W),r=this.y.redMul(this.z),r=r.redIAdd(r)}return this.curve.jpoint(t,e,r)},Pr.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),c=this.x.redAdd(i).redSqr().redISub(n).redISub(s);c=c.redIAdd(c);var l=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),f=l.redSqr().redISub(c).redISub(c);t=f;var h=s.redIAdd(s);h=h.redIAdd(h),h=h.redIAdd(h),e=l.redMul(c.redISub(f)).redISub(h),r=this.y.redAdd(this.y)}else{var m=this.z.redSqr(),_=this.y.redSqr(),E=this.x.redMul(_),A=this.x.redSub(m).redMul(this.x.redAdd(m));A=A.redAdd(A).redIAdd(A);var I=E.redIAdd(E);I=I.redIAdd(I);var R=I.redAdd(I);t=A.redSqr().redISub(R),r=this.y.redAdd(this.z).redSqr().redISub(_).redISub(m);var W=_.redSqr();W=W.redIAdd(W),W=W.redIAdd(W),W=W.redIAdd(W),e=A.redMul(I.redISub(t)).redISub(W)}return this.curve.jpoint(t,e,r)},Pr.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),s=e.redSqr(),c=r.redSqr(),l=s.redAdd(s).redIAdd(s).redIAdd(t.redMul(i)),f=e.redAdd(e);f=f.redIAdd(f);var h=f.redMul(c),m=l.redSqr().redISub(h.redAdd(h)),_=h.redISub(m),E=c.redSqr();E=E.redIAdd(E),E=E.redIAdd(E),E=E.redIAdd(E);var A=l.redMul(_).redISub(E),I=r.redAdd(r).redMul(n);return this.curve.jpoint(m,A,I)},Pr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),s=i.redSqr(),c=this.x.redAdd(e).redSqr().redISub(t).redISub(n);c=c.redIAdd(c),c=c.redAdd(c).redIAdd(c),c=c.redISub(s);var l=c.redSqr(),f=n.redIAdd(n);f=f.redIAdd(f),f=f.redIAdd(f),f=f.redIAdd(f);var h=i.redIAdd(c).redSqr().redISub(s).redISub(l).redISub(f),m=e.redMul(h);m=m.redIAdd(m),m=m.redIAdd(m);var _=this.x.redMul(l).redISub(m);_=_.redIAdd(_),_=_.redIAdd(_);var E=this.y.redMul(h.redMul(f.redISub(h)).redISub(c.redMul(l)));E=E.redIAdd(E),E=E.redIAdd(E),E=E.redIAdd(E);var A=this.z.redAdd(c).redSqr().redISub(r).redISub(l);return this.curve.jpoint(_,E,A)},Pr.prototype.mul=function(t,e){return t=new st(t,e),this.curve._wnafMul(this,t)},Pr.prototype.eq=function(t){if(t.type==="affine")return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0)!==0)return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)===0},Pr.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(this.x.cmp(r)===0)return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),this.x.cmp(r)===0)return!0}},Pr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Pr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Ol=Zo(function(t,e){var r=e;r.base=Ks,r.short=aE,r.mont=null,r.edwards=null}),Pl=Zo(function(t,e){var r=e,n=gn.assert;function i(l){l.type==="short"?this.curve=new Ol.short(l):l.type==="edwards"?this.curve=new Ol.edwards(l):this.curve=new Ol.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function s(l,f){Object.defineProperty(r,l,{configurable:!0,enumerable:!0,get:function(){var h=new i(f);return Object.defineProperty(r,l,{configurable:!0,enumerable:!0,value:h}),h}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:ui.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:ui.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:ui.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:ui.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:ui.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ui.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ui.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=null.crash()}catch{c=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:ui.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})});function as(t){if(!(this instanceof as))return new as(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ei.toArray(t.entropy,t.entropyEnc||"hex"),r=ei.toArray(t.nonce,t.nonceEnc||"hex"),n=ei.toArray(t.pers,t.persEnc||"hex");_f(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var am=as;as.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},as.prototype._hmac=function(){return new ui.hmac(this.hash,this.K)},as.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},as.prototype.reseed=function(t,e,r,n){typeof e!="string"&&(n=r,r=e,e=null),t=ei.toArray(t,e),r=ei.toArray(r,n),_f(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},as.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(n=r,r=e,e=null),r&&(r=ei.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var s=i.slice(0,t);return this._update(r),this._reseed++,ei.encode(s,e)};var Af=gn.assert;function Rr(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var xf=Rr;Rr.fromPublic=function(t,e,r){return e instanceof Rr?e:new Rr(t,{pub:e,pubEnc:r})},Rr.fromPrivate=function(t,e,r){return e instanceof Rr?e:new Rr(t,{priv:e,privEnc:r})},Rr.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Rr.prototype.getPublic=function(t,e){return typeof t=="string"&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},Rr.prototype.getPrivate=function(t){return t==="hex"?this.priv.toString(16,2):this.priv},Rr.prototype._importPrivate=function(t,e){this.priv=new st(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},Rr.prototype._importPublic=function(t,e){if(t.x||t.y){this.ec.curve.type==="mont"?Af(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Af(t.x&&t.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(t.x,t.y);return}this.pub=this.ec.curve.decodePoint(t,e)},Rr.prototype.derive=function(t){return t.validate()||Af(t.validate(),"public point not validated"),t.mul(this.priv).getX()},Rr.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},Rr.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},Rr.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var cE=gn.assert;function Ml(t,e){if(t instanceof Ml)return t;this._importDER(t,e)||(cE(t.r&&t.s,"Signature without r or s"),this.r=new st(t.r,16),this.s=new st(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Tl=Ml;function lE(){this.place=0}function Sf(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,s=0,c=e.place;s<n;s++,c++)i<<=8,i|=t[c],i>>>=0;return i<=127?!1:(e.place=c,i)}function cm(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}Ml.prototype._importDER=function(t,e){t=gn.toArray(t,e);var r=new lE;if(t[r.place++]!==48)return!1;var n=Sf(t,r);if(n===!1||n+r.place!==t.length||t[r.place++]!==2)return!1;var i=Sf(t,r);if(i===!1)return!1;var s=t.slice(r.place,i+r.place);if(r.place+=i,t[r.place++]!==2)return!1;var c=Sf(t,r);if(c===!1||t.length!==c+r.place)return!1;var l=t.slice(r.place,c+r.place);if(s[0]===0)if(s[1]&128)s=s.slice(1);else return!1;if(l[0]===0)if(l[1]&128)l=l.slice(1);else return!1;return this.r=new st(s),this.s=new st(l),this.recoveryParam=null,!0};function If(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Ml.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),r[0]&128&&(r=[0].concat(r)),e=cm(e),r=cm(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var n=[2];If(n,e.length),n=n.concat(e),n.push(2),If(n,r.length);var i=n.concat(r),s=[48];return If(s,i.length),s=s.concat(i),gn.encode(s,t)};var uE=function(){throw new Error("unsupported")},lm=gn.assert;function Mn(t){if(!(this instanceof Mn))return new Mn(t);typeof t=="string"&&(lm(Object.prototype.hasOwnProperty.call(Pl,t),"Unknown curve "+t),t=Pl[t]),t instanceof Pl.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var hE=Mn;Mn.prototype.keyPair=function(t){return new xf(this,t)},Mn.prototype.keyFromPrivate=function(t,e){return xf.fromPrivate(this,t,e)},Mn.prototype.keyFromPublic=function(t,e){return xf.fromPublic(this,t,e)},Mn.prototype.genKeyPair=function(t){t||(t={});for(var e=new am({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||uE(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new st(2));;){var i=new st(e.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Mn.prototype._truncateToN=function(t,e){var r=t.byteLength()*8-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Mn.prototype.sign=function(t,e,r,n){typeof r=="object"&&(n=r,r=null),n||(n={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new st(t,16));for(var i=this.n.byteLength(),s=e.getPrivate().toArray("be",i),c=t.toArray("be",i),l=new am({hash:this.hash,entropy:s,nonce:c,pers:n.pers,persEnc:n.persEnc||"utf8"}),f=this.n.sub(new st(1)),h=0;;h++){var m=n.k?n.k(h):new st(l.generate(this.n.byteLength()));if(m=this._truncateToN(m,!0),!(m.cmpn(1)<=0||m.cmp(f)>=0)){var _=this.g.mul(m);if(!_.isInfinity()){var E=_.getX(),A=E.umod(this.n);if(A.cmpn(0)!==0){var I=m.invm(this.n).mul(A.mul(e.getPrivate()).iadd(t));if(I=I.umod(this.n),I.cmpn(0)!==0){var R=(_.getY().isOdd()?1:0)|(E.cmp(A)!==0?2:0);return n.canonical&&I.cmp(this.nh)>0&&(I=this.n.sub(I),R^=1),new Tl({r:A,s:I,recoveryParam:R})}}}}}},Mn.prototype.verify=function(t,e,r,n){t=this._truncateToN(new st(t,16)),r=this.keyFromPublic(r,n),e=new Tl(e,"hex");var i=e.r,s=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var c=s.invm(this.n),l=c.mul(t).umod(this.n),f=c.mul(i).umod(this.n),h;return this.curve._maxwellTrick?(h=this.g.jmulAdd(l,r.getPublic(),f),h.isInfinity()?!1:h.eqXToP(i)):(h=this.g.mulAdd(l,r.getPublic(),f),h.isInfinity()?!1:h.getX().umod(this.n).cmp(i)===0)},Mn.prototype.recoverPubKey=function(t,e,r,n){lm((3&r)===r,"The recovery param is more than two bits"),e=new Tl(e,n);var i=this.n,s=new st(t),c=e.r,l=e.s,f=r&1,h=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");h?c=this.curve.pointFromX(c.add(this.curve.n),f):c=this.curve.pointFromX(c,f);var m=e.r.invm(i),_=i.sub(s).mul(m).umod(i),E=l.mul(m).umod(i);return this.g.mulAdd(_,c,E)},Mn.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Tl(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch{continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var fE=Zo(function(t,e){var r=e;r.version="6.5.4",r.utils=gn,r.rand=function(){throw new Error("unsupported")},r.curve=Ol,r.curves=Pl,r.ec=hE,r.eddsa=null}),dE=fE.ec;const pE="signing-key/5.7.0",Df=new ut(pE);let Cf=null;function yi(){return Cf||(Cf=new dE("secp256k1")),Cf}class gE{constructor(e){tc(this,"curve","secp256k1"),tc(this,"privateKey",jr(e)),Q_(this.privateKey)!==32&&Df.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=yi().keyFromPrivate(or(this.privateKey));tc(this,"publicKey","0x"+r.getPublic(!1,"hex")),tc(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),tc(this,"_isSigningKey",!0)}_addPoint(e){const r=yi().keyFromPublic(or(this.publicKey)),n=yi().keyFromPublic(or(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=yi().keyFromPrivate(or(this.privateKey)),n=or(e);n.length!==32&&Df.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return wg({recoveryParam:i.recoveryParam,r:li("0x"+i.r.toString(16),32),s:li("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=yi().keyFromPrivate(or(this.privateKey)),n=yi().keyFromPublic(or(um(e)));return li("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function mE(t,e){const r=wg(e),n={r:or(r.r),s:or(r.s)};return"0x"+yi().recoverPubKey(or(t),n,r.recoveryParam).encode("hex",!1)}function um(t,e){const r=or(t);if(r.length===32){const n=new gE(r);return e?"0x"+yi().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?jr(r):"0x"+yi().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+yi().keyFromPublic(r).getPublic(!0,"hex"):jr(r)}return Df.throwArgumentError("invalid public or private key","key","[REDACTED]")}const vE="transactions/5.7.0";new ut(vE);var hm;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(hm||(hm={}));function yE(t){const e=um(t);return C8(yg(cf(yg(e,1)),12))}function wE(t,e){return yE(mE(or(t),e))}const bE="https://rpc.walletconnect.com/v1";async function _E(t,e,r,n,i,s){switch(r.t){case"eip191":return EE(t,e,r.s);case"eip1271":return await AE(t,e,r.s,n,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function EE(t,e,r){return wE(Rg(e),r).toLowerCase()===t.toLowerCase()}async function AE(t,e,r,n,i,s){try{const c="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",f="0000000000000000000000000000000000000000000000000000000000000041",h=r.substring(2),m=Rg(e).substring(2),_=c+m+l+f+h,E=await fetch(`${s||bE}/?chainId=${n}&projectId=${i}`,{method:"POST",body:JSON.stringify({id:xE(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:_},"latest"]})}),{result:A}=await E.json();return A?A.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function xE(){return Date.now()+Math.floor(Math.random()*1e3)}var SE=Object.defineProperty,IE=Object.defineProperties,DE=Object.getOwnPropertyDescriptors,fm=Object.getOwnPropertySymbols,CE=Object.prototype.hasOwnProperty,OE=Object.prototype.propertyIsEnumerable,dm=(t,e,r)=>e in t?SE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,PE=(t,e)=>{for(var r in e||(e={}))CE.call(e,r)&&dm(t,r,e[r]);if(fm)for(var r of fm(e))OE.call(e,r)&&dm(t,r,e[r]);return t},ME=(t,e)=>IE(t,DE(e));const TE="did:pkh:",Of=t=>t?.split(":"),pm=t=>{const e=t&&Of(t);if(e)return t.includes(TE)?e[3]:e[1]},gm=t=>{const e=t&&Of(t);if(e)return e[2]+":"+e[3]},$l=t=>{const e=t&&Of(t);if(e)return e.pop()};async function mm(t){const{cacao:e,projectId:r}=t,{s:n,p:i}=e,s=vm(i,i.iss),c=$l(i.iss);return await _E(c,s,n,pm(i.iss),r)}const vm=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,n=$l(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,c=`Version: ${t.version}`,l=`Chain ID: ${pm(e)}`,f=`Nonce: ${t.nonce}`,h=`Issued At: ${t.iat}`,m=t.resources?`Resources:${t.resources.map(E=>`
23
+ - ${E}`).join("")}`:void 0,_=Nl(t.resources);if(_){const E=sc(_);i=kE(i,E)}return[r,n,"",i,"",s,c,l,f,h,m].filter(E=>E!=null).join(`
24
+ `)};function $E(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function NE(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function Ws(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const n=t.att[r];if(Array.isArray(n))throw new Error(`Resource must be an object: ${r}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(n).forEach(i=>{const s=n[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(c=>{if(typeof c!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${c}`)})})})}function RE(t,e,r,n={}){return r?.sort((i,s)=>i.localeCompare(s)),{att:{[t]:LE(e,r,n)}}}function LE(t,e,r={}){e=e?.sort((i,s)=>i.localeCompare(s));const n=e.map(i=>({[`${t}/${i}`]:[r]}));return Object.assign({},...n)}function ym(t){return Ws(t),`urn:recap:${$E(t).replace(/=/g,"")}`}function sc(t){const e=NE(t.replace("urn:recap:",""));return Ws(e),e}function BE(t,e,r){const n=RE(t,e,r);return ym(n)}function UE(t){return t&&t.includes("urn:recap:")}function FE(t,e){const r=sc(t),n=sc(e),i=jE(r,n);return ym(i)}function jE(t,e){Ws(t),Ws(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((i,s)=>i.localeCompare(s)),n={att:{}};return r.forEach(i=>{var s,c;Object.keys(((s=t.att)==null?void 0:s[i])||{}).concat(Object.keys(((c=e.att)==null?void 0:c[i])||{})).sort((l,f)=>l.localeCompare(f)).forEach(l=>{var f,h;n.att[i]=ME(PE({},n.att[i]),{[l]:((f=t.att[i])==null?void 0:f[l])||((h=e.att[i])==null?void 0:h[l])})})}),n}function kE(t="",e){Ws(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const n=[];let i=0;Object.keys(e.att).forEach(l=>{const f=Object.keys(e.att[l]).map(_=>({ability:_.split("/")[0],action:_.split("/")[1]}));f.sort((_,E)=>_.action.localeCompare(E.action));const h={};f.forEach(_=>{h[_.ability]||(h[_.ability]=[]),h[_.ability].push(_.action)});const m=Object.keys(h).map(_=>(i++,`(${i}) '${_}': '${h[_].join("', '")}' for '${l}'.`));n.push(m.join(", ").replace(".,","."))});const s=n.join(" "),c=`${r}${s}`;return`${t?t+" ":""}${c}`}function wm(t){var e;const r=sc(t);Ws(r);const n=(e=r.att)==null?void 0:e.eip155;return n?Object.keys(n).map(i=>i.split("/")[1]):[]}function bm(t){const e=sc(t);Ws(e);const r=[];return Object.values(e.att).forEach(n=>{Object.values(n).forEach(i=>{var s;(s=i?.[0])!=null&&s.chains&&r.push(i[0].chains)})}),[...new Set(r.flat())]}function Nl(t){if(!t)return;const e=t?.[t.length-1];return UE(e)?e:void 0}const _m="base10",qr="base16",Pf="base64pad",Mf="utf8",Em=0,cs=1,qE=0,Am=1,Tf=12,$f=32;function zE(){const t=Zh.generateKeyPair();return{privateKey:Fr(t.secretKey,qr),publicKey:Fr(t.publicKey,qr)}}function Nf(){const t=Fo.randomBytes($f);return Fr(t,qr)}function HE(t,e){const r=Zh.sharedKey(Xr(t,qr),Xr(e,qr),!0),n=new Y6(ml.SHA256,r).expand($f);return Fr(n,qr)}function Rl(t){const e=ml.hash(Xr(t,qr));return Fr(e,qr)}function Vs(t){const e=ml.hash(Xr(t,Mf));return Fr(e,qr)}function KE(t){return Xr(`${t}`,_m)}function oc(t){return Number(Fr(t,_m))}function WE(t){const e=KE(typeof t.type<"u"?t.type:Em);if(oc(e)===cs&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Xr(t.senderPublicKey,qr):void 0,n=typeof t.iv<"u"?Xr(t.iv,qr):Fo.randomBytes(Tf),i=new Kh.ChaCha20Poly1305(Xr(t.symKey,qr)).seal(n,Xr(t.message,Mf));return GE({type:e,sealed:i,iv:n,senderPublicKey:r})}function VE(t){const e=new Kh.ChaCha20Poly1305(Xr(t.symKey,qr)),{sealed:r,iv:n}=Ll(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return Fr(i,Mf)}function GE(t){if(oc(t.type)===cs){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Fr(ef([t.type,t.senderPublicKey,t.iv,t.sealed]),Pf)}return Fr(ef([t.type,t.iv,t.sealed]),Pf)}function Ll(t){const e=Xr(t,Pf),r=e.slice(qE,Am),n=Am;if(oc(r)===cs){const l=n+$f,f=l+Tf,h=e.slice(n,l),m=e.slice(l,f),_=e.slice(f);return{type:r,sealed:_,iv:m,senderPublicKey:h}}const i=n+Tf,s=e.slice(n,i),c=e.slice(i);return{type:r,sealed:c,iv:s}}function YE(t,e){const r=Ll(t);return xm({type:oc(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Fr(r.senderPublicKey,qr):void 0,receiverPublicKey:e?.receiverPublicKey})}function xm(t){const e=t?.type||Em;if(e===cs){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function Sm(t){return t.type===cs&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}const JE="irn";function Rf(t){return t?.relay||{protocol:JE}}function Bl(t){const e=S_[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var QE=Object.defineProperty,ZE=Object.defineProperties,XE=Object.getOwnPropertyDescriptors,Im=Object.getOwnPropertySymbols,eA=Object.prototype.hasOwnProperty,tA=Object.prototype.propertyIsEnumerable,Dm=(t,e,r)=>e in t?QE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cm=(t,e)=>{for(var r in e||(e={}))eA.call(e,r)&&Dm(t,r,e[r]);if(Im)for(var r of Im(e))tA.call(e,r)&&Dm(t,r,e[r]);return t},rA=(t,e)=>ZE(t,XE(e));function nA(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),c=t[i];r[s]=c}}),r}function Om(t){t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",c=Ka.parse(s),l=typeof c.methods=="string"?c.methods.split(","):void 0;return{protocol:n,topic:iA(i[0]),version:parseInt(i[1],10),symKey:c.symKey,relay:nA(c),methods:l,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function iA(t){return t.startsWith("//")?t.substring(2):t}function sA(t,e="-"){const r="relay",n={};return Object.keys(t).forEach(i=>{const s=r+e+i;t[i]&&(n[s]=t[i])}),n}function oA(t){return`${t.protocol}:${t.topic}@${t.version}?`+Ka.stringify(Cm(rA(Cm({symKey:t.symKey},sA(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Xo(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function aA(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Xo(r.accounts))}),e}function cA(t,e){const r=[];return Object.values(t).forEach(n=>{Xo(n.accounts).includes(e)&&r.push(...n.methods)}),r}function lA(t,e){const r=[];return Object.values(t).forEach(n=>{Xo(n.accounts).includes(e)&&r.push(...n.events)}),r}function Lf(t){return t.includes(":")}function ac(t){return Lf(t)?t.split(":")[0]:t}function uA(t){const e={};return t?.forEach(r=>{const[n,i]=r.split(":");e[n]||(e[n]={accounts:[],chains:[],events:[]}),e[n].accounts.push(r),e[n].chains.push(`${n}:${i}`)}),e}function Pm(t,e){e=e.map(n=>n.replace("did:pkh:",""));const r=uA(e);for(const[n,i]of Object.entries(r))i.methods?i.methods=wl(i.methods,t):i.methods=t,i.events=["chainChanged","accountsChanged"];return r}const hA={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}},fA={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 me(t,e){const{message:r,code:n}=fA[t];return{message:e?`${r} ${e}`:r,code:n}}function Ut(t,e){const{message:r,code:n}=hA[t];return{message:e?`${r} ${e}`:r,code:n}}function wi(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function cc(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function zr(t){return typeof t>"u"}function ur(t,e){return e&&zr(t)?!0:typeof t=="string"&&!!t.trim().length}function Bf(t,e){return e&&zr(t)?!0:typeof t=="number"&&!isNaN(t)}function dA(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return qs(i,n)?(n.forEach(c=>{const{accounts:l,methods:f,events:h}=t.namespaces[c],m=Xo(l),_=r[c];(!qs(tg(c,_),m)||!qs(_.methods,f)||!qs(_.events,h))&&(s=!1)}),s):!1}function Ul(t){return ur(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function pA(t){if(ur(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Ul(r)}}return!1}function gA(t){if(ur(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function mA(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function vA(t){return t?.topic}function yA(t,e){let r=null;return ur(t?.publicKey,!1)||(r=me("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function Mm(t){let e=!0;return wi(t)?t.length&&(e=t.every(r=>ur(r,!1))):e=!1,e}function wA(t,e,r){let n=null;return wi(e)&&e.length?e.forEach(i=>{n||Ul(i)||(n=Ut("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Ul(t)||(n=Ut("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function bA(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;const c=wA(i,tg(i,s),`${e} ${r}`);c&&(n=c)}),n}function _A(t,e){let r=null;return wi(t)?t.forEach(n=>{r||pA(n)||(r=Ut("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Ut("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function EA(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=_A(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function AA(t,e){let r=null;return Mm(t?.methods)?Mm(t?.events)||(r=Ut("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Ut("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function Tm(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=AA(n,`${e}, namespace`);i&&(r=i)}),r}function xA(t,e,r){let n=null;if(t&&cc(t)){const i=Tm(t,e);i&&(n=i);const s=bA(t,e,r);s&&(n=s)}else n=me("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function Uf(t,e){let r=null;if(t&&cc(t)){const n=Tm(t,e);n&&(r=n);const i=EA(t,e);i&&(r=i)}else r=me("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function $m(t){return ur(t.protocol,!0)}function SA(t,e){let r=!1;return e&&!t?r=!0:t&&wi(t)&&t.length&&t.forEach(n=>{r=$m(n)}),r}function IA(t){return typeof t=="number"}function rn(t){return typeof t<"u"&&typeof t!==null}function DA(t){return!(!t||typeof t!="object"||!t.code||!Bf(t.code,!1)||!t.message||!ur(t.message,!1))}function CA(t){return!(zr(t)||!ur(t.method,!1))}function OA(t){return!(zr(t)||zr(t.result)&&zr(t.error)||!Bf(t.id,!1)||!ur(t.jsonrpc,!1))}function PA(t){return!(zr(t)||!ur(t.name,!1))}function Nm(t,e){return!(!Ul(e)||!aA(t).includes(e))}function MA(t,e,r){return ur(r,!1)?cA(t,e).includes(r):!1}function TA(t,e,r){return ur(r,!1)?lA(t,e).includes(r):!1}function Rm(t,e,r){let n=null;const i=$A(t),s=NA(e),c=Object.keys(i),l=Object.keys(s),f=Lm(Object.keys(t)),h=Lm(Object.keys(e)),m=f.filter(_=>!h.includes(_));return m.length&&(n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.
15
25
  Required: ${m.toString()}
16
- Received: ${Object.keys(e).toString()}`)),Mi(c,u)||(n=ue("NON_CONFORMING_NAMESPACES",`${t} namespaces chains don't satisfy required namespaces.
26
+ Received: ${Object.keys(e).toString()}`)),qs(c,l)||(n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.
17
27
  Required: ${c.toString()}
18
- Approved: ${u.toString()}`)),Object.keys(e).forEach(w=>{if(!w.includes(":")||n)return;const y=Ds(e[w].accounts);y.includes(w)||(n=ue("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace accounts for ${w}
19
- Required: ${w}
20
- Approved: ${y.toString()}`))}),c.forEach(w=>{n||(Mi(i[w].methods,a[w].methods)?Mi(i[w].events,a[w].events)||(n=ue("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${w}`)):n=ue("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${w}`))}),n}function o3(r){const e={};return Object.keys(r).forEach(t=>{var n;t.includes(":")?e[t]=r[t]:(n=r[t].chains)==null||n.forEach(i=>{e[i]={methods:r[t].methods,events:r[t].events}})}),e}function up(r){return[...new Set(r.map(e=>e.includes(":")?e.split(":")[0]:e))]}function a3(r){const e={};return Object.keys(r).forEach(t=>{if(t.includes(":"))e[t]=r[t];else{const n=Ds(r[t].accounts);n?.forEach(i=>{e[i]={accounts:r[t].accounts.filter(a=>a.includes(`${i}:`)),methods:r[t].methods,events:r[t].events}})}}),e}function c3(r,e){return fu(r,!1)&&r<=e.max&&r>=e.min}function hp(){const r=Io();return new Promise(e=>{switch(r){case zr.browser:e(l3());break;case zr.reactNative:e(u3());break;case zr.node:e(h3());break;default:e(!0)}})}function l3(){return xs()&&navigator?.onLine}async function u3(){if(Es()&&typeof global<"u"&&global!=null&&global.NetInfo){const r=await(global==null?void 0:global.NetInfo.fetch());return r?.isConnected}return!0}function h3(){return!0}function f3(r){switch(Io()){case zr.browser:d3(r);break;case zr.reactNative:p3(r);break}}function d3(r){!Es()&&xs()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function p3(r){Es()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>r(e?.isConnected))}const pu={};class Co{static get(e){return pu[e]}static set(e,t){pu[e]=t}static delete(e){delete pu[e]}}const g3=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,m3=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,v3=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function y3(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){w3(r);return}return e}function w3(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function Ba(r,e={}){if(typeof r!="string")return r;const t=r.trim();if(r[0]==='"'&&r.at(-1)==='"'&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){const n=t.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!v3.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(g3.test(r)||m3.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,y3)}return JSON.parse(r)}catch(n){if(e.strict)throw n;return r}}function b3(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function sr(r,...e){try{return b3(r(...e))}catch(t){return Promise.reject(t)}}function _3(r){const e=typeof r;return r===null||e!=="object"&&e!=="function"}function E3(r){const e=Object.getPrototypeOf(r);return!e||e.isPrototypeOf(Object)}function ka(r){if(_3(r))return String(r);if(E3(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return ka(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function fp(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const gu="base64:";function x3(r){if(typeof r=="string")return r;fp();const e=Buffer.from(r).toString("base64");return gu+e}function I3(r){return typeof r!="string"||!r.startsWith(gu)?r:(fp(),Buffer.from(r.slice(gu.length),"base64"))}function Rr(r){return r?r.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function D3(...r){return Rr(r.join(":"))}function qa(r){return r=Rr(r),r?r+":":""}function zT(r){return r}const S3="memory",O3=()=>{const r=new Map;return{name:S3,options:{},hasItem(e){return r.has(e)},getItem(e){return r.get(e)||null},getItemRaw(e){return r.get(e)||null},setItem(e,t){r.set(e,t)},setItemRaw(e,t){r.set(e,t)},removeItem(e){r.delete(e)},getKeys(){return Array.from(r.keys())},clear(){r.clear()},dispose(){r.clear()}}};function C3(r={}){const e={mounts:{"":r.driver||O3()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=h=>{for(const m of e.mountpoints)if(h.startsWith(m))return{base:m,relativeKey:h.slice(m.length),driver:e.mounts[m]};return{base:"",relativeKey:h,driver:e.mounts[""]}},n=(h,m)=>e.mountpoints.filter(w=>w.startsWith(h)||m&&h.startsWith(w)).map(w=>({relativeBase:h.length>w.length?h.slice(w.length):void 0,mountpoint:w,driver:e.mounts[w]})),i=(h,m)=>{if(e.watching){m=Rr(m);for(const w of e.watchListeners)w(h,m)}},a=async()=>{if(!e.watching){e.watching=!0;for(const h in e.mounts)e.unwatch[h]=await dp(e.mounts[h],i,h)}},c=async()=>{if(e.watching){for(const h in e.unwatch)await e.unwatch[h]();e.unwatch={},e.watching=!1}},u=(h,m,w)=>{const y=new Map,_=S=>{let P=y.get(S.base);return P||(P={driver:S.driver,base:S.base,items:[]},y.set(S.base,P)),P};for(const S of h){const P=typeof S=="string",j=Rr(P?S:S.key),U=P?void 0:S.value,A=P||!S.options?m:{...m,...S.options},T=t(j);_(T).items.push({key:j,value:U,relativeKey:T.relativeKey,options:A})}return Promise.all([...y.values()].map(S=>w(S))).then(S=>S.flat())},f={hasItem(h,m={}){h=Rr(h);const{relativeKey:w,driver:y}=t(h);return sr(y.hasItem,w,m)},getItem(h,m={}){h=Rr(h);const{relativeKey:w,driver:y}=t(h);return sr(y.getItem,w,m).then(_=>Ba(_))},getItems(h,m){return u(h,m,w=>w.driver.getItems?sr(w.driver.getItems,w.items.map(y=>({key:y.relativeKey,options:y.options})),m).then(y=>y.map(_=>({key:D3(w.base,_.key),value:Ba(_.value)}))):Promise.all(w.items.map(y=>sr(w.driver.getItem,y.relativeKey,y.options).then(_=>({key:y.key,value:Ba(_)})))))},getItemRaw(h,m={}){h=Rr(h);const{relativeKey:w,driver:y}=t(h);return y.getItemRaw?sr(y.getItemRaw,w,m):sr(y.getItem,w,m).then(_=>I3(_))},async setItem(h,m,w={}){if(m===void 0)return f.removeItem(h);h=Rr(h);const{relativeKey:y,driver:_}=t(h);_.setItem&&(await sr(_.setItem,y,ka(m),w),_.watch||i("update",h))},async setItems(h,m){await u(h,m,async w=>{w.driver.setItems&&await sr(w.driver.setItems,w.items.map(y=>({key:y.relativeKey,value:ka(y.value),options:y.options})),m),w.driver.setItem&&await Promise.all(w.items.map(y=>sr(w.driver.setItem,y.relativeKey,ka(y.value),y.options)))})},async setItemRaw(h,m,w={}){if(m===void 0)return f.removeItem(h,w);h=Rr(h);const{relativeKey:y,driver:_}=t(h);if(_.setItemRaw)await sr(_.setItemRaw,y,m,w);else if(_.setItem)await sr(_.setItem,y,x3(m),w);else return;_.watch||i("update",h)},async removeItem(h,m={}){typeof m=="boolean"&&(m={removeMeta:m}),h=Rr(h);const{relativeKey:w,driver:y}=t(h);y.removeItem&&(await sr(y.removeItem,w,m),(m.removeMeta||m.removeMata)&&await sr(y.removeItem,w+"$",m),y.watch||i("remove",h))},async getMeta(h,m={}){typeof m=="boolean"&&(m={nativeOnly:m}),h=Rr(h);const{relativeKey:w,driver:y}=t(h),_=Object.create(null);if(y.getMeta&&Object.assign(_,await sr(y.getMeta,w,m)),!m.nativeOnly){const S=await sr(y.getItem,w+"$",m).then(P=>Ba(P));S&&typeof S=="object"&&(typeof S.atime=="string"&&(S.atime=new Date(S.atime)),typeof S.mtime=="string"&&(S.mtime=new Date(S.mtime)),Object.assign(_,S))}return _},setMeta(h,m,w={}){return this.setItem(h+"$",m,w)},removeMeta(h,m={}){return this.removeItem(h+"$",m)},async getKeys(h,m={}){h=qa(h);const w=n(h,!0);let y=[];const _=[];for(const S of w){const j=(await sr(S.driver.getKeys,S.relativeBase,m)).map(U=>S.mountpoint+Rr(U)).filter(U=>!y.some(A=>U.startsWith(A)));_.push(...j),y=[S.mountpoint,...y.filter(U=>!U.startsWith(S.mountpoint))]}return h?_.filter(S=>S.startsWith(h)&&!S.endsWith("$")):_.filter(S=>!S.endsWith("$"))},async clear(h,m={}){h=qa(h),await Promise.all(n(h,!1).map(async w=>{if(w.driver.clear)return sr(w.driver.clear,w.relativeBase,m);if(w.driver.removeItem){const y=await w.driver.getKeys(w.relativeBase||"",m);return Promise.all(y.map(_=>w.driver.removeItem(_,m)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(h=>pp(h)))},async watch(h){return await a(),e.watchListeners.push(h),async()=>{e.watchListeners=e.watchListeners.filter(m=>m!==h),e.watchListeners.length===0&&await c()}},async unwatch(){e.watchListeners=[],await c()},mount(h,m){if(h=qa(h),h&&e.mounts[h])throw new Error(`already mounted at ${h}`);return h&&(e.mountpoints.push(h),e.mountpoints.sort((w,y)=>y.length-w.length)),e.mounts[h]=m,e.watching&&Promise.resolve(dp(m,i,h)).then(w=>{e.unwatch[h]=w}).catch(console.error),f},async unmount(h,m=!0){h=qa(h),!(!h||!e.mounts[h])&&(e.watching&&h in e.unwatch&&(e.unwatch[h](),delete e.unwatch[h]),m&&await pp(e.mounts[h]),e.mountpoints=e.mountpoints.filter(w=>w!==h),delete e.mounts[h])},getMount(h=""){h=Rr(h)+":";const m=t(h);return{driver:m.driver,base:m.base}},getMounts(h="",m={}){return h=Rr(h),n(h,m.parents).map(y=>({driver:y.driver,base:y.mountpoint}))}};return f}function dp(r,e,t){return r.watch?r.watch((n,i)=>e(n,t+i)):()=>{}}async function pp(r){typeof r.dispose=="function"&&await sr(r.dispose)}function Ui(r){return new Promise((e,t)=>{r.oncomplete=r.onsuccess=()=>e(r.result),r.onabort=r.onerror=()=>t(r.error)})}function gp(r,e){const t=indexedDB.open(r);t.onupgradeneeded=()=>t.result.createObjectStore(e);const n=Ui(t);return(i,a)=>n.then(c=>a(c.transaction(e,i).objectStore(e)))}let mu;function $o(){return mu||(mu=gp("keyval-store","keyval")),mu}function mp(r,e=$o()){return e("readonly",t=>Ui(t.get(r)))}function $3(r,e,t=$o()){return t("readwrite",n=>(n.put(e,r),Ui(n.transaction)))}function A3(r,e=$o()){return e("readwrite",t=>(t.delete(r),Ui(t.transaction)))}function P3(r=$o()){return r("readwrite",e=>(e.clear(),Ui(e.transaction)))}function T3(r,e){return r.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Ui(r.transaction)}function R3(r=$o()){return r("readonly",e=>{if(e.getAllKeys)return Ui(e.getAllKeys());const t=[];return T3(e,n=>t.push(n.key)).then(()=>t)})}const N3=r=>JSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),L3=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,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Ao(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return L3(r)}catch{return r}}function ji(r){return typeof r=="string"?r:N3(r)||""}const M3="idb-keyval";var U3=(r={})=>{const e=r.base&&r.base.length>0?`${r.base}:`:"",t=i=>e+i;let n;return r.dbName&&r.storeName&&(n=gp(r.dbName,r.storeName)),{name:M3,options:r,async hasItem(i){return!(typeof await mp(t(i),n)>"u")},async getItem(i){return await mp(t(i),n)??null},setItem(i,a){return $3(t(i),a,n)},removeItem(i){return A3(t(i),n)},getKeys(){return R3(n)},clear(){return P3(n)}}};const j3="WALLET_CONNECT_V2_INDEXED_DB",F3="keyvaluestorage";class B3{constructor(){this.indexedDb=C3({driver:U3({dbName:j3,storeName:F3})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,ji(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var vu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},za={exports:{}};(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,n){this[t]=String(n)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(n){t[n]=void 0,delete t[n]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof vu<"u"&&vu.localStorage?za.exports=vu.localStorage:typeof window<"u"&&window.localStorage?za.exports=window.localStorage:za.exports=new e})();function k3(r){var e;return[r[0],Ao((e=r[1])!=null?e:"")]}class q3{constructor(){this.localStorage=za.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(k3)}async getItem(e){const t=this.localStorage.getItem(e);if(t!==null)return Ao(t)}async setItem(e,t){this.localStorage.setItem(e,ji(t))}async removeItem(e){this.localStorage.removeItem(e)}}const z3="wc_storage_version",vp=1,H3=async(r,e,t)=>{const n=z3,i=await e.getItem(n);if(i&&i>=vp){t(e);return}const a=await r.getKeys();if(!a.length){t(e);return}const c=[];for(;a.length;){const u=a.shift();if(!u)continue;const f=u.toLowerCase();if(f.includes("wc@")||f.includes("walletconnect")||f.includes("wc_")||f.includes("wallet_connect")){const h=await r.getItem(u);await e.setItem(u,h),c.push(u)}}await e.setItem(n,vp),t(e),W3(r,c)},W3=async(r,e)=>{e.length&&e.forEach(async t=>{await r.removeItem(t)})};class K3{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const e=new q3;this.storage=e;try{const t=new B3;H3(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}}var Ss={};/*! *****************************************************************************
28
+ Approved: ${l.toString()}`)),Object.keys(e).forEach(_=>{if(!_.includes(":")||n)return;const E=Xo(e[_].accounts);E.includes(_)||(n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${_}
29
+ Required: ${_}
30
+ Approved: ${E.toString()}`))}),c.forEach(_=>{n||(qs(i[_].methods,s[_].methods)?qs(i[_].events,s[_].events)||(n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${_}`)):n=me("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${_}`))}),n}function $A(t){const e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function Lm(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function NA(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const n=Xo(t[r].accounts);n?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function RA(t,e){return Bf(t,!1)&&t<=e.max&&t>=e.min}function Bm(){const t=Ya();return new Promise(e=>{switch(t){case dn.browser:e(LA());break;case dn.reactNative:e(BA());break;case dn.node:e(UA());break;default:e(!0)}})}function LA(){return ko()&&navigator?.onLine}async function BA(){if(jo()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t?.isConnected}return!0}function UA(){return!0}function FA(t){switch(Ya()){case dn.browser:jA(t);break;case dn.reactNative:kA(t);break}}function jA(t){!jo()&&ko()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function kA(t){jo()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}const Ff={};class lc{static get(e){return Ff[e]}static set(e,r){Ff[e]=r}static delete(e){delete Ff[e]}}const qA=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,zA=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,HA=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function KA(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){WA(t);return}return e}function WA(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Fl(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.at(-1)==='"'&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!HA.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(qA.test(t)||zA.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,KA)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function VA(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function _r(t,...e){try{return VA(t(...e))}catch(r){return Promise.reject(r)}}function GA(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function YA(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function jl(t){if(GA(t))return String(t);if(YA(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return jl(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Um(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const jf="base64:";function JA(t){if(typeof t=="string")return t;Um();const e=Buffer.from(t).toString("base64");return jf+e}function QA(t){return typeof t!="string"||!t.startsWith(jf)?t:(Um(),Buffer.from(t.slice(jf.length),"base64"))}function nn(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function ZA(...t){return nn(t.join(":"))}function kl(t){return t=nn(t),t?t+":":""}function jF(t){return t}const XA="memory",e7=()=>{const t=new Map;return{name:XA,options:{},hasItem(e){return t.has(e)},getItem(e){return t.get(e)||null},getItemRaw(e){return t.get(e)||null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return Array.from(t.keys())},clear(){t.clear()},dispose(){t.clear()}}};function t7(t={}){const e={mounts:{"":t.driver||e7()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=h=>{for(const m of e.mountpoints)if(h.startsWith(m))return{base:m,relativeKey:h.slice(m.length),driver:e.mounts[m]};return{base:"",relativeKey:h,driver:e.mounts[""]}},n=(h,m)=>e.mountpoints.filter(_=>_.startsWith(h)||m&&h.startsWith(_)).map(_=>({relativeBase:h.length>_.length?h.slice(_.length):void 0,mountpoint:_,driver:e.mounts[_]})),i=(h,m)=>{if(e.watching){m=nn(m);for(const _ of e.watchListeners)_(h,m)}},s=async()=>{if(!e.watching){e.watching=!0;for(const h in e.mounts)e.unwatch[h]=await Fm(e.mounts[h],i,h)}},c=async()=>{if(e.watching){for(const h in e.unwatch)await e.unwatch[h]();e.unwatch={},e.watching=!1}},l=(h,m,_)=>{const E=new Map,A=I=>{let R=E.get(I.base);return R||(R={driver:I.driver,base:I.base,items:[]},E.set(I.base,R)),R};for(const I of h){const R=typeof I=="string",W=nn(R?I:I.key),Y=R?void 0:I.value,F=R||!I.options?m:{...m,...I.options},z=r(W);A(z).items.push({key:W,value:Y,relativeKey:z.relativeKey,options:F})}return Promise.all([...E.values()].map(I=>_(I))).then(I=>I.flat())},f={hasItem(h,m={}){h=nn(h);const{relativeKey:_,driver:E}=r(h);return _r(E.hasItem,_,m)},getItem(h,m={}){h=nn(h);const{relativeKey:_,driver:E}=r(h);return _r(E.getItem,_,m).then(A=>Fl(A))},getItems(h,m){return l(h,m,_=>_.driver.getItems?_r(_.driver.getItems,_.items.map(E=>({key:E.relativeKey,options:E.options})),m).then(E=>E.map(A=>({key:ZA(_.base,A.key),value:Fl(A.value)}))):Promise.all(_.items.map(E=>_r(_.driver.getItem,E.relativeKey,E.options).then(A=>({key:E.key,value:Fl(A)})))))},getItemRaw(h,m={}){h=nn(h);const{relativeKey:_,driver:E}=r(h);return E.getItemRaw?_r(E.getItemRaw,_,m):_r(E.getItem,_,m).then(A=>QA(A))},async setItem(h,m,_={}){if(m===void 0)return f.removeItem(h);h=nn(h);const{relativeKey:E,driver:A}=r(h);A.setItem&&(await _r(A.setItem,E,jl(m),_),A.watch||i("update",h))},async setItems(h,m){await l(h,m,async _=>{_.driver.setItems&&await _r(_.driver.setItems,_.items.map(E=>({key:E.relativeKey,value:jl(E.value),options:E.options})),m),_.driver.setItem&&await Promise.all(_.items.map(E=>_r(_.driver.setItem,E.relativeKey,jl(E.value),E.options)))})},async setItemRaw(h,m,_={}){if(m===void 0)return f.removeItem(h,_);h=nn(h);const{relativeKey:E,driver:A}=r(h);if(A.setItemRaw)await _r(A.setItemRaw,E,m,_);else if(A.setItem)await _r(A.setItem,E,JA(m),_);else return;A.watch||i("update",h)},async removeItem(h,m={}){typeof m=="boolean"&&(m={removeMeta:m}),h=nn(h);const{relativeKey:_,driver:E}=r(h);E.removeItem&&(await _r(E.removeItem,_,m),(m.removeMeta||m.removeMata)&&await _r(E.removeItem,_+"$",m),E.watch||i("remove",h))},async getMeta(h,m={}){typeof m=="boolean"&&(m={nativeOnly:m}),h=nn(h);const{relativeKey:_,driver:E}=r(h),A=Object.create(null);if(E.getMeta&&Object.assign(A,await _r(E.getMeta,_,m)),!m.nativeOnly){const I=await _r(E.getItem,_+"$",m).then(R=>Fl(R));I&&typeof I=="object"&&(typeof I.atime=="string"&&(I.atime=new Date(I.atime)),typeof I.mtime=="string"&&(I.mtime=new Date(I.mtime)),Object.assign(A,I))}return A},setMeta(h,m,_={}){return this.setItem(h+"$",m,_)},removeMeta(h,m={}){return this.removeItem(h+"$",m)},async getKeys(h,m={}){h=kl(h);const _=n(h,!0);let E=[];const A=[];for(const I of _){const W=(await _r(I.driver.getKeys,I.relativeBase,m)).map(Y=>I.mountpoint+nn(Y)).filter(Y=>!E.some(F=>Y.startsWith(F)));A.push(...W),E=[I.mountpoint,...E.filter(Y=>!Y.startsWith(I.mountpoint))]}return h?A.filter(I=>I.startsWith(h)&&!I.endsWith("$")):A.filter(I=>!I.endsWith("$"))},async clear(h,m={}){h=kl(h),await Promise.all(n(h,!1).map(async _=>{if(_.driver.clear)return _r(_.driver.clear,_.relativeBase,m);if(_.driver.removeItem){const E=await _.driver.getKeys(_.relativeBase||"",m);return Promise.all(E.map(A=>_.driver.removeItem(A,m)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(h=>jm(h)))},async watch(h){return await s(),e.watchListeners.push(h),async()=>{e.watchListeners=e.watchListeners.filter(m=>m!==h),e.watchListeners.length===0&&await c()}},async unwatch(){e.watchListeners=[],await c()},mount(h,m){if(h=kl(h),h&&e.mounts[h])throw new Error(`already mounted at ${h}`);return h&&(e.mountpoints.push(h),e.mountpoints.sort((_,E)=>E.length-_.length)),e.mounts[h]=m,e.watching&&Promise.resolve(Fm(m,i,h)).then(_=>{e.unwatch[h]=_}).catch(console.error),f},async unmount(h,m=!0){h=kl(h),!(!h||!e.mounts[h])&&(e.watching&&h in e.unwatch&&(e.unwatch[h](),delete e.unwatch[h]),m&&await jm(e.mounts[h]),e.mountpoints=e.mountpoints.filter(_=>_!==h),delete e.mounts[h])},getMount(h=""){h=nn(h)+":";const m=r(h);return{driver:m.driver,base:m.base}},getMounts(h="",m={}){return h=nn(h),n(h,m.parents).map(E=>({driver:E.driver,base:E.mountpoint}))}};return f}function Fm(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function jm(t){typeof t.dispose=="function"&&await _r(t.dispose)}function Gs(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function km(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=Gs(r);return(i,s)=>n.then(c=>s(c.transaction(e,i).objectStore(e)))}let kf;function uc(){return kf||(kf=km("keyval-store","keyval")),kf}function qm(t,e=uc()){return e("readonly",r=>Gs(r.get(t)))}function r7(t,e,r=uc()){return r("readwrite",n=>(n.put(e,t),Gs(n.transaction)))}function n7(t,e=uc()){return e("readwrite",r=>(r.delete(t),Gs(r.transaction)))}function i7(t=uc()){return t("readwrite",e=>(e.clear(),Gs(e.transaction)))}function s7(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Gs(t.transaction)}function o7(t=uc()){return t("readonly",e=>{if(e.getAllKeys)return Gs(e.getAllKeys());const r=[];return s7(e,n=>r.push(n.key)).then(()=>r)})}const a7=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),c7=t=>{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,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function hc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return c7(t)}catch{return t}}function Ui(t){return typeof t=="string"?t:a7(t)||""}const l7="idb-keyval";var u7=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=km(t.dbName,t.storeName)),{name:l7,options:t,async hasItem(i){return!(typeof await qm(r(i),n)>"u")},async getItem(i){return await qm(r(i),n)??null},setItem(i,s){return r7(r(i),s,n)},removeItem(i){return n7(r(i),n)},getKeys(){return o7(n)},clear(){return i7(n)}}};const h7="WALLET_CONNECT_V2_INDEXED_DB",f7="keyvaluestorage";class d7{constructor(){this.indexedDb=t7({driver:u7({dbName:h7,storeName:f7})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Ui(r))}async removeItem(e){await this.indexedDb.removeItem(e)}}var qf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ql={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof qf<"u"&&qf.localStorage?ql.exports=qf.localStorage:typeof window<"u"&&window.localStorage?ql.exports=window.localStorage:ql.exports=new e})();function p7(t){var e;return[t[0],hc((e=t[1])!=null?e:"")]}class g7{constructor(){this.localStorage=ql.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(p7)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return hc(r)}async setItem(e,r){this.localStorage.setItem(e,Ui(r))}async removeItem(e){this.localStorage.removeItem(e)}}const m7="wc_storage_version",zm=1,v7=async(t,e,r)=>{const n=m7,i=await e.getItem(n);if(i&&i>=zm){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const c=[];for(;s.length;){const l=s.shift();if(!l)continue;const f=l.toLowerCase();if(f.includes("wc@")||f.includes("walletconnect")||f.includes("wc_")||f.includes("wallet_connect")){const h=await t.getItem(l);await e.setItem(l,h),c.push(l)}}await e.setItem(n,zm),r(e),y7(t,c)},y7=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};class w7{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new g7;this.storage=e;try{const r=new d7;v7(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}var ea={};/*! *****************************************************************************
21
31
  Copyright (c) Microsoft Corporation.
22
32
 
23
33
  Permission to use, copy, modify, and/or distribute this software for any
@@ -30,7 +40,7 @@
30
40
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
31
41
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
32
42
  PERFORMANCE OF THIS SOFTWARE.
33
- ***************************************************************************** */var yu=function(r,e){return yu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},yu(r,e)};function V3(r,e){yu(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var wu=function(){return wu=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},wu.apply(this,arguments)};function G3(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function Y3(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var u=r.length-1;u>=0;u--)(c=r[u])&&(a=(i<3?c(a):i>3?c(e,t,a):c(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function Z3(r,e){return function(t,n){e(t,n,r)}}function J3(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function Q3(r,e,t,n){function i(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function u(m){try{h(n.next(m))}catch(w){c(w)}}function f(m){try{h(n.throw(m))}catch(w){c(w)}}function h(m){m.done?a(m.value):i(m.value).then(u,f)}h((n=n.apply(r,e||[])).next())})}function X3(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=h[0]&2?i.return:h[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,h[1])).done)return a;switch(i=0,a&&(h=[h[0]&2,a.value]),h[0]){case 0:case 1:a=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,i=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){t.label=h[1];break}if(h[0]===6&&t.label<a[1]){t.label=a[1],a=h;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(h);break}a[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(m){h=[6,m],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function e5(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}function t5(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function bu(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function yp(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(u){c={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(c)throw c.error}}return a}function r5(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(yp(arguments[e]));return r}function n5(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],c=0,u=a.length;c<u;c++,i++)n[i]=a[c];return n}function Po(r){return this instanceof Po?(this.v=r,this):new Po(r)}function i5(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(y){n[y]&&(i[y]=function(_){return new Promise(function(S,P){a.push([y,_,S,P])>1||u(y,_)})})}function u(y,_){try{f(n[y](_))}catch(S){w(a[0][3],S)}}function f(y){y.value instanceof Po?Promise.resolve(y.value.v).then(h,m):w(a[0][2],y)}function h(y){u("next",y)}function m(y){u("throw",y)}function w(y,_){y(_),a.shift(),a.length&&u(a[0][0],a[0][1])}}function s5(r){var e,t;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,a){e[i]=r[i]?function(c){return(t=!t)?{value:Po(r[i](c)),done:i==="return"}:a?a(c):c}:a}}function o5(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 bu=="function"?bu(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(c){return new Promise(function(u,f){c=r[a](c),i(u,f,c.done,c.value)})}}function i(a,c,u,f){Promise.resolve(f).then(function(h){a({value:h,done:u})},c)}}function a5(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function c5(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 l5(r){return r&&r.__esModule?r:{default:r}}function u5(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function h5(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 f5=Object.freeze({__proto__:null,__extends:V3,get __assign(){return wu},__rest:G3,__decorate:Y3,__param:Z3,__metadata:J3,__awaiter:Q3,__generator:X3,__createBinding:e5,__exportStar:t5,__values:bu,__read:yp,__spread:r5,__spreadArrays:n5,__await:Po,__asyncGenerator:i5,__asyncDelegator:s5,__asyncValues:o5,__makeTemplateObject:a5,__importStar:c5,__importDefault:l5,__classPrivateFieldGet:u5,__classPrivateFieldSet:h5}),Ha=Pi(f5),To={},_u={},Ro={};class Fi{}var d5=Object.freeze({__proto__:null,IEvents:Fi}),p5=Pi(d5),wp;function g5(){if(wp)return Ro;wp=1,Object.defineProperty(Ro,"__esModule",{value:!0}),Ro.IHeartBeat=void 0;const r=p5;class e extends r.IEvents{constructor(n){super()}}return Ro.IHeartBeat=e,Ro}var bp;function _p(){return bp||(bp=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),Ha.__exportStar(g5(),r)}(_u)),_u}var Eu={},Bi={},Ep;function m5(){if(Ep)return Bi;Ep=1,Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.HEARTBEAT_EVENTS=Bi.HEARTBEAT_INTERVAL=void 0;const r=me;return Bi.HEARTBEAT_INTERVAL=r.FIVE_SECONDS,Bi.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},Bi}var xp;function Ip(){return xp||(xp=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),Ha.__exportStar(m5(),r)}(Eu)),Eu}var Dp;function v5(){if(Dp)return To;Dp=1,Object.defineProperty(To,"__esModule",{value:!0}),To.HeartBeat=void 0;const r=Ha,e=lr.exports,t=me,n=_p(),i=Ip();class a extends n.IHeartBeat{constructor(u){super(u),this.events=new e.EventEmitter,this.interval=i.HEARTBEAT_INTERVAL,this.interval=u?.interval||i.HEARTBEAT_INTERVAL}static init(u){return r.__awaiter(this,void 0,void 0,function*(){const f=new a(u);return yield f.init(),f})}init(){return r.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(u,f){this.events.on(u,f)}once(u,f){this.events.once(u,f)}off(u,f){this.events.off(u,f)}removeListener(u,f){this.events.removeListener(u,f)}initialize(){return r.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),t.toMiliseconds(this.interval))})}pulse(){this.events.emit(i.HEARTBEAT_EVENTS.pulse)}}return To.HeartBeat=a,To}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Ha;e.__exportStar(v5(),r),e.__exportStar(_p(),r),e.__exportStar(Ip(),r)})(Ss);var Xe={};/*! *****************************************************************************
43
+ ***************************************************************************** */var zf=function(t,e){return zf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},zf(t,e)};function b7(t,e){zf(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Hf=function(){return Hf=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Hf.apply(this,arguments)};function _7(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function E7(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(s=(i<3?c(s):i>3?c(e,r,s):c(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function A7(t,e){return function(r,n){e(r,n,t)}}function x7(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function S7(t,e,r,n){function i(s){return s instanceof r?s:new r(function(c){c(s)})}return new(r||(r=Promise))(function(s,c){function l(m){try{h(n.next(m))}catch(_){c(_)}}function f(m){try{h(n.throw(m))}catch(_){c(_)}}function h(m){m.done?s(m.value):i(m.value).then(l,f)}h((n=n.apply(t,e||[])).next())})}function I7(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=h[0]&2?i.return:h[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,h[1])).done)return s;switch(i=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){r.label=h[1];break}if(h[0]===6&&r.label<s[1]){r.label=s[1],s=h;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(h);break}s[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(m){h=[6,m],i=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function D7(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function C7(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Kf(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Hm(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(l){c={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return s}function O7(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Hm(arguments[e]));return t}function P7(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],c=0,l=s.length;c<l;c++,i++)n[i]=s[c];return n}function fc(t){return this instanceof fc?(this.v=t,this):new fc(t)}function M7(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(E){n[E]&&(i[E]=function(A){return new Promise(function(I,R){s.push([E,A,I,R])>1||l(E,A)})})}function l(E,A){try{f(n[E](A))}catch(I){_(s[0][3],I)}}function f(E){E.value instanceof fc?Promise.resolve(E.value.v).then(h,m):_(s[0][2],E)}function h(E){l("next",E)}function m(E){l("throw",E)}function _(E,A){E(A),s.shift(),s.length&&l(s[0][0],s[0][1])}}function T7(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(c){return(r=!r)?{value:fc(t[i](c)),done:i==="return"}:s?s(c):c}:s}}function $7(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Kf=="function"?Kf(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(c){return new Promise(function(l,f){c=t[s](c),i(l,f,c.done,c.value)})}}function i(s,c,l,f){Promise.resolve(f).then(function(h){s({value:h,done:l})},c)}}function N7(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function R7(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function L7(t){return t&&t.__esModule?t:{default:t}}function B7(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function U7(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var F7=Object.freeze({__proto__:null,__extends:b7,get __assign(){return Hf},__rest:_7,__decorate:E7,__param:A7,__metadata:x7,__awaiter:S7,__generator:I7,__createBinding:D7,__exportStar:C7,__values:Kf,__read:Hm,__spread:O7,__spreadArrays:P7,__await:fc,__asyncGenerator:M7,__asyncDelegator:T7,__asyncValues:$7,__makeTemplateObject:N7,__importStar:R7,__importDefault:L7,__classPrivateFieldGet:B7,__classPrivateFieldSet:U7}),zl=Us(F7),dc={},Wf={},pc={};class Ys{}var j7=Object.freeze({__proto__:null,IEvents:Ys}),k7=Us(j7),Km;function q7(){if(Km)return pc;Km=1,Object.defineProperty(pc,"__esModule",{value:!0}),pc.IHeartBeat=void 0;const t=k7;class e extends t.IEvents{constructor(n){super()}}return pc.IHeartBeat=e,pc}var Wm;function Vm(){return Wm||(Wm=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),zl.__exportStar(q7(),t)}(Wf)),Wf}var Vf={},Js={},Gm;function z7(){if(Gm)return Js;Gm=1,Object.defineProperty(Js,"__esModule",{value:!0}),Js.HEARTBEAT_EVENTS=Js.HEARTBEAT_INTERVAL=void 0;const t=_e;return Js.HEARTBEAT_INTERVAL=t.FIVE_SECONDS,Js.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},Js}var Ym;function Jm(){return Ym||(Ym=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),zl.__exportStar(z7(),t)}(Vf)),Vf}var Qm;function H7(){if(Qm)return dc;Qm=1,Object.defineProperty(dc,"__esModule",{value:!0}),dc.HeartBeat=void 0;const t=zl,e=Dr.exports,r=_e,n=Vm(),i=Jm();class s extends n.IHeartBeat{constructor(l){super(l),this.events=new e.EventEmitter,this.interval=i.HEARTBEAT_INTERVAL,this.interval=l?.interval||i.HEARTBEAT_INTERVAL}static init(l){return t.__awaiter(this,void 0,void 0,function*(){const f=new s(l);return yield f.init(),f})}init(){return t.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(l,f){this.events.on(l,f)}once(l,f){this.events.once(l,f)}off(l,f){this.events.off(l,f)}removeListener(l,f){this.events.removeListener(l,f)}initialize(){return t.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),r.toMiliseconds(this.interval))})}pulse(){this.events.emit(i.HEARTBEAT_EVENTS.pulse)}}return dc.HeartBeat=s,dc}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=zl;e.__exportStar(H7(),t),e.__exportStar(Vm(),t),e.__exportStar(Jm(),t)})(ea);var Gf,Zm;function K7(){if(Zm)return Gf;Zm=1;function t(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}Gf=e;function e(r,n,i){var s=i&&i.stringify||t,c=1;if(typeof r=="object"&&r!==null){var l=n.length+c;if(l===1)return r;var f=new Array(l);f[0]=s(r);for(var h=1;h<l;h++)f[h]=s(n[h]);return f.join(" ")}if(typeof r!="string")return r;var m=n.length;if(m===0)return r;for(var _="",E=1-c,A=-1,I=r&&r.length||0,R=0;R<I;){if(r.charCodeAt(R)===37&&R+1<I){switch(A=A>-1?A:0,r.charCodeAt(R+1)){case 100:case 102:if(E>=m||n[E]==null)break;A<R&&(_+=r.slice(A,R)),_+=Number(n[E]),A=R+2,R++;break;case 105:if(E>=m||n[E]==null)break;A<R&&(_+=r.slice(A,R)),_+=Math.floor(Number(n[E])),A=R+2,R++;break;case 79:case 111:case 106:if(E>=m||n[E]===void 0)break;A<R&&(_+=r.slice(A,R));var W=typeof n[E];if(W==="string"){_+="'"+n[E]+"'",A=R+2,R++;break}if(W==="function"){_+=n[E].name||"<anonymous>",A=R+2,R++;break}_+=s(n[E]),A=R+2,R++;break;case 115:if(E>=m)break;A<R&&(_+=r.slice(A,R)),_+=String(n[E]),A=R+2,R++;break;case 37:A<R&&(_+=r.slice(A,R)),_+="%",A=R+2,R++,E--;break}++E}++R}return A===-1?r:(A<I&&(_+=r.slice(A)),_)}return Gf}var Yf,Xm;function ev(){if(Xm)return Yf;Xm=1;const t=K7();Yf=i;const e=j().console||{},r={mapHttpRequest:I,mapHttpResponse:I,wrapRequestSerializer:R,wrapResponseSerializer:R,wrapErrorSerializer:R,req:I,res:I,err:E};function n(P,g){return Array.isArray(P)?P.filter(function(Z){return Z!=="!stdSerializers.err"}):P===!0?Object.keys(g):!1}function i(P){P=P||{},P.browser=P.browser||{};const g=P.browser.transmit;if(g&&typeof g.send!="function")throw Error("pino: transmit option must have a send function");const C=P.browser.write||e;P.browser.write&&(P.browser.asObject=!0);const Z=P.serializers||{},J=n(P.browser.serialize,Z);let te=P.browser.serialize;Array.isArray(P.browser.serialize)&&P.browser.serialize.indexOf("!stdSerializers.err")>-1&&(te=!1);const ae=["error","fatal","warn","info","debug","trace"];typeof C=="function"&&(C.error=C.fatal=C.warn=C.info=C.debug=C.trace=C),P.enabled===!1&&(P.level="silent");const p=P.level||"info",d=Object.create(C);d.log||(d.log=W),Object.defineProperty(d,"levelVal",{get:D}),Object.defineProperty(d,"level",{get:M,set:N});const b={transmit:g,serialize:J,asObject:P.browser.asObject,levels:ae,timestamp:A(P)};d.levels=i.levels,d.level=p,d.setMaxListeners=d.getMaxListeners=d.emit=d.addListener=d.on=d.prependListener=d.once=d.prependOnceListener=d.removeListener=d.removeAllListeners=d.listeners=d.listenerCount=d.eventNames=d.write=d.flush=W,d.serializers=Z,d._serialize=J,d._stdErrSerialize=te,d.child=U,g&&(d._logEvent=_());function D(){return this.level==="silent"?1/0:this.levels.values[this.level]}function M(){return this._level}function N(O){if(O!=="silent"&&!this.levels.values[O])throw Error("unknown level "+O);this._level=O,s(b,d,"error","log"),s(b,d,"fatal","error"),s(b,d,"warn","error"),s(b,d,"info","log"),s(b,d,"debug","log"),s(b,d,"trace","log")}function U(O,v){if(!O)throw new Error("missing bindings for child Pino");v=v||{},J&&O.serializers&&(v.serializers=O.serializers);const L=v.serializers;if(J&&L){var oe=Object.assign({},Z,L),de=P.browser.serialize===!0?Object.keys(oe):J;delete O.serializers,f([O],de,oe,this._stdErrSerialize)}function x(ne){this._childLevel=(ne._childLevel|0)+1,this.error=h(ne,O,"error"),this.fatal=h(ne,O,"fatal"),this.warn=h(ne,O,"warn"),this.info=h(ne,O,"info"),this.debug=h(ne,O,"debug"),this.trace=h(ne,O,"trace"),oe&&(this.serializers=oe,this._serialize=de),g&&(this._logEvent=_([].concat(ne._logEvent.bindings,O)))}return x.prototype=this,new x(this)}return d}i.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"}},i.stdSerializers=r,i.stdTimeFunctions=Object.assign({},{nullTime:Y,epochTime:F,unixTime:z,isoTime:$});function s(P,g,C,Z){const J=Object.getPrototypeOf(g);g[C]=g.levelVal>g.levels.values[C]?W:J[C]?J[C]:e[C]||e[Z]||W,c(P,g,C)}function c(P,g,C){!P.transmit&&g[C]===W||(g[C]=function(Z){return function(){const te=P.timestamp(),ae=new Array(arguments.length),p=Object.getPrototypeOf&&Object.getPrototypeOf(this)===e?e:this;for(var d=0;d<ae.length;d++)ae[d]=arguments[d];if(P.serialize&&!P.asObject&&f(ae,this._serialize,this.serializers,this._stdErrSerialize),P.asObject?Z.call(p,l(this,C,ae,te)):Z.apply(p,ae),P.transmit){const b=P.transmit.level||g.level,D=i.levels.values[b],M=i.levels.values[C];if(M<D)return;m(this,{ts:te,methodLevel:C,methodValue:M,transmitLevel:b,transmitValue:i.levels.values[P.transmit.level||g.level],send:P.transmit.send,val:g.levelVal},ae)}}}(g[C]))}function l(P,g,C,Z){P._serialize&&f(C,P._serialize,P.serializers,P._stdErrSerialize);const J=C.slice();let te=J[0];const ae={};Z&&(ae.time=Z),ae.level=i.levels.values[g];let p=(P._childLevel|0)+1;if(p<1&&(p=1),te!==null&&typeof te=="object"){for(;p--&&typeof J[0]=="object";)Object.assign(ae,J.shift());te=J.length?t(J.shift(),J):void 0}else typeof te=="string"&&(te=t(J.shift(),J));return te!==void 0&&(ae.msg=te),ae}function f(P,g,C,Z){for(const J in P)if(Z&&P[J]instanceof Error)P[J]=i.stdSerializers.err(P[J]);else if(typeof P[J]=="object"&&!Array.isArray(P[J]))for(const te in P[J])g&&g.indexOf(te)>-1&&te in C&&(P[J][te]=C[te](P[J][te]))}function h(P,g,C){return function(){const Z=new Array(1+arguments.length);Z[0]=g;for(var J=1;J<Z.length;J++)Z[J]=arguments[J-1];return P[C].apply(this,Z)}}function m(P,g,C){const Z=g.send,J=g.ts,te=g.methodLevel,ae=g.methodValue,p=g.val,d=P._logEvent.bindings;f(C,P._serialize||Object.keys(P.serializers),P.serializers,P._stdErrSerialize===void 0?!0:P._stdErrSerialize),P._logEvent.ts=J,P._logEvent.messages=C.filter(function(b){return d.indexOf(b)===-1}),P._logEvent.level.label=te,P._logEvent.level.value=ae,Z(te,P._logEvent,p),P._logEvent=_(d)}function _(P){return{ts:0,messages:[],bindings:P||[],level:{label:"",value:0}}}function E(P){const g={type:P.constructor.name,msg:P.message,stack:P.stack};for(const C in P)g[C]===void 0&&(g[C]=P[C]);return g}function A(P){return typeof P.timestamp=="function"?P.timestamp:P.timestamp===!1?Y:F}function I(){return{}}function R(P){return P}function W(){}function Y(){return!1}function F(){return Date.now()}function z(){return Math.round(Date.now()/1e3)}function $(){return new Date(Date.now()).toISOString()}function j(){function P(g){return typeof g<"u"&&g}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 P(self)||P(window)||P(this)||{}}}return Yf}var ls=ev();const W7={level:"info"},gc="custom_context",Jf=1e3*1024;class V7{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class tv{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new V7(e);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}}class rv{constructor(e,r=Jf){this.level=e??"error",this.levelValue=ls.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new tv(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===ls.levels.values.error?console.error(e):r===ls.levels.values.warn?console.warn(e):r===ls.levels.values.debug?console.debug(e):r===ls.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Ui({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new tv(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(Ui({extraMetadata:e})),new Blob(r,{type:"application/json"})}}class G7{constructor(e,r=Jf){this.baseChunkLogger=new rv(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`w3i-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}}class Y7 extends ka.Writable{constructor(e,r=Jf){super({objectMode:!0}),this.baseChunkLogger=new rv(e,r)}_write(e,r,n){try{this.baseChunkLogger.appendToLogs(e),n()}catch(i){n(i)}}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var J7=Object.defineProperty,Q7=Object.defineProperties,Z7=Object.getOwnPropertyDescriptors,nv=Object.getOwnPropertySymbols,X7=Object.prototype.hasOwnProperty,ex=Object.prototype.propertyIsEnumerable,iv=(t,e,r)=>e in t?J7(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hl=(t,e)=>{for(var r in e||(e={}))X7.call(e,r)&&iv(t,r,e[r]);if(nv)for(var r of nv(e))ex.call(e,r)&&iv(t,r,e[r]);return t},Kl=(t,e)=>Q7(t,Z7(e));function sv(t){return Kl(Hl({},t),{level:t?.level||W7.level})}function tx(t,e=gc){return t[e]||""}function rx(t,e,r=gc){return t[r]=e,t}function mn(t,e=gc){let r="";return typeof t.bindings>"u"?r=tx(t,e):r=t.bindings().context||"",r}function nx(t,e,r=gc){const n=mn(t,r);return n.trim()?`${n}/${e}`:e}function vn(t,e,r=gc){const n=nx(t,e,r),i=t.child({context:n});return rx(i,n,r)}function ix(t){var e,r;const n=new G7((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:ls(Kl(Hl({},t.opts),{level:"trace",browser:Kl(Hl({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function sx(t){var e;const r=new Y7((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:ls(Kl(Hl({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function ox(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?ix(t):sx(t)}class ax extends Ys{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class cx extends Ys{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}}class lx{constructor(e,r){this.logger=e,this.core=r}}class ux extends Ys{constructor(e,r){super(),this.relayer=e,this.logger=r}}class hx extends Ys{constructor(e){super()}}class fx{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}}class dx extends Ys{constructor(e,r){super(),this.relayer=e,this.logger=r}}class px extends Ys{constructor(e,r){super(),this.core=e,this.logger=r}}class gx{constructor(e,r){this.projectId=e,this.logger=r}}class mx{constructor(e,r){this.projectId=e,this.logger=r}}class vx{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class yx{constructor(e){this.client=e}}var Qf={},ov={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ct,r=fn;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var n=function(){function l(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.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 l.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},l.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},l.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},l.prototype.update=function(f,h){if(h===void 0&&(h=f.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var m=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&h>0;)this._buffer[this._bufferLength++]=f[m++],h--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(m=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,f,m,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=f[m++],h--;return this},l.prototype.finish=function(f){if(!this._finished){var h=this._bytesHashed,m=this._bufferLength,_=h/536870912|0,E=h<<3,A=h%128<112?128:256;this._buffer[m]=128;for(var I=m+1;I<A-8;I++)this._buffer[I]=0;e.writeUint32BE(_,this._buffer,A-8),e.writeUint32BE(E,this._buffer,A-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,A),this._finished=!0}for(var I=0;I<this.digestLength/8;I++)e.writeUint32BE(this._stateHi[I],f,I*8),e.writeUint32BE(this._stateLo[I],f,I*8+4);return this},l.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},l.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}},l.prototype.restoreState=function(f){return this._stateHi.set(f.stateHi),this._stateLo.set(f.stateLo),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},l.prototype.cleanSavedState=function(f){r.wipe(f.stateHi),r.wipe(f.stateLo),f.buffer&&r.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},l}();t.SHA512=n;var i=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 s(l,f,h,m,_,E,A){for(var I=h[0],R=h[1],W=h[2],Y=h[3],F=h[4],z=h[5],$=h[6],j=h[7],P=m[0],g=m[1],C=m[2],Z=m[3],J=m[4],te=m[5],ae=m[6],p=m[7],d,b,D,M,N,U,O,v;A>=128;){for(var L=0;L<16;L++){var oe=8*L+E;l[L]=e.readUint32BE(_,oe),f[L]=e.readUint32BE(_,oe+4)}for(var L=0;L<80;L++){var de=I,x=R,ne=W,q=Y,H=F,V=z,y=$,k=j,ie=P,fe=g,ue=C,Oe=Z,Me=J,Ie=te,Pt=ae,ze=p;if(d=j,b=p,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=(F>>>14|J<<32-14)^(F>>>18|J<<32-18)^(J>>>41-32|F<<32-(41-32)),b=(J>>>14|F<<32-14)^(J>>>18|F<<32-18)^(F>>>41-32|J<<32-(41-32)),N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,d=F&z^~F&$,b=J&te^~J&ae,N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,d=i[L*2],b=i[L*2+1],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,d=l[L%16],b=f[L%16],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,D=O&65535|v<<16,M=N&65535|U<<16,d=D,b=M,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=(I>>>28|P<<32-28)^(P>>>34-32|I<<32-(34-32))^(P>>>39-32|I<<32-(39-32)),b=(P>>>28|I<<32-28)^(I>>>34-32|P<<32-(34-32))^(I>>>39-32|P<<32-(39-32)),N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,d=I&R^I&W^R&W,b=P&g^P&C^g&C,N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,k=O&65535|v<<16,ze=N&65535|U<<16,d=q,b=Oe,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=D,b=M,N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,q=O&65535|v<<16,Oe=N&65535|U<<16,R=de,W=x,Y=ne,F=q,z=H,$=V,j=y,I=k,g=ie,C=fe,Z=ue,J=Oe,te=Me,ae=Ie,p=Pt,P=ze,L%16===15)for(var oe=0;oe<16;oe++)d=l[oe],b=f[oe],N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=l[(oe+9)%16],b=f[(oe+9)%16],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,D=l[(oe+1)%16],M=f[(oe+1)%16],d=(D>>>1|M<<32-1)^(D>>>8|M<<32-8)^D>>>7,b=(M>>>1|D<<32-1)^(M>>>8|D<<32-8)^(M>>>7|D<<32-7),N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,D=l[(oe+14)%16],M=f[(oe+14)%16],d=(D>>>19|M<<32-19)^(M>>>61-32|D<<32-(61-32))^D>>>6,b=(M>>>19|D<<32-19)^(D>>>61-32|M<<32-(61-32))^(M>>>6|D<<32-6),N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,l[oe]=O&65535|v<<16,f[oe]=N&65535|U<<16}d=I,b=P,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[0],b=m[0],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[0]=I=O&65535|v<<16,m[0]=P=N&65535|U<<16,d=R,b=g,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[1],b=m[1],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[1]=R=O&65535|v<<16,m[1]=g=N&65535|U<<16,d=W,b=C,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[2],b=m[2],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[2]=W=O&65535|v<<16,m[2]=C=N&65535|U<<16,d=Y,b=Z,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[3],b=m[3],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[3]=Y=O&65535|v<<16,m[3]=Z=N&65535|U<<16,d=F,b=J,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[4],b=m[4],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[4]=F=O&65535|v<<16,m[4]=J=N&65535|U<<16,d=z,b=te,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[5],b=m[5],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[5]=z=O&65535|v<<16,m[5]=te=N&65535|U<<16,d=$,b=ae,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[6],b=m[6],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[6]=$=O&65535|v<<16,m[6]=ae=N&65535|U<<16,d=j,b=p,N=b&65535,U=b>>>16,O=d&65535,v=d>>>16,d=h[7],b=m[7],N+=b&65535,U+=b>>>16,O+=d&65535,v+=d>>>16,U+=N>>>16,O+=U>>>16,v+=O>>>16,h[7]=j=O&65535|v<<16,m[7]=p=N&65535|U<<16,E+=128,A-=128}return E}function c(l){var f=new n;f.update(l);var h=f.digest();return f.clean(),h}t.hash=c})(ov),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=Fo,r=ov,n=fn;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(q){const H=new Float64Array(16);if(q)for(let V=0;V<q.length;V++)H[V]=q[V];return H}const s=new Uint8Array(32);s[0]=9;const c=i(),l=i([1]),f=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),m=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),_=i([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),E=i([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function A(q,H){for(let V=0;V<16;V++)q[V]=H[V]|0}function I(q){let H=1;for(let V=0;V<16;V++){let y=q[V]+H+65535;H=Math.floor(y/65536),q[V]=y-H*65536}q[0]+=H-1+37*(H-1)}function R(q,H,V){const y=~(V-1);for(let k=0;k<16;k++){const ie=y&(q[k]^H[k]);q[k]^=ie,H[k]^=ie}}function W(q,H){const V=i(),y=i();for(let k=0;k<16;k++)y[k]=H[k];I(y),I(y),I(y);for(let k=0;k<2;k++){V[0]=y[0]-65517;for(let fe=1;fe<15;fe++)V[fe]=y[fe]-65535-(V[fe-1]>>16&1),V[fe-1]&=65535;V[15]=y[15]-32767-(V[14]>>16&1);const ie=V[15]>>16&1;V[14]&=65535,R(y,V,1-ie)}for(let k=0;k<16;k++)q[2*k]=y[k]&255,q[2*k+1]=y[k]>>8}function Y(q,H){let V=0;for(let y=0;y<32;y++)V|=q[y]^H[y];return(1&V-1>>>8)-1}function F(q,H){const V=new Uint8Array(32),y=new Uint8Array(32);return W(V,q),W(y,H),Y(V,y)}function z(q){const H=new Uint8Array(32);return W(H,q),H[0]&1}function $(q,H){for(let V=0;V<16;V++)q[V]=H[2*V]+(H[2*V+1]<<8);q[15]&=32767}function j(q,H,V){for(let y=0;y<16;y++)q[y]=H[y]+V[y]}function P(q,H,V){for(let y=0;y<16;y++)q[y]=H[y]-V[y]}function g(q,H,V){let y,k,ie=0,fe=0,ue=0,Oe=0,Me=0,Ie=0,Pt=0,ze=0,Ce=0,Fe=0,Ee=0,Ae=0,Ge=0,we=0,xe=0,Be=0,be=0,Pe=0,je=0,Te=0,$e=0,lt=0,Re=0,Ne=0,nr=0,dt=0,Et=0,ir=0,St=0,Ot=0,Vr=0,Ye=V[0],He=V[1],Rt=V[2],Je=V[3],Ve=V[4],Mt=V[5],Xe=V[6],et=V[7],Lt=V[8],tt=V[9],Qe=V[10],Ft=V[11],Ze=V[12],ke=V[13],Ht=V[14],rt=V[15];y=H[0],ie+=y*Ye,fe+=y*He,ue+=y*Rt,Oe+=y*Je,Me+=y*Ve,Ie+=y*Mt,Pt+=y*Xe,ze+=y*et,Ce+=y*Lt,Fe+=y*tt,Ee+=y*Qe,Ae+=y*Ft,Ge+=y*Ze,we+=y*ke,xe+=y*Ht,Be+=y*rt,y=H[1],fe+=y*Ye,ue+=y*He,Oe+=y*Rt,Me+=y*Je,Ie+=y*Ve,Pt+=y*Mt,ze+=y*Xe,Ce+=y*et,Fe+=y*Lt,Ee+=y*tt,Ae+=y*Qe,Ge+=y*Ft,we+=y*Ze,xe+=y*ke,Be+=y*Ht,be+=y*rt,y=H[2],ue+=y*Ye,Oe+=y*He,Me+=y*Rt,Ie+=y*Je,Pt+=y*Ve,ze+=y*Mt,Ce+=y*Xe,Fe+=y*et,Ee+=y*Lt,Ae+=y*tt,Ge+=y*Qe,we+=y*Ft,xe+=y*Ze,Be+=y*ke,be+=y*Ht,Pe+=y*rt,y=H[3],Oe+=y*Ye,Me+=y*He,Ie+=y*Rt,Pt+=y*Je,ze+=y*Ve,Ce+=y*Mt,Fe+=y*Xe,Ee+=y*et,Ae+=y*Lt,Ge+=y*tt,we+=y*Qe,xe+=y*Ft,Be+=y*Ze,be+=y*ke,Pe+=y*Ht,je+=y*rt,y=H[4],Me+=y*Ye,Ie+=y*He,Pt+=y*Rt,ze+=y*Je,Ce+=y*Ve,Fe+=y*Mt,Ee+=y*Xe,Ae+=y*et,Ge+=y*Lt,we+=y*tt,xe+=y*Qe,Be+=y*Ft,be+=y*Ze,Pe+=y*ke,je+=y*Ht,Te+=y*rt,y=H[5],Ie+=y*Ye,Pt+=y*He,ze+=y*Rt,Ce+=y*Je,Fe+=y*Ve,Ee+=y*Mt,Ae+=y*Xe,Ge+=y*et,we+=y*Lt,xe+=y*tt,Be+=y*Qe,be+=y*Ft,Pe+=y*Ze,je+=y*ke,Te+=y*Ht,$e+=y*rt,y=H[6],Pt+=y*Ye,ze+=y*He,Ce+=y*Rt,Fe+=y*Je,Ee+=y*Ve,Ae+=y*Mt,Ge+=y*Xe,we+=y*et,xe+=y*Lt,Be+=y*tt,be+=y*Qe,Pe+=y*Ft,je+=y*Ze,Te+=y*ke,$e+=y*Ht,lt+=y*rt,y=H[7],ze+=y*Ye,Ce+=y*He,Fe+=y*Rt,Ee+=y*Je,Ae+=y*Ve,Ge+=y*Mt,we+=y*Xe,xe+=y*et,Be+=y*Lt,be+=y*tt,Pe+=y*Qe,je+=y*Ft,Te+=y*Ze,$e+=y*ke,lt+=y*Ht,Re+=y*rt,y=H[8],Ce+=y*Ye,Fe+=y*He,Ee+=y*Rt,Ae+=y*Je,Ge+=y*Ve,we+=y*Mt,xe+=y*Xe,Be+=y*et,be+=y*Lt,Pe+=y*tt,je+=y*Qe,Te+=y*Ft,$e+=y*Ze,lt+=y*ke,Re+=y*Ht,Ne+=y*rt,y=H[9],Fe+=y*Ye,Ee+=y*He,Ae+=y*Rt,Ge+=y*Je,we+=y*Ve,xe+=y*Mt,Be+=y*Xe,be+=y*et,Pe+=y*Lt,je+=y*tt,Te+=y*Qe,$e+=y*Ft,lt+=y*Ze,Re+=y*ke,Ne+=y*Ht,nr+=y*rt,y=H[10],Ee+=y*Ye,Ae+=y*He,Ge+=y*Rt,we+=y*Je,xe+=y*Ve,Be+=y*Mt,be+=y*Xe,Pe+=y*et,je+=y*Lt,Te+=y*tt,$e+=y*Qe,lt+=y*Ft,Re+=y*Ze,Ne+=y*ke,nr+=y*Ht,dt+=y*rt,y=H[11],Ae+=y*Ye,Ge+=y*He,we+=y*Rt,xe+=y*Je,Be+=y*Ve,be+=y*Mt,Pe+=y*Xe,je+=y*et,Te+=y*Lt,$e+=y*tt,lt+=y*Qe,Re+=y*Ft,Ne+=y*Ze,nr+=y*ke,dt+=y*Ht,Et+=y*rt,y=H[12],Ge+=y*Ye,we+=y*He,xe+=y*Rt,Be+=y*Je,be+=y*Ve,Pe+=y*Mt,je+=y*Xe,Te+=y*et,$e+=y*Lt,lt+=y*tt,Re+=y*Qe,Ne+=y*Ft,nr+=y*Ze,dt+=y*ke,Et+=y*Ht,ir+=y*rt,y=H[13],we+=y*Ye,xe+=y*He,Be+=y*Rt,be+=y*Je,Pe+=y*Ve,je+=y*Mt,Te+=y*Xe,$e+=y*et,lt+=y*Lt,Re+=y*tt,Ne+=y*Qe,nr+=y*Ft,dt+=y*Ze,Et+=y*ke,ir+=y*Ht,St+=y*rt,y=H[14],xe+=y*Ye,Be+=y*He,be+=y*Rt,Pe+=y*Je,je+=y*Ve,Te+=y*Mt,$e+=y*Xe,lt+=y*et,Re+=y*Lt,Ne+=y*tt,nr+=y*Qe,dt+=y*Ft,Et+=y*Ze,ir+=y*ke,St+=y*Ht,Ot+=y*rt,y=H[15],Be+=y*Ye,be+=y*He,Pe+=y*Rt,je+=y*Je,Te+=y*Ve,$e+=y*Mt,lt+=y*Xe,Re+=y*et,Ne+=y*Lt,nr+=y*tt,dt+=y*Qe,Et+=y*Ft,ir+=y*Ze,St+=y*ke,Ot+=y*Ht,Vr+=y*rt,ie+=38*be,fe+=38*Pe,ue+=38*je,Oe+=38*Te,Me+=38*$e,Ie+=38*lt,Pt+=38*Re,ze+=38*Ne,Ce+=38*nr,Fe+=38*dt,Ee+=38*Et,Ae+=38*ir,Ge+=38*St,we+=38*Ot,xe+=38*Vr,k=1,y=ie+k+65535,k=Math.floor(y/65536),ie=y-k*65536,y=fe+k+65535,k=Math.floor(y/65536),fe=y-k*65536,y=ue+k+65535,k=Math.floor(y/65536),ue=y-k*65536,y=Oe+k+65535,k=Math.floor(y/65536),Oe=y-k*65536,y=Me+k+65535,k=Math.floor(y/65536),Me=y-k*65536,y=Ie+k+65535,k=Math.floor(y/65536),Ie=y-k*65536,y=Pt+k+65535,k=Math.floor(y/65536),Pt=y-k*65536,y=ze+k+65535,k=Math.floor(y/65536),ze=y-k*65536,y=Ce+k+65535,k=Math.floor(y/65536),Ce=y-k*65536,y=Fe+k+65535,k=Math.floor(y/65536),Fe=y-k*65536,y=Ee+k+65535,k=Math.floor(y/65536),Ee=y-k*65536,y=Ae+k+65535,k=Math.floor(y/65536),Ae=y-k*65536,y=Ge+k+65535,k=Math.floor(y/65536),Ge=y-k*65536,y=we+k+65535,k=Math.floor(y/65536),we=y-k*65536,y=xe+k+65535,k=Math.floor(y/65536),xe=y-k*65536,y=Be+k+65535,k=Math.floor(y/65536),Be=y-k*65536,ie+=k-1+37*(k-1),k=1,y=ie+k+65535,k=Math.floor(y/65536),ie=y-k*65536,y=fe+k+65535,k=Math.floor(y/65536),fe=y-k*65536,y=ue+k+65535,k=Math.floor(y/65536),ue=y-k*65536,y=Oe+k+65535,k=Math.floor(y/65536),Oe=y-k*65536,y=Me+k+65535,k=Math.floor(y/65536),Me=y-k*65536,y=Ie+k+65535,k=Math.floor(y/65536),Ie=y-k*65536,y=Pt+k+65535,k=Math.floor(y/65536),Pt=y-k*65536,y=ze+k+65535,k=Math.floor(y/65536),ze=y-k*65536,y=Ce+k+65535,k=Math.floor(y/65536),Ce=y-k*65536,y=Fe+k+65535,k=Math.floor(y/65536),Fe=y-k*65536,y=Ee+k+65535,k=Math.floor(y/65536),Ee=y-k*65536,y=Ae+k+65535,k=Math.floor(y/65536),Ae=y-k*65536,y=Ge+k+65535,k=Math.floor(y/65536),Ge=y-k*65536,y=we+k+65535,k=Math.floor(y/65536),we=y-k*65536,y=xe+k+65535,k=Math.floor(y/65536),xe=y-k*65536,y=Be+k+65535,k=Math.floor(y/65536),Be=y-k*65536,ie+=k-1+37*(k-1),q[0]=ie,q[1]=fe,q[2]=ue,q[3]=Oe,q[4]=Me,q[5]=Ie,q[6]=Pt,q[7]=ze,q[8]=Ce,q[9]=Fe,q[10]=Ee,q[11]=Ae,q[12]=Ge,q[13]=we,q[14]=xe,q[15]=Be}function C(q,H){g(q,H,H)}function Z(q,H){const V=i();let y;for(y=0;y<16;y++)V[y]=H[y];for(y=253;y>=0;y--)C(V,V),y!==2&&y!==4&&g(V,V,H);for(y=0;y<16;y++)q[y]=V[y]}function J(q,H){const V=i();let y;for(y=0;y<16;y++)V[y]=H[y];for(y=250;y>=0;y--)C(V,V),y!==1&&g(V,V,H);for(y=0;y<16;y++)q[y]=V[y]}function te(q,H){const V=i(),y=i(),k=i(),ie=i(),fe=i(),ue=i(),Oe=i(),Me=i(),Ie=i();P(V,q[1],q[0]),P(Ie,H[1],H[0]),g(V,V,Ie),j(y,q[0],q[1]),j(Ie,H[0],H[1]),g(y,y,Ie),g(k,q[3],H[3]),g(k,k,h),g(ie,q[2],H[2]),j(ie,ie,ie),P(fe,y,V),P(ue,ie,k),j(Oe,ie,k),j(Me,y,V),g(q[0],fe,ue),g(q[1],Me,Oe),g(q[2],Oe,ue),g(q[3],fe,Me)}function ae(q,H,V){for(let y=0;y<4;y++)R(q[y],H[y],V)}function p(q,H){const V=i(),y=i(),k=i();Z(k,H[2]),g(V,H[0],k),g(y,H[1],k),W(q,y),q[31]^=z(V)<<7}function d(q,H,V){A(q[0],c),A(q[1],l),A(q[2],l),A(q[3],c);for(let y=255;y>=0;--y){const k=V[y/8|0]>>(y&7)&1;ae(q,H,k),te(H,q),te(q,q),ae(q,H,k)}}function b(q,H){const V=[i(),i(),i(),i()];A(V[0],m),A(V[1],_),A(V[2],l),g(V[3],m,_),d(q,V,H)}function D(q){if(q.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const H=(0,r.hash)(q);H[0]&=248,H[31]&=127,H[31]|=64;const V=new Uint8Array(32),y=[i(),i(),i(),i()];b(y,H),p(V,y);const k=new Uint8Array(64);return k.set(q),k.set(V,32),{publicKey:V,secretKey:k}}t.generateKeyPairFromSeed=D;function M(q){const H=(0,e.randomBytes)(32,q),V=D(H);return(0,n.wipe)(H),V}t.generateKeyPair=M;function N(q){if(q.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(q.subarray(32))}t.extractPublicKeyFromSecretKey=N;const U=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 O(q,H){let V,y,k,ie;for(y=63;y>=32;--y){for(V=0,k=y-32,ie=y-12;k<ie;++k)H[k]+=V-16*H[y]*U[k-(y-32)],V=Math.floor((H[k]+128)/256),H[k]-=V*256;H[k]+=V,H[y]=0}for(V=0,k=0;k<32;k++)H[k]+=V-(H[31]>>4)*U[k],V=H[k]>>8,H[k]&=255;for(k=0;k<32;k++)H[k]-=V*U[k];for(y=0;y<32;y++)H[y+1]+=H[y]>>8,q[y]=H[y]&255}function v(q){const H=new Float64Array(64);for(let V=0;V<64;V++)H[V]=q[V];for(let V=0;V<64;V++)q[V]=0;O(q,H)}function L(q,H){const V=new Float64Array(64),y=[i(),i(),i(),i()],k=(0,r.hash)(q.subarray(0,32));k[0]&=248,k[31]&=127,k[31]|=64;const ie=new Uint8Array(64);ie.set(k.subarray(32),32);const fe=new r.SHA512;fe.update(ie.subarray(32)),fe.update(H);const ue=fe.digest();fe.clean(),v(ue),b(y,ue),p(ie,y),fe.reset(),fe.update(ie.subarray(0,32)),fe.update(q.subarray(32)),fe.update(H);const Oe=fe.digest();v(Oe);for(let Me=0;Me<32;Me++)V[Me]=ue[Me];for(let Me=0;Me<32;Me++)for(let Ie=0;Ie<32;Ie++)V[Me+Ie]+=Oe[Me]*k[Ie];return O(ie.subarray(32),V),ie}t.sign=L;function oe(q,H){const V=i(),y=i(),k=i(),ie=i(),fe=i(),ue=i(),Oe=i();return A(q[2],l),$(q[1],H),C(k,q[1]),g(ie,k,f),P(k,k,q[2]),j(ie,q[2],ie),C(fe,ie),C(ue,fe),g(Oe,ue,fe),g(V,Oe,k),g(V,V,ie),J(V,V),g(V,V,k),g(V,V,ie),g(V,V,ie),g(q[0],V,ie),C(y,q[0]),g(y,y,ie),F(y,k)&&g(q[0],q[0],E),C(y,q[0]),g(y,y,ie),F(y,k)?-1:(z(q[0])===H[31]>>7&&P(q[0],c,q[0]),g(q[3],q[0],q[1]),0)}function de(q,H,V){const y=new Uint8Array(32),k=[i(),i(),i(),i()],ie=[i(),i(),i(),i()];if(V.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(oe(ie,q))return!1;const fe=new r.SHA512;fe.update(V.subarray(0,32)),fe.update(q),fe.update(H);const ue=fe.digest();return v(ue),d(k,ie,ue),b(ie,V.subarray(32)),te(k,ie),p(y,k),!Y(V,y)}t.verify=de;function x(q){let H=[i(),i(),i(),i()];if(oe(H,q))throw new Error("Ed25519: invalid public key");let V=i(),y=i(),k=H[1];j(V,l,k),P(y,l,k),Z(y,y),g(V,V,y);let ie=new Uint8Array(32);return W(ie,V),ie}t.convertPublicKeyToX25519=x;function ne(q){const H=(0,r.hash)(q.subarray(0,32));H[0]&=248,H[31]&=127,H[31]|=64;const V=new Uint8Array(H.subarray(0,32));return(0,n.wipe)(H),V}t.convertSecretKeyToX25519=ne}(Qf);const wx="EdDSA",bx="JWT",av=".",cv="base64url",_x="utf8",Ex="utf8",Ax=":",xx="did",Sx="key",lv="base58btc",Ix="z",Dx="K36",Cx=32;function Wl(t){return Fr(Xr(Ui(t),_x),cv)}function uv(t){const e=Xr(Dx,lv),r=Ix+Fr(ef([e,t]),lv);return[xx,Sx,r].join(Ax)}function Ox(t){return Fr(t,cv)}function Px(t){return Xr([Wl(t.header),Wl(t.payload)].join(av),Ex)}function Mx(t){return[Wl(t.header),Wl(t.payload),Ox(t.signature)].join(av)}function hv(t=Fo.randomBytes(Cx)){return Qf.generateKeyPairFromSeed(t)}async function Tx(t,e,r,n,i=_e.fromMiliseconds(Date.now())){const s={alg:wx,typ:bx},c=uv(n.publicKey),l=i+r,f={iss:c,sub:t,aud:e,iat:i,exp:l},h=Px({header:s,payload:f}),m=Qf.sign(n.secretKey,h);return Mx({header:s,payload:f,signature:m})}const $x="PARSE_ERROR",Nx="INVALID_REQUEST",Rx="METHOD_NOT_FOUND",Lx="INVALID_PARAMS",fv="INTERNAL_ERROR",Zf="SERVER_ERROR",Bx=[-32700,-32600,-32601,-32602,-32603],mc={[$x]:{code:-32700,message:"Parse error"},[Nx]:{code:-32600,message:"Invalid Request"},[Rx]:{code:-32601,message:"Method not found"},[Lx]:{code:-32602,message:"Invalid params"},[fv]:{code:-32603,message:"Internal error"},[Zf]:{code:-32e3,message:"Server error"}},dv=Zf;function Ux(t){return Bx.includes(t)}function pv(t){return Object.keys(mc).includes(t)?mc[t]:mc[dv]}function Fx(t){const e=Object.values(mc).find(r=>r.code===t);return e||mc[dv]}function gv(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var mv={};/*! *****************************************************************************
34
44
  Copyright (c) Microsoft Corporation.
35
45
 
36
46
  Permission to use, copy, modify, and/or distribute this software for any
@@ -43,7 +53,7 @@
43
53
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
44
54
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
45
55
  PERFORMANCE OF THIS SOFTWARE.
46
- ***************************************************************************** */var xu=function(r,e){return xu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},xu(r,e)};function y5(r,e){xu(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Iu=function(){return Iu=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Iu.apply(this,arguments)};function w5(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function b5(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var u=r.length-1;u>=0;u--)(c=r[u])&&(a=(i<3?c(a):i>3?c(e,t,a):c(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function _5(r,e){return function(t,n){e(t,n,r)}}function E5(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function x5(r,e,t,n){function i(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function u(m){try{h(n.next(m))}catch(w){c(w)}}function f(m){try{h(n.throw(m))}catch(w){c(w)}}function h(m){m.done?a(m.value):i(m.value).then(u,f)}h((n=n.apply(r,e||[])).next())})}function I5(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=h[0]&2?i.return:h[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,h[1])).done)return a;switch(i=0,a&&(h=[h[0]&2,a.value]),h[0]){case 0:case 1:a=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,i=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){t.label=h[1];break}if(h[0]===6&&t.label<a[1]){t.label=a[1],a=h;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(h);break}a[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(m){h=[6,m],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function D5(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}function S5(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function Du(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Sp(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(u){c={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(c)throw c.error}}return a}function O5(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(Sp(arguments[e]));return r}function C5(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],c=0,u=a.length;c<u;c++,i++)n[i]=a[c];return n}function No(r){return this instanceof No?(this.v=r,this):new No(r)}function $5(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(y){n[y]&&(i[y]=function(_){return new Promise(function(S,P){a.push([y,_,S,P])>1||u(y,_)})})}function u(y,_){try{f(n[y](_))}catch(S){w(a[0][3],S)}}function f(y){y.value instanceof No?Promise.resolve(y.value.v).then(h,m):w(a[0][2],y)}function h(y){u("next",y)}function m(y){u("throw",y)}function w(y,_){y(_),a.shift(),a.length&&u(a[0][0],a[0][1])}}function A5(r){var e,t;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,a){e[i]=r[i]?function(c){return(t=!t)?{value:No(r[i](c)),done:i==="return"}:a?a(c):c}:a}}function P5(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 Du=="function"?Du(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(c){return new Promise(function(u,f){c=r[a](c),i(u,f,c.done,c.value)})}}function i(a,c,u,f){Promise.resolve(f).then(function(h){a({value:h,done:u})},c)}}function T5(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function R5(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 N5(r){return r&&r.__esModule?r:{default:r}}function L5(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function M5(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 U5=Object.freeze({__proto__:null,__extends:y5,get __assign(){return Iu},__rest:w5,__decorate:b5,__param:_5,__metadata:E5,__awaiter:x5,__generator:I5,__createBinding:D5,__exportStar:S5,__values:Du,__read:Sp,__spread:O5,__spreadArrays:C5,__await:No,__asyncGenerator:$5,__asyncDelegator:A5,__asyncValues:P5,__makeTemplateObject:T5,__importStar:R5,__importDefault:N5,__classPrivateFieldGet:L5,__classPrivateFieldSet:M5}),j5=Pi(U5),Su,Op;function F5(){if(Op)return Su;Op=1;function r(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}Su=e;function e(t,n,i){var a=i&&i.stringify||r,c=1;if(typeof t=="object"&&t!==null){var u=n.length+c;if(u===1)return t;var f=new Array(u);f[0]=a(t);for(var h=1;h<u;h++)f[h]=a(n[h]);return f.join(" ")}if(typeof t!="string")return t;var m=n.length;if(m===0)return t;for(var w="",y=1-c,_=-1,S=t&&t.length||0,P=0;P<S;){if(t.charCodeAt(P)===37&&P+1<S){switch(_=_>-1?_:0,t.charCodeAt(P+1)){case 100:case 102:if(y>=m||n[y]==null)break;_<P&&(w+=t.slice(_,P)),w+=Number(n[y]),_=P+2,P++;break;case 105:if(y>=m||n[y]==null)break;_<P&&(w+=t.slice(_,P)),w+=Math.floor(Number(n[y])),_=P+2,P++;break;case 79:case 111:case 106:if(y>=m||n[y]===void 0)break;_<P&&(w+=t.slice(_,P));var j=typeof n[y];if(j==="string"){w+="'"+n[y]+"'",_=P+2,P++;break}if(j==="function"){w+=n[y].name||"<anonymous>",_=P+2,P++;break}w+=a(n[y]),_=P+2,P++;break;case 115:if(y>=m)break;_<P&&(w+=t.slice(_,P)),w+=String(n[y]),_=P+2,P++;break;case 37:_<P&&(w+=t.slice(_,P)),w+="%",_=P+2,P++,y--;break}++y}++P}return _===-1?t:(_<S&&(w+=t.slice(_)),w)}return Su}var Ou,Cp;function B5(){if(Cp)return Ou;Cp=1;const r=F5();Ou=i;const e=$().console||{},t={mapHttpRequest:S,mapHttpResponse:S,wrapRequestSerializer:P,wrapResponseSerializer:P,wrapErrorSerializer:P,req:S,res:S,err:y};function n(x,d){return Array.isArray(x)?x.filter(function(H){return H!=="!stdSerializers.err"}):x===!0?Object.keys(d):!1}function i(x){x=x||{},x.browser=x.browser||{};const d=x.browser.transmit;if(d&&typeof d.send!="function")throw Error("pino: transmit option must have a send function");const b=x.browser.write||e;x.browser.write&&(x.browser.asObject=!0);const H=x.serializers||{},F=n(x.browser.serialize,H);let V=x.browser.serialize;Array.isArray(x.browser.serialize)&&x.browser.serialize.indexOf("!stdSerializers.err")>-1&&(V=!1);const se=["error","fatal","warn","info","debug","trace"];typeof b=="function"&&(b.error=b.fatal=b.warn=b.info=b.debug=b.trace=b),x.enabled===!1&&(x.level="silent");const ce=x.level||"info",I=Object.create(b);I.log||(I.log=j),Object.defineProperty(I,"levelVal",{get:X}),Object.defineProperty(I,"level",{get:ee,set:Y});const N={transmit:d,serialize:F,asObject:x.browser.asObject,levels:se,timestamp:_(x)};I.levels=i.levels,I.level=ce,I.setMaxListeners=I.getMaxListeners=I.emit=I.addListener=I.on=I.prependListener=I.once=I.prependOnceListener=I.removeListener=I.removeAllListeners=I.listeners=I.listenerCount=I.eventNames=I.write=I.flush=j,I.serializers=H,I._serialize=F,I._stdErrSerialize=V,I.child=Z,d&&(I._logEvent=w());function X(){return this.level==="silent"?1/0:this.levels.values[this.level]}function ee(){return this._level}function Y(Q){if(Q!=="silent"&&!this.levels.values[Q])throw Error("unknown level "+Q);this._level=Q,a(N,I,"error","log"),a(N,I,"fatal","error"),a(N,I,"warn","error"),a(N,I,"info","log"),a(N,I,"debug","log"),a(N,I,"trace","log")}function Z(Q,ie){if(!Q)throw new Error("missing bindings for child Pino");ie=ie||{},F&&Q.serializers&&(ie.serializers=Q.serializers);const Ee=ie.serializers;if(F&&Ee){var ae=Object.assign({},H,Ee),xe=x.browser.serialize===!0?Object.keys(ae):F;delete Q.serializers,f([Q],xe,ae,this._stdErrSerialize)}function de(be){this._childLevel=(be._childLevel|0)+1,this.error=h(be,Q,"error"),this.fatal=h(be,Q,"fatal"),this.warn=h(be,Q,"warn"),this.info=h(be,Q,"info"),this.debug=h(be,Q,"debug"),this.trace=h(be,Q,"trace"),ae&&(this.serializers=ae,this._serialize=xe),d&&(this._logEvent=w([].concat(be._logEvent.bindings,Q)))}return de.prototype=this,new de(this)}return I}i.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"}},i.stdSerializers=t,i.stdTimeFunctions=Object.assign({},{nullTime:U,epochTime:A,unixTime:T,isoTime:O});function a(x,d,b,H){const F=Object.getPrototypeOf(d);d[b]=d.levelVal>d.levels.values[b]?j:F[b]?F[b]:e[b]||e[H]||j,c(x,d,b)}function c(x,d,b){!x.transmit&&d[b]===j||(d[b]=function(H){return function(){const V=x.timestamp(),se=new Array(arguments.length),ce=Object.getPrototypeOf&&Object.getPrototypeOf(this)===e?e:this;for(var I=0;I<se.length;I++)se[I]=arguments[I];if(x.serialize&&!x.asObject&&f(se,this._serialize,this.serializers,this._stdErrSerialize),x.asObject?H.call(ce,u(this,b,se,V)):H.apply(ce,se),x.transmit){const N=x.transmit.level||d.level,X=i.levels.values[N],ee=i.levels.values[b];if(ee<X)return;m(this,{ts:V,methodLevel:b,methodValue:ee,transmitLevel:N,transmitValue:i.levels.values[x.transmit.level||d.level],send:x.transmit.send,val:d.levelVal},se)}}}(d[b]))}function u(x,d,b,H){x._serialize&&f(b,x._serialize,x.serializers,x._stdErrSerialize);const F=b.slice();let V=F[0];const se={};H&&(se.time=H),se.level=i.levels.values[d];let ce=(x._childLevel|0)+1;if(ce<1&&(ce=1),V!==null&&typeof V=="object"){for(;ce--&&typeof F[0]=="object";)Object.assign(se,F.shift());V=F.length?r(F.shift(),F):void 0}else typeof V=="string"&&(V=r(F.shift(),F));return V!==void 0&&(se.msg=V),se}function f(x,d,b,H){for(const F in x)if(H&&x[F]instanceof Error)x[F]=i.stdSerializers.err(x[F]);else if(typeof x[F]=="object"&&!Array.isArray(x[F]))for(const V in x[F])d&&d.indexOf(V)>-1&&V in b&&(x[F][V]=b[V](x[F][V]))}function h(x,d,b){return function(){const H=new Array(1+arguments.length);H[0]=d;for(var F=1;F<H.length;F++)H[F]=arguments[F-1];return x[b].apply(this,H)}}function m(x,d,b){const H=d.send,F=d.ts,V=d.methodLevel,se=d.methodValue,ce=d.val,I=x._logEvent.bindings;f(b,x._serialize||Object.keys(x.serializers),x.serializers,x._stdErrSerialize===void 0?!0:x._stdErrSerialize),x._logEvent.ts=F,x._logEvent.messages=b.filter(function(N){return I.indexOf(N)===-1}),x._logEvent.level.label=V,x._logEvent.level.value=se,H(V,x._logEvent,ce),x._logEvent=w(I)}function w(x){return{ts:0,messages:[],bindings:x||[],level:{label:"",value:0}}}function y(x){const d={type:x.constructor.name,msg:x.message,stack:x.stack};for(const b in x)d[b]===void 0&&(d[b]=x[b]);return d}function _(x){return typeof x.timestamp=="function"?x.timestamp:x.timestamp===!1?U:A}function S(){return{}}function P(x){return x}function j(){}function U(){return!1}function A(){return Date.now()}function T(){return Math.round(Date.now()/1e3)}function O(){return new Date(Date.now()).toISOString()}function $(){function x(d){return typeof d<"u"&&d}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 x(self)||x(window)||x(this)||{}}}return Ou}var ki={},$p;function Ap(){return $p||($p=1,Object.defineProperty(ki,"__esModule",{value:!0}),ki.PINO_CUSTOM_CONTEXT_KEY=ki.PINO_LOGGER_DEFAULTS=void 0,ki.PINO_LOGGER_DEFAULTS={level:"info"},ki.PINO_CUSTOM_CONTEXT_KEY="custom_context"),ki}var _r={},Pp;function k5(){if(Pp)return _r;Pp=1,Object.defineProperty(_r,"__esModule",{value:!0}),_r.generateChildLogger=_r.formatChildLoggerContext=_r.getLoggerContext=_r.setBrowserLoggerContext=_r.getBrowserLoggerContext=_r.getDefaultLoggerOptions=void 0;const r=Ap();function e(u){return Object.assign(Object.assign({},u),{level:u?.level||r.PINO_LOGGER_DEFAULTS.level})}_r.getDefaultLoggerOptions=e;function t(u,f=r.PINO_CUSTOM_CONTEXT_KEY){return u[f]||""}_r.getBrowserLoggerContext=t;function n(u,f,h=r.PINO_CUSTOM_CONTEXT_KEY){return u[h]=f,u}_r.setBrowserLoggerContext=n;function i(u,f=r.PINO_CUSTOM_CONTEXT_KEY){let h="";return typeof u.bindings>"u"?h=t(u,f):h=u.bindings().context||"",h}_r.getLoggerContext=i;function a(u,f,h=r.PINO_CUSTOM_CONTEXT_KEY){const m=i(u,h);return m.trim()?`${m}/${f}`:f}_r.formatChildLoggerContext=a;function c(u,f,h=r.PINO_CUSTOM_CONTEXT_KEY){const m=a(u,f,h),w=u.child({context:m});return n(w,m,h)}return _r.generateChildLogger=c,_r}(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.pino=void 0;const e=j5,t=e.__importDefault(B5());Object.defineProperty(r,"pino",{enumerable:!0,get:function(){return t.default}}),e.__exportStar(Ap(),r),e.__exportStar(k5(),r)})(Xe);class q5 extends Fi{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class z5 extends Fi{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class H5{constructor(e,t){this.logger=e,this.core=t}}class W5 extends Fi{constructor(e,t){super(),this.relayer=e,this.logger=t}}class K5 extends Fi{constructor(e){super()}}class V5{constructor(e,t,n,i){this.core=e,this.logger=t,this.name=n}}class G5 extends Fi{constructor(e,t){super(),this.relayer=e,this.logger=t}}class Y5 extends Fi{constructor(e,t){super(),this.core=e,this.logger=t}}class Z5{constructor(e,t){this.projectId=e,this.logger=t}}class J5{constructor(e,t){this.projectId=e,this.logger=t}}class Q5{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class X5{constructor(e){this.client=e}}var Cu={},Tp={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Me,t=qr;r.DIGEST_LENGTH=64,r.BLOCK_SIZE=128;var n=function(){function u(){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 u.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},u.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},u.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._tempHi),t.wipe(this._tempLo),this.reset()},u.prototype.update=function(f,h){if(h===void 0&&(h=f.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var m=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<r.BLOCK_SIZE&&h>0;)this._buffer[this._bufferLength++]=f[m++],h--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(m=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,f,m,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=f[m++],h--;return this},u.prototype.finish=function(f){if(!this._finished){var h=this._bytesHashed,m=this._bufferLength,w=h/536870912|0,y=h<<3,_=h%128<112?128:256;this._buffer[m]=128;for(var S=m+1;S<_-8;S++)this._buffer[S]=0;e.writeUint32BE(w,this._buffer,_-8),e.writeUint32BE(y,this._buffer,_-4),a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,_),this._finished=!0}for(var S=0;S<this.digestLength/8;S++)e.writeUint32BE(this._stateHi[S],f,S*8),e.writeUint32BE(this._stateLo[S],f,S*8+4);return this},u.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},u.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}},u.prototype.restoreState=function(f){return this._stateHi.set(f.stateHi),this._stateLo.set(f.stateLo),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},u.prototype.cleanSavedState=function(f){t.wipe(f.stateHi),t.wipe(f.stateLo),f.buffer&&t.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},u}();r.SHA512=n;var i=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(u,f,h,m,w,y,_){for(var S=h[0],P=h[1],j=h[2],U=h[3],A=h[4],T=h[5],O=h[6],$=h[7],x=m[0],d=m[1],b=m[2],H=m[3],F=m[4],V=m[5],se=m[6],ce=m[7],I,N,X,ee,Y,Z,Q,ie;_>=128;){for(var Ee=0;Ee<16;Ee++){var ae=8*Ee+y;u[Ee]=e.readUint32BE(w,ae),f[Ee]=e.readUint32BE(w,ae+4)}for(var Ee=0;Ee<80;Ee++){var xe=S,de=P,be=j,K=U,W=A,B=T,g=O,L=$,le=x,pe=d,Oe=b,Ke=H,Ze=F,ke=V,Ot=se,Ct=ce;if(I=$,N=ce,Y=N&65535,Z=N>>>16,Q=I&65535,ie=I>>>16,I=(A>>>14|F<<32-14)^(A>>>18|F<<32-18)^(F>>>41-32|A<<32-(41-32)),N=(F>>>14|A<<32-14)^(F>>>18|A<<32-18)^(A>>>41-32|F<<32-(41-32)),Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,I=A&T^~A&O,N=F&V^~F&se,Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,I=i[Ee*2],N=i[Ee*2+1],Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,I=u[Ee%16],N=f[Ee%16],Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,X=Q&65535|ie<<16,ee=Y&65535|Z<<16,I=X,N=ee,Y=N&65535,Z=N>>>16,Q=I&65535,ie=I>>>16,I=(S>>>28|x<<32-28)^(x>>>34-32|S<<32-(34-32))^(x>>>39-32|S<<32-(39-32)),N=(x>>>28|S<<32-28)^(S>>>34-32|x<<32-(34-32))^(S>>>39-32|x<<32-(39-32)),Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,I=S&P^S&j^P&j,N=x&d^x&b^d&b,Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,L=Q&65535|ie<<16,Ct=Y&65535|Z<<16,I=K,N=Ke,Y=N&65535,Z=N>>>16,Q=I&65535,ie=I>>>16,I=X,N=ee,Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,K=Q&65535|ie<<16,Ke=Y&65535|Z<<16,P=xe,j=de,U=be,A=K,T=W,O=B,$=g,S=L,d=le,b=pe,H=Oe,F=Ke,V=Ze,se=ke,ce=Ot,x=Ct,Ee%16===15)for(var ae=0;ae<16;ae++)I=u[ae],N=f[ae],Y=N&65535,Z=N>>>16,Q=I&65535,ie=I>>>16,I=u[(ae+9)%16],N=f[(ae+9)%16],Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,X=u[(ae+1)%16],ee=f[(ae+1)%16],I=(X>>>1|ee<<32-1)^(X>>>8|ee<<32-8)^X>>>7,N=(ee>>>1|X<<32-1)^(ee>>>8|X<<32-8)^(ee>>>7|X<<32-7),Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,X=u[(ae+14)%16],ee=f[(ae+14)%16],I=(X>>>19|ee<<32-19)^(ee>>>61-32|X<<32-(61-32))^X>>>6,N=(ee>>>19|X<<32-19)^(X>>>61-32|ee<<32-(61-32))^(ee>>>6|X<<32-6),Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,u[ae]=Q&65535|ie<<16,f[ae]=Y&65535|Z<<16}I=S,N=x,Y=N&65535,Z=N>>>16,Q=I&65535,ie=I>>>16,I=h[0],N=m[0],Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[0]=S=Q&65535|ie<<16,m[0]=x=Y&65535|Z<<16,I=P,N=d,Y=N&65535,Z=N>>>16,Q=I&65535,ie=I>>>16,I=h[1],N=m[1],Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[1]=P=Q&65535|ie<<16,m[1]=d=Y&65535|Z<<16,I=j,N=b,Y=N&65535,Z=N>>>16,Q=I&65535,ie=I>>>16,I=h[2],N=m[2],Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[2]=j=Q&65535|ie<<16,m[2]=b=Y&65535|Z<<16,I=U,N=H,Y=N&65535,Z=N>>>16,Q=I&65535,ie=I>>>16,I=h[3],N=m[3],Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[3]=U=Q&65535|ie<<16,m[3]=H=Y&65535|Z<<16,I=A,N=F,Y=N&65535,Z=N>>>16,Q=I&65535,ie=I>>>16,I=h[4],N=m[4],Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[4]=A=Q&65535|ie<<16,m[4]=F=Y&65535|Z<<16,I=T,N=V,Y=N&65535,Z=N>>>16,Q=I&65535,ie=I>>>16,I=h[5],N=m[5],Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[5]=T=Q&65535|ie<<16,m[5]=V=Y&65535|Z<<16,I=O,N=se,Y=N&65535,Z=N>>>16,Q=I&65535,ie=I>>>16,I=h[6],N=m[6],Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[6]=O=Q&65535|ie<<16,m[6]=se=Y&65535|Z<<16,I=$,N=ce,Y=N&65535,Z=N>>>16,Q=I&65535,ie=I>>>16,I=h[7],N=m[7],Y+=N&65535,Z+=N>>>16,Q+=I&65535,ie+=I>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[7]=$=Q&65535|ie<<16,m[7]=ce=Y&65535|Z<<16,y+=128,_-=128}return y}function c(u){var f=new n;f.update(u);var h=f.digest();return f.clean(),h}r.hash=c})(Tp),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=ys,t=Tp,n=qr;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function i(K){const W=new Float64Array(16);if(K)for(let B=0;B<K.length;B++)W[B]=K[B];return W}const a=new Uint8Array(32);a[0]=9;const c=i(),u=i([1]),f=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),m=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),w=i([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),y=i([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function _(K,W){for(let B=0;B<16;B++)K[B]=W[B]|0}function S(K){let W=1;for(let B=0;B<16;B++){let g=K[B]+W+65535;W=Math.floor(g/65536),K[B]=g-W*65536}K[0]+=W-1+37*(W-1)}function P(K,W,B){const g=~(B-1);for(let L=0;L<16;L++){const le=g&(K[L]^W[L]);K[L]^=le,W[L]^=le}}function j(K,W){const B=i(),g=i();for(let L=0;L<16;L++)g[L]=W[L];S(g),S(g),S(g);for(let L=0;L<2;L++){B[0]=g[0]-65517;for(let pe=1;pe<15;pe++)B[pe]=g[pe]-65535-(B[pe-1]>>16&1),B[pe-1]&=65535;B[15]=g[15]-32767-(B[14]>>16&1);const le=B[15]>>16&1;B[14]&=65535,P(g,B,1-le)}for(let L=0;L<16;L++)K[2*L]=g[L]&255,K[2*L+1]=g[L]>>8}function U(K,W){let B=0;for(let g=0;g<32;g++)B|=K[g]^W[g];return(1&B-1>>>8)-1}function A(K,W){const B=new Uint8Array(32),g=new Uint8Array(32);return j(B,K),j(g,W),U(B,g)}function T(K){const W=new Uint8Array(32);return j(W,K),W[0]&1}function O(K,W){for(let B=0;B<16;B++)K[B]=W[2*B]+(W[2*B+1]<<8);K[15]&=32767}function $(K,W,B){for(let g=0;g<16;g++)K[g]=W[g]+B[g]}function x(K,W,B){for(let g=0;g<16;g++)K[g]=W[g]-B[g]}function d(K,W,B){let g,L,le=0,pe=0,Oe=0,Ke=0,Ze=0,ke=0,Ot=0,Ct=0,ze=0,Ce=0,Ue=0,je=0,He=0,Ae=0,Fe=0,Se=0,Te=0,Ve=0,$e=0,Je=0,et=0,at=0,ct=0,nt=0,Dr=0,Mr=0,$n=0,Sr=0,Wn=0,bi=0,ns=0,Mt=B[0],$t=B[1],Ut=B[2],jt=B[3],Rt=B[4],At=B[5],Gt=B[6],Yt=B[7],Ft=B[8],Zt=B[9],Bt=B[10],Ht=B[11],kt=B[12],Et=B[13],Jt=B[14],Qt=B[15];g=W[0],le+=g*Mt,pe+=g*$t,Oe+=g*Ut,Ke+=g*jt,Ze+=g*Rt,ke+=g*At,Ot+=g*Gt,Ct+=g*Yt,ze+=g*Ft,Ce+=g*Zt,Ue+=g*Bt,je+=g*Ht,He+=g*kt,Ae+=g*Et,Fe+=g*Jt,Se+=g*Qt,g=W[1],pe+=g*Mt,Oe+=g*$t,Ke+=g*Ut,Ze+=g*jt,ke+=g*Rt,Ot+=g*At,Ct+=g*Gt,ze+=g*Yt,Ce+=g*Ft,Ue+=g*Zt,je+=g*Bt,He+=g*Ht,Ae+=g*kt,Fe+=g*Et,Se+=g*Jt,Te+=g*Qt,g=W[2],Oe+=g*Mt,Ke+=g*$t,Ze+=g*Ut,ke+=g*jt,Ot+=g*Rt,Ct+=g*At,ze+=g*Gt,Ce+=g*Yt,Ue+=g*Ft,je+=g*Zt,He+=g*Bt,Ae+=g*Ht,Fe+=g*kt,Se+=g*Et,Te+=g*Jt,Ve+=g*Qt,g=W[3],Ke+=g*Mt,Ze+=g*$t,ke+=g*Ut,Ot+=g*jt,Ct+=g*Rt,ze+=g*At,Ce+=g*Gt,Ue+=g*Yt,je+=g*Ft,He+=g*Zt,Ae+=g*Bt,Fe+=g*Ht,Se+=g*kt,Te+=g*Et,Ve+=g*Jt,$e+=g*Qt,g=W[4],Ze+=g*Mt,ke+=g*$t,Ot+=g*Ut,Ct+=g*jt,ze+=g*Rt,Ce+=g*At,Ue+=g*Gt,je+=g*Yt,He+=g*Ft,Ae+=g*Zt,Fe+=g*Bt,Se+=g*Ht,Te+=g*kt,Ve+=g*Et,$e+=g*Jt,Je+=g*Qt,g=W[5],ke+=g*Mt,Ot+=g*$t,Ct+=g*Ut,ze+=g*jt,Ce+=g*Rt,Ue+=g*At,je+=g*Gt,He+=g*Yt,Ae+=g*Ft,Fe+=g*Zt,Se+=g*Bt,Te+=g*Ht,Ve+=g*kt,$e+=g*Et,Je+=g*Jt,et+=g*Qt,g=W[6],Ot+=g*Mt,Ct+=g*$t,ze+=g*Ut,Ce+=g*jt,Ue+=g*Rt,je+=g*At,He+=g*Gt,Ae+=g*Yt,Fe+=g*Ft,Se+=g*Zt,Te+=g*Bt,Ve+=g*Ht,$e+=g*kt,Je+=g*Et,et+=g*Jt,at+=g*Qt,g=W[7],Ct+=g*Mt,ze+=g*$t,Ce+=g*Ut,Ue+=g*jt,je+=g*Rt,He+=g*At,Ae+=g*Gt,Fe+=g*Yt,Se+=g*Ft,Te+=g*Zt,Ve+=g*Bt,$e+=g*Ht,Je+=g*kt,et+=g*Et,at+=g*Jt,ct+=g*Qt,g=W[8],ze+=g*Mt,Ce+=g*$t,Ue+=g*Ut,je+=g*jt,He+=g*Rt,Ae+=g*At,Fe+=g*Gt,Se+=g*Yt,Te+=g*Ft,Ve+=g*Zt,$e+=g*Bt,Je+=g*Ht,et+=g*kt,at+=g*Et,ct+=g*Jt,nt+=g*Qt,g=W[9],Ce+=g*Mt,Ue+=g*$t,je+=g*Ut,He+=g*jt,Ae+=g*Rt,Fe+=g*At,Se+=g*Gt,Te+=g*Yt,Ve+=g*Ft,$e+=g*Zt,Je+=g*Bt,et+=g*Ht,at+=g*kt,ct+=g*Et,nt+=g*Jt,Dr+=g*Qt,g=W[10],Ue+=g*Mt,je+=g*$t,He+=g*Ut,Ae+=g*jt,Fe+=g*Rt,Se+=g*At,Te+=g*Gt,Ve+=g*Yt,$e+=g*Ft,Je+=g*Zt,et+=g*Bt,at+=g*Ht,ct+=g*kt,nt+=g*Et,Dr+=g*Jt,Mr+=g*Qt,g=W[11],je+=g*Mt,He+=g*$t,Ae+=g*Ut,Fe+=g*jt,Se+=g*Rt,Te+=g*At,Ve+=g*Gt,$e+=g*Yt,Je+=g*Ft,et+=g*Zt,at+=g*Bt,ct+=g*Ht,nt+=g*kt,Dr+=g*Et,Mr+=g*Jt,$n+=g*Qt,g=W[12],He+=g*Mt,Ae+=g*$t,Fe+=g*Ut,Se+=g*jt,Te+=g*Rt,Ve+=g*At,$e+=g*Gt,Je+=g*Yt,et+=g*Ft,at+=g*Zt,ct+=g*Bt,nt+=g*Ht,Dr+=g*kt,Mr+=g*Et,$n+=g*Jt,Sr+=g*Qt,g=W[13],Ae+=g*Mt,Fe+=g*$t,Se+=g*Ut,Te+=g*jt,Ve+=g*Rt,$e+=g*At,Je+=g*Gt,et+=g*Yt,at+=g*Ft,ct+=g*Zt,nt+=g*Bt,Dr+=g*Ht,Mr+=g*kt,$n+=g*Et,Sr+=g*Jt,Wn+=g*Qt,g=W[14],Fe+=g*Mt,Se+=g*$t,Te+=g*Ut,Ve+=g*jt,$e+=g*Rt,Je+=g*At,et+=g*Gt,at+=g*Yt,ct+=g*Ft,nt+=g*Zt,Dr+=g*Bt,Mr+=g*Ht,$n+=g*kt,Sr+=g*Et,Wn+=g*Jt,bi+=g*Qt,g=W[15],Se+=g*Mt,Te+=g*$t,Ve+=g*Ut,$e+=g*jt,Je+=g*Rt,et+=g*At,at+=g*Gt,ct+=g*Yt,nt+=g*Ft,Dr+=g*Zt,Mr+=g*Bt,$n+=g*Ht,Sr+=g*kt,Wn+=g*Et,bi+=g*Jt,ns+=g*Qt,le+=38*Te,pe+=38*Ve,Oe+=38*$e,Ke+=38*Je,Ze+=38*et,ke+=38*at,Ot+=38*ct,Ct+=38*nt,ze+=38*Dr,Ce+=38*Mr,Ue+=38*$n,je+=38*Sr,He+=38*Wn,Ae+=38*bi,Fe+=38*ns,L=1,g=le+L+65535,L=Math.floor(g/65536),le=g-L*65536,g=pe+L+65535,L=Math.floor(g/65536),pe=g-L*65536,g=Oe+L+65535,L=Math.floor(g/65536),Oe=g-L*65536,g=Ke+L+65535,L=Math.floor(g/65536),Ke=g-L*65536,g=Ze+L+65535,L=Math.floor(g/65536),Ze=g-L*65536,g=ke+L+65535,L=Math.floor(g/65536),ke=g-L*65536,g=Ot+L+65535,L=Math.floor(g/65536),Ot=g-L*65536,g=Ct+L+65535,L=Math.floor(g/65536),Ct=g-L*65536,g=ze+L+65535,L=Math.floor(g/65536),ze=g-L*65536,g=Ce+L+65535,L=Math.floor(g/65536),Ce=g-L*65536,g=Ue+L+65535,L=Math.floor(g/65536),Ue=g-L*65536,g=je+L+65535,L=Math.floor(g/65536),je=g-L*65536,g=He+L+65535,L=Math.floor(g/65536),He=g-L*65536,g=Ae+L+65535,L=Math.floor(g/65536),Ae=g-L*65536,g=Fe+L+65535,L=Math.floor(g/65536),Fe=g-L*65536,g=Se+L+65535,L=Math.floor(g/65536),Se=g-L*65536,le+=L-1+37*(L-1),L=1,g=le+L+65535,L=Math.floor(g/65536),le=g-L*65536,g=pe+L+65535,L=Math.floor(g/65536),pe=g-L*65536,g=Oe+L+65535,L=Math.floor(g/65536),Oe=g-L*65536,g=Ke+L+65535,L=Math.floor(g/65536),Ke=g-L*65536,g=Ze+L+65535,L=Math.floor(g/65536),Ze=g-L*65536,g=ke+L+65535,L=Math.floor(g/65536),ke=g-L*65536,g=Ot+L+65535,L=Math.floor(g/65536),Ot=g-L*65536,g=Ct+L+65535,L=Math.floor(g/65536),Ct=g-L*65536,g=ze+L+65535,L=Math.floor(g/65536),ze=g-L*65536,g=Ce+L+65535,L=Math.floor(g/65536),Ce=g-L*65536,g=Ue+L+65535,L=Math.floor(g/65536),Ue=g-L*65536,g=je+L+65535,L=Math.floor(g/65536),je=g-L*65536,g=He+L+65535,L=Math.floor(g/65536),He=g-L*65536,g=Ae+L+65535,L=Math.floor(g/65536),Ae=g-L*65536,g=Fe+L+65535,L=Math.floor(g/65536),Fe=g-L*65536,g=Se+L+65535,L=Math.floor(g/65536),Se=g-L*65536,le+=L-1+37*(L-1),K[0]=le,K[1]=pe,K[2]=Oe,K[3]=Ke,K[4]=Ze,K[5]=ke,K[6]=Ot,K[7]=Ct,K[8]=ze,K[9]=Ce,K[10]=Ue,K[11]=je,K[12]=He,K[13]=Ae,K[14]=Fe,K[15]=Se}function b(K,W){d(K,W,W)}function H(K,W){const B=i();let g;for(g=0;g<16;g++)B[g]=W[g];for(g=253;g>=0;g--)b(B,B),g!==2&&g!==4&&d(B,B,W);for(g=0;g<16;g++)K[g]=B[g]}function F(K,W){const B=i();let g;for(g=0;g<16;g++)B[g]=W[g];for(g=250;g>=0;g--)b(B,B),g!==1&&d(B,B,W);for(g=0;g<16;g++)K[g]=B[g]}function V(K,W){const B=i(),g=i(),L=i(),le=i(),pe=i(),Oe=i(),Ke=i(),Ze=i(),ke=i();x(B,K[1],K[0]),x(ke,W[1],W[0]),d(B,B,ke),$(g,K[0],K[1]),$(ke,W[0],W[1]),d(g,g,ke),d(L,K[3],W[3]),d(L,L,h),d(le,K[2],W[2]),$(le,le,le),x(pe,g,B),x(Oe,le,L),$(Ke,le,L),$(Ze,g,B),d(K[0],pe,Oe),d(K[1],Ze,Ke),d(K[2],Ke,Oe),d(K[3],pe,Ze)}function se(K,W,B){for(let g=0;g<4;g++)P(K[g],W[g],B)}function ce(K,W){const B=i(),g=i(),L=i();H(L,W[2]),d(B,W[0],L),d(g,W[1],L),j(K,g),K[31]^=T(B)<<7}function I(K,W,B){_(K[0],c),_(K[1],u),_(K[2],u),_(K[3],c);for(let g=255;g>=0;--g){const L=B[g/8|0]>>(g&7)&1;se(K,W,L),V(W,K),V(K,K),se(K,W,L)}}function N(K,W){const B=[i(),i(),i(),i()];_(B[0],m),_(B[1],w),_(B[2],u),d(B[3],m,w),I(K,B,W)}function X(K){if(K.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const W=(0,t.hash)(K);W[0]&=248,W[31]&=127,W[31]|=64;const B=new Uint8Array(32),g=[i(),i(),i(),i()];N(g,W),ce(B,g);const L=new Uint8Array(64);return L.set(K),L.set(B,32),{publicKey:B,secretKey:L}}r.generateKeyPairFromSeed=X;function ee(K){const W=(0,e.randomBytes)(32,K),B=X(W);return(0,n.wipe)(W),B}r.generateKeyPair=ee;function Y(K){if(K.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(K.subarray(32))}r.extractPublicKeyFromSecretKey=Y;const Z=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 Q(K,W){let B,g,L,le;for(g=63;g>=32;--g){for(B=0,L=g-32,le=g-12;L<le;++L)W[L]+=B-16*W[g]*Z[L-(g-32)],B=Math.floor((W[L]+128)/256),W[L]-=B*256;W[L]+=B,W[g]=0}for(B=0,L=0;L<32;L++)W[L]+=B-(W[31]>>4)*Z[L],B=W[L]>>8,W[L]&=255;for(L=0;L<32;L++)W[L]-=B*Z[L];for(g=0;g<32;g++)W[g+1]+=W[g]>>8,K[g]=W[g]&255}function ie(K){const W=new Float64Array(64);for(let B=0;B<64;B++)W[B]=K[B];for(let B=0;B<64;B++)K[B]=0;Q(K,W)}function Ee(K,W){const B=new Float64Array(64),g=[i(),i(),i(),i()],L=(0,t.hash)(K.subarray(0,32));L[0]&=248,L[31]&=127,L[31]|=64;const le=new Uint8Array(64);le.set(L.subarray(32),32);const pe=new t.SHA512;pe.update(le.subarray(32)),pe.update(W);const Oe=pe.digest();pe.clean(),ie(Oe),N(g,Oe),ce(le,g),pe.reset(),pe.update(le.subarray(0,32)),pe.update(K.subarray(32)),pe.update(W);const Ke=pe.digest();ie(Ke);for(let Ze=0;Ze<32;Ze++)B[Ze]=Oe[Ze];for(let Ze=0;Ze<32;Ze++)for(let ke=0;ke<32;ke++)B[Ze+ke]+=Ke[Ze]*L[ke];return Q(le.subarray(32),B),le}r.sign=Ee;function ae(K,W){const B=i(),g=i(),L=i(),le=i(),pe=i(),Oe=i(),Ke=i();return _(K[2],u),O(K[1],W),b(L,K[1]),d(le,L,f),x(L,L,K[2]),$(le,K[2],le),b(pe,le),b(Oe,pe),d(Ke,Oe,pe),d(B,Ke,L),d(B,B,le),F(B,B),d(B,B,L),d(B,B,le),d(B,B,le),d(K[0],B,le),b(g,K[0]),d(g,g,le),A(g,L)&&d(K[0],K[0],y),b(g,K[0]),d(g,g,le),A(g,L)?-1:(T(K[0])===W[31]>>7&&x(K[0],c,K[0]),d(K[3],K[0],K[1]),0)}function xe(K,W,B){const g=new Uint8Array(32),L=[i(),i(),i(),i()],le=[i(),i(),i(),i()];if(B.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if(ae(le,K))return!1;const pe=new t.SHA512;pe.update(B.subarray(0,32)),pe.update(K),pe.update(W);const Oe=pe.digest();return ie(Oe),I(L,le,Oe),N(le,B.subarray(32)),V(L,le),ce(g,L),!U(B,g)}r.verify=xe;function de(K){let W=[i(),i(),i(),i()];if(ae(W,K))throw new Error("Ed25519: invalid public key");let B=i(),g=i(),L=W[1];$(B,u,L),x(g,u,L),H(g,g),d(B,B,g);let le=new Uint8Array(32);return j(le,B),le}r.convertPublicKeyToX25519=de;function be(K){const W=(0,t.hash)(K.subarray(0,32));W[0]&=248,W[31]&=127,W[31]|=64;const B=new Uint8Array(W.subarray(0,32));return(0,n.wipe)(W),B}r.convertSecretKeyToX25519=be}(Cu);const eE="EdDSA",tE="JWT",Rp=".",Np="base64url",rE="utf8",nE="utf8",iE=":",sE="did",oE="key",Lp="base58btc",aE="z",cE="K36",lE=32;function Wa(r){return yr(Pr(ji(r),rE),Np)}function Mp(r){const e=Pr(cE,Lp),t=aE+yr(zl([e,r]),Lp);return[sE,oE,t].join(iE)}function uE(r){return yr(r,Np)}function hE(r){return Pr([Wa(r.header),Wa(r.payload)].join(Rp),nE)}function fE(r){return[Wa(r.header),Wa(r.payload),uE(r.signature)].join(Rp)}function Up(r=ys.randomBytes(lE)){return Cu.generateKeyPairFromSeed(r)}async function dE(r,e,t,n,i=me.fromMiliseconds(Date.now())){const a={alg:eE,typ:tE},c=Mp(n.publicKey),u=i+t,f={iss:c,sub:r,aud:e,iat:i,exp:u},h=hE({header:a,payload:f}),m=Cu.sign(n.secretKey,h);return fE({header:a,payload:f,signature:m})}const pE="PARSE_ERROR",gE="INVALID_REQUEST",mE="METHOD_NOT_FOUND",vE="INVALID_PARAMS",jp="INTERNAL_ERROR",$u="SERVER_ERROR",yE=[-32700,-32600,-32601,-32602,-32603],Lo={[pE]:{code:-32700,message:"Parse error"},[gE]:{code:-32600,message:"Invalid Request"},[mE]:{code:-32601,message:"Method not found"},[vE]:{code:-32602,message:"Invalid params"},[jp]:{code:-32603,message:"Internal error"},[$u]:{code:-32e3,message:"Server error"}},Fp=$u;function wE(r){return yE.includes(r)}function Bp(r){return Object.keys(Lo).includes(r)?Lo[r]:Lo[Fp]}function bE(r){const e=Object.values(Lo).find(t=>t.code===r);return e||Lo[Fp]}function kp(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var qp={};/*! *****************************************************************************
56
+ ***************************************************************************** */var Xf=function(t,e){return Xf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Xf(t,e)};function jx(t,e){Xf(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var e0=function(){return e0=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},e0.apply(this,arguments)};function kx(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function qx(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(s=(i<3?c(s):i>3?c(e,r,s):c(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function zx(t,e){return function(r,n){e(r,n,t)}}function Hx(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Kx(t,e,r,n){function i(s){return s instanceof r?s:new r(function(c){c(s)})}return new(r||(r=Promise))(function(s,c){function l(m){try{h(n.next(m))}catch(_){c(_)}}function f(m){try{h(n.throw(m))}catch(_){c(_)}}function h(m){m.done?s(m.value):i(m.value).then(l,f)}h((n=n.apply(t,e||[])).next())})}function Wx(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=h[0]&2?i.return:h[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,h[1])).done)return s;switch(i=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){r.label=h[1];break}if(h[0]===6&&r.label<s[1]){r.label=s[1],s=h;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(h);break}s[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(m){h=[6,m],i=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function Vx(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Gx(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function t0(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function vv(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(l){c={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return s}function Yx(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(vv(arguments[e]));return t}function Jx(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],c=0,l=s.length;c<l;c++,i++)n[i]=s[c];return n}function vc(t){return this instanceof vc?(this.v=t,this):new vc(t)}function Qx(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(E){n[E]&&(i[E]=function(A){return new Promise(function(I,R){s.push([E,A,I,R])>1||l(E,A)})})}function l(E,A){try{f(n[E](A))}catch(I){_(s[0][3],I)}}function f(E){E.value instanceof vc?Promise.resolve(E.value.v).then(h,m):_(s[0][2],E)}function h(E){l("next",E)}function m(E){l("throw",E)}function _(E,A){E(A),s.shift(),s.length&&l(s[0][0],s[0][1])}}function Zx(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(c){return(r=!r)?{value:vc(t[i](c)),done:i==="return"}:s?s(c):c}:s}}function Xx(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof t0=="function"?t0(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(c){return new Promise(function(l,f){c=t[s](c),i(l,f,c.done,c.value)})}}function i(s,c,l,f){Promise.resolve(f).then(function(h){s({value:h,done:l})},c)}}function eS(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function tS(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function rS(t){return t&&t.__esModule?t:{default:t}}function nS(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function iS(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var sS=Object.freeze({__proto__:null,__extends:jx,get __assign(){return e0},__rest:kx,__decorate:qx,__param:zx,__metadata:Hx,__awaiter:Kx,__generator:Wx,__createBinding:Vx,__exportStar:Gx,__values:t0,__read:vv,__spread:Yx,__spreadArrays:Jx,__await:vc,__asyncGenerator:Qx,__asyncDelegator:Zx,__asyncValues:Xx,__makeTemplateObject:eS,__importStar:tS,__importDefault:rS,__classPrivateFieldGet:nS,__classPrivateFieldSet:iS}),oS=Us(sS),Fi={},yv;function aS(){if(yv)return Fi;yv=1,Object.defineProperty(Fi,"__esModule",{value:!0}),Fi.isBrowserCryptoAvailable=Fi.getSubtleCrypto=Fi.getBrowerCrypto=void 0;function t(){return Jn?.crypto||Jn?.msCrypto||{}}Fi.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Fi.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Fi.isBrowserCryptoAvailable=r,Fi}var ji={},wv;function cS(){if(wv)return ji;wv=1,Object.defineProperty(ji,"__esModule",{value:!0}),ji.isBrowser=ji.isNode=ji.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}ji.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}ji.isNode=e;function r(){return!t()&&!e()}return ji.isBrowser=r,ji}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=oS;e.__exportStar(aS(),t),e.__exportStar(cS(),t)})(mv);function us(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function Qs(t=6){return BigInt(us(t))}function ta(t,e,r){return{id:r||us(),jsonrpc:"2.0",method:t,params:e}}function Vl(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Gl(t,e,r){return{id:t,jsonrpc:"2.0",error:lS(e,r)}}function lS(t,e){return typeof t>"u"?pv(fv):(typeof t=="string"&&(t=Object.assign(Object.assign({},pv(Zf)),{message:t})),typeof e<"u"&&(t.data=e),Ux(t.code)&&(t=Fx(t.code)),t)}class uS{}class hS extends uS{constructor(){super()}}class fS extends hS{constructor(e){super()}}const dS="^https?:",pS="^wss?:";function gS(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function bv(t,e){const r=gS(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function _v(t){return bv(t,dS)}function Ev(t){return bv(t,pS)}function mS(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function Av(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function r0(t){return Av(t)&&"method"in t}function Yl(t){return Av(t)&&(bi(t)||Tn(t))}function bi(t){return"result"in t}function Tn(t){return"error"in t}class ki extends fS{constructor(e){super(e),this.events=new Dr.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,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(ta(e.method,e.params||[],e.id||Qs().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Tn(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Yl(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 vS=()=>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"),yS=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",xv=t=>t.split("?")[0],Sv=10,wS=vS();class bS{constructor(e){if(this.url=e,this.events=new Dr.exports.EventEmitter,this.registering=!1,!Ev(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,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Ui(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!Ev(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{const i=new URLSearchParams(e).get("origin"),s=mv.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!mS(e)},c=new wS(e,[],s);yS()?c.onerror=l=>{const f=l;n(this.emitError(f.error))}:c.on("error",l=>{n(this.emitError(l))}),c.onopen=()=>{this.onOpen(c),r(c)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),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 r=typeof e.data=="string"?hc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gl(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return gv(e,xv(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>Sv&&this.events.setMaxListeners(Sv)}emitError(e){const r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${xv(this.url)}`));return this.events.emit("register_error",r),r}}var n0={exports:{}};(function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,c=9007199254740991,l="[object Arguments]",f="[object Array]",h="[object AsyncFunction]",m="[object Boolean]",_="[object Date]",E="[object Error]",A="[object Function]",I="[object GeneratorFunction]",R="[object Map]",W="[object Number]",Y="[object Null]",F="[object Object]",z="[object Promise]",$="[object Proxy]",j="[object RegExp]",P="[object Set]",g="[object String]",C="[object Symbol]",Z="[object Undefined]",J="[object WeakMap]",te="[object ArrayBuffer]",ae="[object DataView]",p="[object Float32Array]",d="[object Float64Array]",b="[object Int8Array]",D="[object Int16Array]",M="[object Int32Array]",N="[object Uint8Array]",U="[object Uint8ClampedArray]",O="[object Uint16Array]",v="[object Uint32Array]",L=/[\\^$.*+?()[\]{}|]/g,oe=/^\[object .+?Constructor\]$/,de=/^(?:0|[1-9]\d*)$/,x={};x[p]=x[d]=x[b]=x[D]=x[M]=x[N]=x[U]=x[O]=x[v]=!0,x[l]=x[f]=x[te]=x[m]=x[ae]=x[_]=x[E]=x[A]=x[R]=x[W]=x[F]=x[j]=x[P]=x[g]=x[J]=!1;var ne=typeof Jn=="object"&&Jn&&Jn.Object===Object&&Jn,q=typeof self=="object"&&self&&self.Object===Object&&self,H=ne||q||Function("return this")(),V=e&&!e.nodeType&&e,y=V&&!0&&t&&!t.nodeType&&t,k=y&&y.exports===V,ie=k&&ne.process,fe=function(){try{return ie&&ie.binding&&ie.binding("util")}catch{}}(),ue=fe&&fe.isTypedArray;function Oe(K,X){for(var pe=-1,Se=K==null?0:K.length,Vt=0,ot=[];++pe<Se;){var Zt=K[pe];X(Zt,pe,K)&&(ot[Vt++]=Zt)}return ot}function Me(K,X){for(var pe=-1,Se=X.length,Vt=K.length;++pe<Se;)K[Vt+pe]=X[pe];return K}function Ie(K,X){for(var pe=-1,Se=K==null?0:K.length;++pe<Se;)if(X(K[pe],pe,K))return!0;return!1}function Pt(K,X){for(var pe=-1,Se=Array(K);++pe<K;)Se[pe]=X(pe);return Se}function ze(K){return function(X){return K(X)}}function Ce(K,X){return K.has(X)}function Fe(K,X){return K?.[X]}function Ee(K){var X=-1,pe=Array(K.size);return K.forEach(function(Se,Vt){pe[++X]=[Vt,Se]}),pe}function Ae(K,X){return function(pe){return K(X(pe))}}function Ge(K){var X=-1,pe=Array(K.size);return K.forEach(function(Se){pe[++X]=Se}),pe}var we=Array.prototype,xe=Function.prototype,Be=Object.prototype,be=H["__core-js_shared__"],Pe=xe.toString,je=Be.hasOwnProperty,Te=function(){var K=/[^.]+$/.exec(be&&be.keys&&be.keys.IE_PROTO||"");return K?"Symbol(src)_1."+K:""}(),$e=Be.toString,lt=RegExp("^"+Pe.call(je).replace(L,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Re=k?H.Buffer:void 0,Ne=H.Symbol,nr=H.Uint8Array,dt=Be.propertyIsEnumerable,Et=we.splice,ir=Ne?Ne.toStringTag:void 0,St=Object.getOwnPropertySymbols,Ot=Re?Re.isBuffer:void 0,Vr=Ae(Object.keys,Object),Ye=_n(H,"DataView"),He=_n(H,"Map"),Rt=_n(H,"Promise"),Je=_n(H,"Set"),Ve=_n(H,"WeakMap"),Mt=_n(Object,"create"),Xe=Vi(Ye),et=Vi(He),Lt=Vi(Rt),tt=Vi(Je),Qe=Vi(Ve),Ft=Ne?Ne.prototype:void 0,Ze=Ft?Ft.valueOf:void 0;function ke(K){var X=-1,pe=K==null?0:K.length;for(this.clear();++X<pe;){var Se=K[X];this.set(Se[0],Se[1])}}function Ht(){this.__data__=Mt?Mt(null):{},this.size=0}function rt(K){var X=this.has(K)&&delete this.__data__[K];return this.size-=X?1:0,X}function jt(K){var X=this.__data__;if(Mt){var pe=X[K];return pe===n?void 0:pe}return je.call(X,K)?X[K]:void 0}function ri(K){var X=this.__data__;return Mt?X[K]!==void 0:je.call(X,K)}function kt(K,X){var pe=this.__data__;return this.size+=this.has(K)?0:1,pe[K]=Mt&&X===void 0?n:X,this}ke.prototype.clear=Ht,ke.prototype.delete=rt,ke.prototype.get=jt,ke.prototype.has=ri,ke.prototype.set=kt;function vt(K){var X=-1,pe=K==null?0:K.length;for(this.clear();++X<pe;){var Se=K[X];this.set(Se[0],Se[1])}}function Bn(){this.__data__=[],this.size=0}function Un(K){var X=this.__data__,pe=Ao(X,K);if(pe<0)return!1;var Se=X.length-1;return pe==Se?X.pop():Et.call(X,pe,1),--this.size,!0}function Fn(K){var X=this.__data__,pe=Ao(X,K);return pe<0?void 0:X[pe][1]}function jn(K){return Ao(this.__data__,K)>-1}function kn(K,X){var pe=this.__data__,Se=Ao(pe,K);return Se<0?(++this.size,pe.push([K,X])):pe[Se][1]=X,this}vt.prototype.clear=Bn,vt.prototype.delete=Un,vt.prototype.get=Fn,vt.prototype.has=jn,vt.prototype.set=kn;function xr(K){var X=-1,pe=K==null?0:K.length;for(this.clear();++X<pe;){var Se=K[X];this.set(Se[0],Se[1])}}function Ii(){this.size=0,this.__data__={hash:new ke,map:new(He||vt),string:new ke}}function mo(K){var X=Cs(this,K).delete(K);return this.size-=X?1:0,X}function Di(K){return Cs(this,K).get(K)}function vo(K){return Cs(this,K).has(K)}function yo(K,X){var pe=Cs(this,K),Se=pe.size;return pe.set(K,X),this.size+=pe.size==Se?0:1,this}xr.prototype.clear=Ii,xr.prototype.delete=mo,xr.prototype.get=Di,xr.prototype.has=vo,xr.prototype.set=yo;function Ci(K){var X=-1,pe=K==null?0:K.length;for(this.__data__=new xr;++X<pe;)this.add(K[X])}function Is(K){return this.__data__.set(K,n),this}function Ds(K){return this.__data__.has(K)}Ci.prototype.add=Ci.prototype.push=Is,Ci.prototype.has=Ds;function Gr(K){var X=this.__data__=new vt(K);this.size=X.size}function wo(){this.__data__=new vt,this.size=0}function bo(K){var X=this.__data__,pe=X.delete(K);return this.size=X.size,pe}function _o(K){return this.__data__.get(K)}function Eo(K){return this.__data__.has(K)}function Tu(K,X){var pe=this.__data__;if(pe instanceof vt){var Se=pe.__data__;if(!He||Se.length<r-1)return Se.push([K,X]),this.size=++pe.size,this;pe=this.__data__=new xr(Se)}return pe.set(K,X),this.size=pe.size,this}Gr.prototype.clear=wo,Gr.prototype.delete=bo,Gr.prototype.get=_o,Gr.prototype.has=Eo,Gr.prototype.set=Tu;function $u(K,X){var pe=Ia(K),Se=!pe&&Ku(K),Vt=!pe&&!Se&&Hc(K),ot=!pe&&!Se&&!Vt&&Gu(K),Zt=pe||Se||Vt||ot,gr=Zt?Pt(K.length,String):[],It=gr.length;for(var Gt in K)(X||je.call(K,Gt))&&!(Zt&&(Gt=="length"||Vt&&(Gt=="offset"||Gt=="parent")||ot&&(Gt=="buffer"||Gt=="byteLength"||Gt=="byteOffset")||ju(Gt,It)))&&gr.push(Gt);return gr}function Ao(K,X){for(var pe=K.length;pe--;)if(Hu(K[pe][0],X))return pe;return-1}function qc(K,X,pe){var Se=X(K);return Ia(K)?Se:Me(Se,pe(K))}function xo(K){return K==null?K===void 0?Z:Y:ir&&ir in Object(K)?Uu(K):Ud(K)}function zc(K){return Io(K)&&xo(K)==l}function So(K,X,pe,Se,Vt){return K===X?!0:K==null||X==null||!Io(K)&&!Io(X)?K!==K&&X!==X:Nu(K,X,pe,Se,So,Vt)}function Nu(K,X,pe,Se,Vt,ot){var Zt=Ia(K),gr=Ia(X),It=Zt?f:Oi(K),Gt=gr?f:Oi(X);It=It==l?F:It,Gt=Gt==l?F:Gt;var fr=It==F,an=Gt==F,mr=It==Gt;if(mr&&Hc(K)){if(!Hc(X))return!1;Zt=!0,fr=!1}if(mr&&!fr)return ot||(ot=new Gr),Zt||Gu(K)?xa(K,X,pe,Se,Vt,ot):Bd(K,X,It,pe,Se,Vt,ot);if(!(pe&i)){var Xt=fr&&je.call(K,"__wrapped__"),Yr=an&&je.call(X,"__wrapped__");if(Xt||Yr){var ni=Xt?K.value():K,qn=Yr?X.value():X;return ot||(ot=new Gr),Vt(ni,qn,pe,Se,ot)}}return mr?(ot||(ot=new Gr),Bu(K,X,pe,Se,Vt,ot)):!1}function Ld(K){if(!Vu(K)||qu(K))return!1;var X=Da(K)?lt:oe;return X.test(Vi(K))}function Ru(K){return Io(K)&&Wu(K.length)&&!!x[xo(K)]}function Lu(K){if(!zu(K))return Vr(K);var X=[];for(var pe in Object(K))je.call(K,pe)&&pe!="constructor"&&X.push(pe);return X}function xa(K,X,pe,Se,Vt,ot){var Zt=pe&i,gr=K.length,It=X.length;if(gr!=It&&!(Zt&&It>gr))return!1;var Gt=ot.get(K);if(Gt&&ot.get(X))return Gt==X;var fr=-1,an=!0,mr=pe&s?new Ci:void 0;for(ot.set(K,X),ot.set(X,K);++fr<gr;){var Xt=K[fr],Yr=X[fr];if(Se)var ni=Zt?Se(Yr,Xt,fr,X,K,ot):Se(Xt,Yr,fr,K,X,ot);if(ni!==void 0){if(ni)continue;an=!1;break}if(mr){if(!Ie(X,function(qn,Pi){if(!Ce(mr,Pi)&&(Xt===qn||Vt(Xt,qn,pe,Se,ot)))return mr.push(Pi)})){an=!1;break}}else if(!(Xt===Yr||Vt(Xt,Yr,pe,Se,ot))){an=!1;break}}return ot.delete(K),ot.delete(X),an}function Bd(K,X,pe,Se,Vt,ot,Zt){switch(pe){case ae:if(K.byteLength!=X.byteLength||K.byteOffset!=X.byteOffset)return!1;K=K.buffer,X=X.buffer;case te:return!(K.byteLength!=X.byteLength||!ot(new nr(K),new nr(X)));case m:case _:case W:return Hu(+K,+X);case E:return K.name==X.name&&K.message==X.message;case j:case g:return K==X+"";case R:var gr=Ee;case P:var It=Se&i;if(gr||(gr=Ge),K.size!=X.size&&!It)return!1;var Gt=Zt.get(K);if(Gt)return Gt==X;Se|=s,Zt.set(K,X);var fr=xa(gr(K),gr(X),Se,Vt,ot,Zt);return Zt.delete(K),fr;case C:if(Ze)return Ze.call(K)==Ze.call(X)}return!1}function Bu(K,X,pe,Se,Vt,ot){var Zt=pe&i,gr=Sa(K),It=gr.length,Gt=Sa(X),fr=Gt.length;if(It!=fr&&!Zt)return!1;for(var an=It;an--;){var mr=gr[an];if(!(Zt?mr in X:je.call(X,mr)))return!1}var Xt=ot.get(K);if(Xt&&ot.get(X))return Xt==X;var Yr=!0;ot.set(K,X),ot.set(X,K);for(var ni=Zt;++an<It;){mr=gr[an];var qn=K[mr],Pi=X[mr];if(Se)var Kc=Zt?Se(Pi,qn,mr,X,K,ot):Se(qn,Pi,mr,K,X,ot);if(!(Kc===void 0?qn===Pi||Vt(qn,Pi,pe,Se,ot):Kc)){Yr=!1;break}ni||(ni=mr=="constructor")}if(Yr&&!ni){var Do=K.constructor,Sr=X.constructor;Do!=Sr&&"constructor"in K&&"constructor"in X&&!(typeof Do=="function"&&Do instanceof Do&&typeof Sr=="function"&&Sr instanceof Sr)&&(Yr=!1)}return ot.delete(K),ot.delete(X),Yr}function Sa(K){return qc(K,kd,Fu)}function Cs(K,X){var pe=K.__data__;return ku(X)?pe[typeof X=="string"?"string":"hash"]:pe.map}function _n(K,X){var pe=Fe(K,X);return Ld(pe)?pe:void 0}function Uu(K){var X=je.call(K,ir),pe=K[ir];try{K[ir]=void 0;var Se=!0}catch{}var Vt=$e.call(K);return Se&&(X?K[ir]=pe:delete K[ir]),Vt}var Fu=St?function(K){return K==null?[]:(K=Object(K),Oe(St(K),function(X){return dt.call(K,X)}))}:Wt,Oi=xo;(Ye&&Oi(new Ye(new ArrayBuffer(1)))!=ae||He&&Oi(new He)!=R||Rt&&Oi(Rt.resolve())!=z||Je&&Oi(new Je)!=P||Ve&&Oi(new Ve)!=J)&&(Oi=function(K){var X=xo(K),pe=X==F?K.constructor:void 0,Se=pe?Vi(pe):"";if(Se)switch(Se){case Xe:return ae;case et:return R;case Lt:return z;case tt:return P;case Qe:return J}return X});function ju(K,X){return X=X??c,!!X&&(typeof K=="number"||de.test(K))&&K>-1&&K%1==0&&K<X}function ku(K){var X=typeof K;return X=="string"||X=="number"||X=="symbol"||X=="boolean"?K!=="__proto__":K===null}function qu(K){return!!Te&&Te in K}function zu(K){var X=K&&K.constructor,pe=typeof X=="function"&&X.prototype||Be;return K===pe}function Ud(K){return $e.call(K)}function Vi(K){if(K!=null){try{return Pe.call(K)}catch{}try{return K+""}catch{}}return""}function Hu(K,X){return K===X||K!==K&&X!==X}var Ku=zc(function(){return arguments}())?zc:function(K){return Io(K)&&je.call(K,"callee")&&!dt.call(K,"callee")},Ia=Array.isArray;function Fd(K){return K!=null&&Wu(K.length)&&!Da(K)}var Hc=Ot||Kt;function jd(K,X){return So(K,X)}function Da(K){if(!Vu(K))return!1;var X=xo(K);return X==A||X==I||X==h||X==$}function Wu(K){return typeof K=="number"&&K>-1&&K%1==0&&K<=c}function Vu(K){var X=typeof K;return K!=null&&(X=="object"||X=="function")}function Io(K){return K!=null&&typeof K=="object"}var Gu=ue?ze(ue):Ru;function kd(K){return Fd(K)?$u(K):Lu(K)}function Wt(){return[]}function Kt(){return!1}t.exports=jd})(n0,n0.exports);var _S=n0.exports;function ES(t,e){return e=e||{},new Promise(function(r,n){var i=new XMLHttpRequest,s=[],c=[],l={},f=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:f,headers:{keys:function(){return s},entries:function(){return c},get:function(m){return l[m.toLowerCase()]},has:function(m){return m.toLowerCase()in l}}}};for(var h in i.open(e.method||"get",t,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(m,_,E){s.push(_=_.toLowerCase()),c.push([_,E]),l[_]=l[_]?l[_]+","+E:E}),r(f())},i.onerror=n,i.withCredentials=e.credentials=="include",e.headers)i.setRequestHeader(h,e.headers[h]);i.send(e.body||null)})}var AS=Object.freeze({__proto__:null,default:ES}),Iv=Us(AS),xS=self.fetch||(self.fetch=Iv.default||Iv),SS=Object.defineProperty,Dv=Object.getOwnPropertySymbols,IS=Object.prototype.hasOwnProperty,DS=Object.prototype.propertyIsEnumerable,Cv=(t,e,r)=>e in t?SS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hr=(t,e)=>{for(var r in e||(e={}))IS.call(e,r)&&Cv(t,r,e[r]);if(Dv)for(var r of Dv(e))DS.call(e,r)&&Cv(t,r,e[r]);return t};function CS(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),c=s.charCodeAt(0);if(r[c]!==255)throw new TypeError(s+" is ambiguous");r[c]=i}var l=t.length,f=t.charAt(0),h=Math.log(l)/Math.log(256),m=Math.log(256)/Math.log(l);function _(I){if(I instanceof Uint8Array||(ArrayBuffer.isView(I)?I=new Uint8Array(I.buffer,I.byteOffset,I.byteLength):Array.isArray(I)&&(I=Uint8Array.from(I))),!(I instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(I.length===0)return"";for(var R=0,W=0,Y=0,F=I.length;Y!==F&&I[Y]===0;)Y++,R++;for(var z=(F-Y)*m+1>>>0,$=new Uint8Array(z);Y!==F;){for(var j=I[Y],P=0,g=z-1;(j!==0||P<W)&&g!==-1;g--,P++)j+=256*$[g]>>>0,$[g]=j%l>>>0,j=j/l>>>0;if(j!==0)throw new Error("Non-zero carry");W=P,Y++}for(var C=z-W;C!==z&&$[C]===0;)C++;for(var Z=f.repeat(R);C<z;++C)Z+=t.charAt($[C]);return Z}function E(I){if(typeof I!="string")throw new TypeError("Expected String");if(I.length===0)return new Uint8Array;var R=0;if(I[R]!==" "){for(var W=0,Y=0;I[R]===f;)W++,R++;for(var F=(I.length-R)*h+1>>>0,z=new Uint8Array(F);I[R];){var $=r[I.charCodeAt(R)];if($===255)return;for(var j=0,P=F-1;($!==0||j<Y)&&P!==-1;P--,j++)$+=l*z[P]>>>0,z[P]=$%256>>>0,$=$/256>>>0;if($!==0)throw new Error("Non-zero carry");Y=j,R++}if(I[R]!==" "){for(var g=F-Y;g!==F&&z[g]===0;)g++;for(var C=new Uint8Array(W+(F-g)),Z=W;g!==F;)C[Z++]=z[g++];return C}}}function A(I){var R=E(I);if(R)return R;throw new Error(`Non-${e} character`)}return{encode:_,decodeUnsafe:E,decode:A}}var OS=CS,PS=OS;const Ov=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},MS=t=>new TextEncoder().encode(t),TS=t=>new TextDecoder().decode(t);class $S{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class NS{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}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 Pv(this,e)}}class RS{constructor(e){this.decoders=e}or(e){return Pv(this,e)}decode(e){const r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Pv=(t,e)=>new RS(Hr(Hr({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class LS{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new $S(e,r,n),this.decoder=new NS(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Jl=({name:t,prefix:e,encode:r,decode:n})=>new LS(t,e,r,n),yc=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=PS(r,e);return Jl({prefix:t,name:e,encode:n,decode:s=>Ov(i(s))})},BS=(t,e,r,n)=>{const i={};for(let m=0;m<e.length;++m)i[e[m]]=m;let s=t.length;for(;t[s-1]==="=";)--s;const c=new Uint8Array(s*r/8|0);let l=0,f=0,h=0;for(let m=0;m<s;++m){const _=i[t[m]];if(_===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|_,l+=r,l>=8&&(l-=8,c[h++]=255&f>>l)}if(l>=r||255&f<<8-l)throw new SyntaxError("Unexpected end of data");return c},US=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let s="",c=0,l=0;for(let f=0;f<t.length;++f)for(l=l<<8|t[f],c+=8;c>r;)c-=r,s+=e[i&l>>c];if(c&&(s+=e[i&l<<r-c]),n)for(;s.length*r&7;)s+="=";return s},Mr=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Jl({prefix:e,name:t,encode(i){return US(i,n,r)},decode(i){return BS(i,n,r,t)}}),FS=Jl({prefix:"\0",name:"identity",encode:t=>TS(t),decode:t=>MS(t)});var jS=Object.freeze({__proto__:null,identity:FS});const kS=Mr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var qS=Object.freeze({__proto__:null,base2:kS});const zS=Mr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var HS=Object.freeze({__proto__:null,base8:zS});const KS=yc({prefix:"9",name:"base10",alphabet:"0123456789"});var WS=Object.freeze({__proto__:null,base10:KS});const VS=Mr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),GS=Mr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var YS=Object.freeze({__proto__:null,base16:VS,base16upper:GS});const JS=Mr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),QS=Mr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ZS=Mr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),XS=Mr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),e9=Mr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),t9=Mr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),r9=Mr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),n9=Mr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),i9=Mr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var s9=Object.freeze({__proto__:null,base32:JS,base32upper:QS,base32pad:ZS,base32padupper:XS,base32hex:e9,base32hexupper:t9,base32hexpad:r9,base32hexpadupper:n9,base32z:i9});const o9=yc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),a9=yc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var c9=Object.freeze({__proto__:null,base36:o9,base36upper:a9});const l9=yc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),u9=yc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var h9=Object.freeze({__proto__:null,base58btc:l9,base58flickr:u9});const f9=Mr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),d9=Mr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),p9=Mr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),g9=Mr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var m9=Object.freeze({__proto__:null,base64:f9,base64pad:d9,base64url:p9,base64urlpad:g9});const Mv=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}"),v9=Mv.reduce((t,e,r)=>(t[r]=e,t),[]),y9=Mv.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function w9(t){return t.reduce((e,r)=>(e+=v9[r],e),"")}function b9(t){const e=[];for(const r of t){const n=y9[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const _9=Jl({prefix:"\u{1F680}",name:"base256emoji",encode:w9,decode:b9});var E9=Object.freeze({__proto__:null,base256emoji:_9}),A9=$v,Tv=128,x9=127,S9=~x9,I9=Math.pow(2,31);function $v(t,e,r){e=e||[],r=r||0;for(var n=r;t>=I9;)e[r++]=t&255|Tv,t/=128;for(;t&S9;)e[r++]=t&255|Tv,t>>>=7;return e[r]=t|0,$v.bytes=r-n+1,e}var D9=i0,C9=128,Nv=127;function i0(t,n){var r=0,n=n||0,i=0,s=n,c,l=t.length;do{if(s>=l)throw i0.bytes=0,new RangeError("Could not decode varint");c=t[s++],r+=i<28?(c&Nv)<<i:(c&Nv)*Math.pow(2,i),i+=7}while(c>=C9);return i0.bytes=s-n,r}var O9=Math.pow(2,7),P9=Math.pow(2,14),M9=Math.pow(2,21),T9=Math.pow(2,28),$9=Math.pow(2,35),N9=Math.pow(2,42),R9=Math.pow(2,49),L9=Math.pow(2,56),B9=Math.pow(2,63),U9=function(t){return t<O9?1:t<P9?2:t<M9?3:t<T9?4:t<$9?5:t<N9?6:t<R9?7:t<L9?8:t<B9?9:10},F9={encode:A9,decode:D9,encodingLength:U9},Rv=F9;const Lv=(t,e,r=0)=>(Rv.encode(t,e,r),e),Bv=t=>Rv.encodingLength(t),s0=(t,e)=>{const r=e.byteLength,n=Bv(t),i=n+Bv(r),s=new Uint8Array(i+r);return Lv(t,s,0),Lv(r,s,n),s.set(e,i),new j9(t,r,e,s)};class j9{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const Uv=({name:t,code:e,encode:r})=>new k9(t,e,r);class k9{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?s0(this.code,r):r.then(n=>s0(this.code,n))}else throw Error("Unknown type, must be binary type")}}const Fv=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),q9=Uv({name:"sha2-256",code:18,encode:Fv("SHA-256")}),z9=Uv({name:"sha2-512",code:19,encode:Fv("SHA-512")});var H9=Object.freeze({__proto__:null,sha256:q9,sha512:z9});const jv=0,K9="identity",kv=Ov;var W9=Object.freeze({__proto__:null,identity:{code:jv,name:K9,encode:kv,digest:t=>s0(jv,kv(t))}});new TextEncoder,new TextDecoder;const qv=Hr(Hr(Hr(Hr(Hr(Hr(Hr(Hr(Hr(Hr({},jS),qS),HS),WS),YS),s9),c9),h9),m9),E9);Hr(Hr({},H9),W9);function zv(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function V9(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?zv(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Hv(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const Kv=Hv("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),o0=Hv("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=V9(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),G9=Hr({utf8:Kv,"utf-8":Kv,hex:qv.base16,latin1:o0,ascii:o0,binary:o0},qv);function Y9(t,e="utf8"){const r=G9[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?zv(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}const Wv="wc",J9=2,a0="core",hs=`${Wv}@2:${a0}:`,Q9={name:a0,logger:"error"},Z9={database:":memory:"},X9="crypto",Vv="client_ed25519_seed",eI=_e.ONE_DAY,tI="keychain",rI="0.3",nI="messages",iI="0.3",sI=_e.SIX_HOURS,oI="publisher",Gv="irn",aI="error",Yv="wss://relay.walletconnect.com",Jv="wss://relay.walletconnect.org",cI="relayer",yn={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"},lI="_subscription",$n={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},uI=_e.ONE_SECOND,hI="2.12.0",fI=1e4,dI="0.3",pI="WALLETCONNECT_CLIENT_ID",_i={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},gI="subscription",mI="0.3",vI=_e.FIVE_SECONDS*1e3,yI="pairing",wI="0.3",wc={wc_pairingDelete:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:_e.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:_e.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:0},res:{ttl:_e.ONE_DAY,prompt:!1,tag:0}}},ra={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},ti={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},bI="history",_I="0.3",EI="expirer",Nn={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},AI="0.3",c0="verify-api",na="https://verify.walletconnect.com",l0="https://verify.walletconnect.org",xI=[na,l0],SI="echo",II="https://echo.walletconnect.com";class DI{constructor(e,r){this.core=e,this.logger=r,this.keychain=new Map,this.name=tI,this.version=rI,this.initialized=!1,this.storagePrefix=hs,this.init=async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:s}=me("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=vn(r,this.name)}get context(){return mn(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,sg(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?og(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class CI{constructor(e,r,n){this.core=e,this.logger=r,this.name=X9,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),s=hv(i);return uv(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=zE();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),c=hv(s),l=Nf();return await Tx(l,i,eI,c)},this.generateSharedKey=(i,s,c)=>{this.isInitialized();const l=this.getPrivateKey(i),f=HE(l,s);return this.setSymKey(f,c)},this.setSymKey=async(i,s)=>{this.isInitialized();const c=s||Rl(i);return await this.keychain.set(c,i),c},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,c)=>{this.isInitialized();const l=xm(c),f=Ui(s);if(Sm(l)){const E=l.senderPublicKey,A=l.receiverPublicKey;i=await this.generateSharedKey(E,A)}const h=this.getSymKey(i),{type:m,senderPublicKey:_}=l;return WE({type:m,symKey:h,message:f,senderPublicKey:_})},this.decode=async(i,s,c)=>{this.isInitialized();const l=YE(s,c);if(Sm(l)){const f=l.receiverPublicKey,h=l.senderPublicKey;i=await this.generateSharedKey(f,h)}try{const f=this.getSymKey(i),h=VE({symKey:f,encoded:s});return hc(h)}catch(f){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(f)}},this.getPayloadType=i=>{const s=Ll(i);return oc(s.type)},this.getPayloadSenderPublicKey=i=>{const s=Ll(i);return s.senderPublicKey?Fr(s.senderPublicKey,qr):void 0},this.core=e,this.logger=vn(r,this.name),this.keychain=n||new DI(this.core,this.logger)}get context(){return mn(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(Vv)}catch{e=Nf(),await this.keychain.set(Vv,e)}return Y9(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class OI extends lx{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=nI,this.version=iI,this.initialized=!1,this.storagePrefix=hs,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const s=Vs(i);let c=this.messages.get(n);return typeof c>"u"&&(c={}),typeof c[s]<"u"||(c[s]=i,this.messages.set(n,c),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const s=this.get(n),c=Vs(i);return typeof s[c]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=vn(e,this.name),this.core=r}get context(){return mn(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,sg(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?og(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class PI extends ux{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new Dr.exports.EventEmitter,this.name=oI,this.queue=new Map,this.publishTimeout=_e.toMiliseconds(_e.ONE_MINUTE),this.failedPublishTimeout=_e.toMiliseconds(_e.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var c;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});const l=s?.ttl||sI,f=Rf(s),h=s?.prompt||!1,m=s?.tag||0,_=s?.id||Qs().toString(),E={topic:n,message:i,opts:{ttl:l,relay:f,prompt:h,tag:m,id:_}},A=`Failed to publish payload, please try again. id:${_} tag:${m}`,I=Date.now();let R,W=1;try{for(;R===void 0;){if(Date.now()-I>this.publishTimeout)throw new Error(A);this.logger.trace({id:_,attempts:W},`publisher.publish - attempt ${W}`),R=await await Ja(this.rpcPublish(n,i,l,f,h,m,_).catch(Y=>this.logger.warn(Y)),this.publishTimeout,A),W++,R||await new Promise(Y=>setTimeout(Y,this.failedPublishTimeout))}this.relayer.events.emit(yn.publish,E),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:_,topic:n,message:i,opts:s}})}catch(Y){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(Y),(c=s?.internal)!=null&&c.throwOnFailedPublish)throw Y;this.queue.set(_,E)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=vn(r,this.name),this.registerEventListeners()}get context(){return mn(this.logger)}rpcPublish(e,r,n,i,s,c,l){var f,h,m,_;const E={method:Bl(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:c},id:l};return zr((f=E.params)==null?void 0:f.prompt)&&((h=E.params)==null||delete h.prompt),zr((m=E.params)==null?void 0:m.tag)&&((_=E.params)==null||delete _.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:E}),this.relayer.request(E)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(ea.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(yn.connection_stalled);return}this.checkQueue()}),this.relayer.on(yn.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class MI{constructor(){this.map=new Map,this.set=(e,r)=>{const n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,r))return;const i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var TI=Object.defineProperty,$I=Object.defineProperties,NI=Object.getOwnPropertyDescriptors,Qv=Object.getOwnPropertySymbols,RI=Object.prototype.hasOwnProperty,LI=Object.prototype.propertyIsEnumerable,Zv=(t,e,r)=>e in t?TI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,bc=(t,e)=>{for(var r in e||(e={}))RI.call(e,r)&&Zv(t,r,e[r]);if(Qv)for(var r of Qv(e))LI.call(e,r)&&Zv(t,r,e[r]);return t},u0=(t,e)=>$I(t,NI(e));class BI extends dx{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new MI,this.events=new Dr.exports.EventEmitter,this.name=gI,this.version=mI,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=hs,this.subscribeTimeout=_e.toMiliseconds(_e.ONE_MINUTE),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(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=Rf(i),c={topic:n,relay:s};this.pending.set(n,c);const l=await this.rpcSubscribe(n,s);return typeof l=="string"&&(this.onSubscribe(l,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),l}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((s,c)=>{const l=new _e.Watch;l.start(i);const f=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(f),l.stop(i),s(!0)),l.elapsed(i)>=vI&&(clearInterval(f),l.stop(i),c(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=vn(r,this.name),this.clientId=""}get context(){return mn(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,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{const i=Rf(n);await this.rpcUnsubscribe(e,r,i);const s=Ut("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){const n={method:Bl(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Ja(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)?Vs(e+this.clientId):null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(yn.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,n={method:Bl(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Ja(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(yn.connection_stalled)}}rpcUnsubscribe(e,r,n){const i={method:Bl(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,u0(bc({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,bc({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),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,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,bc({},r)),this.topicMap.set(r.topic,e),this.events.emit(_i.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:n}=me("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(_i.deleted,u0(bc({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(_i.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<e;r++){const n=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(n)}}this.events.emit(_i.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=me("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}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 r=await this.rpcBatchSubscribe(e);wi(r)&&this.onBatchSubscribe(r.map((n,i)=>u0(bc({},e[i]),{id:n})))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(ea.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.events.on(_i.created,async e=>{const r=_i.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(_i.deleted,async e=>{const r=_i.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var UI=Object.defineProperty,Xv=Object.getOwnPropertySymbols,FI=Object.prototype.hasOwnProperty,jI=Object.prototype.propertyIsEnumerable,ey=(t,e,r)=>e in t?UI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kI=(t,e)=>{for(var r in e||(e={}))FI.call(e,r)&&ey(t,r,e[r]);if(Xv)for(var r of Xv(e))jI.call(e,r)&&ey(t,r,e[r]);return t};class qI extends hx{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Dr.exports.EventEmitter,this.name=cI,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=_e.toMiliseconds(_e.THIRTY_SECONDS+_e.ONE_SECOND),this.request=async r=>{var n,i;this.logger.debug("Publishing Request Payload");const s=r.id||Qs().toString();await this.toEstablishConnection();try{const c=this.provider.request(r);this.requestsInFlight.set(s,{promise:c,request:r}),this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const l=await new Promise(async(f,h)=>{const m=()=>{h(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on($n.disconnect,m);const _=await c;this.provider.off($n.disconnect,m),f(_)});return this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - published"),l}catch(c){throw this.logger.debug(`Failed to Publish Request: ${s}`),c}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(Ga())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,n,i;(i=(n=(r=this.provider)==null?void 0:r.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.startPingTimeout(),this.events.emit(yn.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(yn.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on($n.payload,this.onPayloadHandler),this.provider.on($n.connect,this.onConnectHandler),this.provider.on($n.disconnect,this.onDisconnectHandler),this.provider.on($n.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?vn(e.logger,this.name):ls(sv({level:e.logger||aI})),this.messages=new OI(this.logger,e.core),this.subscriber=new BI(this,this.logger),this.publisher=new PI(this,this.logger),this.relayUrl=e?.relayUrl||Yv,this.projectId=e.projectId,this.bundleId=T_(),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 ${Jv}...`),await this.restartTransport(Jv)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&this.subscriber.pending.size===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},fI)}get context(){return mn(this.logger)}get connected(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===1}get connecting(){var e,r,n;return((n=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:n.readyState)===0}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"",s;const c=l=>{l.topic===e&&(this.subscriber.off(_i.created,c),s())};return await Promise.all([new Promise(l=>{s=l,this.subscriber.on(_i.created,c)}),new Promise(async l=>{i=await this.subscriber.subscribe(e,r)||i,l()})]),i}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await Ja(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect(),await this.createProvider()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,n)=>{const i=()=>{this.provider.off($n.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on($n.disconnect,i),await Ja(this.provider.connect(),_e.toMiliseconds(_e.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{n(s)}),await this.subscriber.start(),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const n=r;if(!this.isConnectionStalled(n.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Bm())throw new Error("No internet connection detected. Please restart your network and try again.")}startPingTimeout(){var e,r,n,i,s;if(Ga())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(c){this.logger.warn(c)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new ki(new bS(U_({sdkVersion:hI,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),r0(e)){if(!e.method.endsWith(lI))return;const r=e.params,{topic:n,message:i,publishedAt:s}=r.data,c={topic:n,message:i,publishedAt:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(kI({type:"event",event:r.id},c)),this.events.emit(r.id,c),await this.acknowledgePayload(e),await this.onMessageEvent(c)}else Yl(e)&&this.events.emit(yn.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(yn.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Vl(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off($n.payload,this.onPayloadHandler),this.provider.off($n.connect,this.onConnectHandler),this.provider.off($n.disconnect,this.onDisconnectHandler),this.provider.off($n.error,this.onProviderErrorHandler)}async registerEventListeners(){let e=await Bm();FA(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.events.emit(yn.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},_e.toMiliseconds(uI))}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var zI=Object.defineProperty,ty=Object.getOwnPropertySymbols,HI=Object.prototype.hasOwnProperty,KI=Object.prototype.propertyIsEnumerable,ry=(t,e,r)=>e in t?zI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ny=(t,e)=>{for(var r in e||(e={}))HI.call(e,r)&&ry(t,r,e[r]);if(ty)for(var r of ty(e))KI.call(e,r)&&ry(t,r,e[r]);return t};class Zs extends fx{constructor(e,r,n,i=hs,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=dI,this.cached=[],this.initialized=!1,this.storagePrefix=hs,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(c=>{this.getKey&&c!==null&&!zr(c)?this.map.set(this.getKey(c),c):mA(c)?this.map.set(c.id,c):vA(c)&&this.map.set(c.topic,c)}),this.cached=[],this.initialized=!0)},this.set=async(c,l)=>{this.isInitialized(),this.map.has(c)?await this.update(c,l):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:c,value:l}),this.map.set(c,l),await this.persist())},this.get=c=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:c}),this.getData(c)),this.getAll=c=>(this.isInitialized(),c?this.values.filter(l=>Object.keys(c).every(f=>_S(l[f],c[f]))):this.values),this.update=async(c,l)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:c,update:l});const f=ny(ny({},this.getData(c)),l);this.map.set(c,f),await this.persist()},this.delete=async(c,l)=>{this.isInitialized(),this.map.has(c)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:c,reason:l}),this.map.delete(c),this.addToRecentlyDeleted(c),await this.persist())},this.logger=vn(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return mn(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:i}=me("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=me("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}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:r}=me("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}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}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class WI{constructor(e,r){this.core=e,this.logger=r,this.name=yI,this.version=wI,this.events=new Dr.exports,this.initialized=!1,this.storagePrefix=hs,this.ignoredPayloadTypes=[cs],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:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async n=>{this.isInitialized();const i=Nf(),s=await this.core.crypto.setSymKey(i),c=Nr(_e.FIVE_MINUTES),l={protocol:Gv},f={topic:s,expiry:c,relay:l,active:!1},h=oA({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:l,expiryTimestamp:c,methods:n?.methods});return await this.pairings.set(s,f),await this.core.relayer.subscribe(s),this.core.expirer.set(s,c),{topic:s,uri:h}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:i,symKey:s,relay:c,expiryTimestamp:l,methods:f}=Om(n.uri);let h;if(this.pairings.keys.includes(i)&&(h=this.pairings.get(i),h.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);const m=l||Nr(_e.FIVE_MINUTES),_={topic:i,relay:c,expiry:m,active:!1,methods:f};return await this.pairings.set(i,_),this.core.expirer.set(i,m),n.activatePairing&&await this.activate({topic:i}),this.events.emit(ra.create,_),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:c}),_},this.activate=async({topic:n})=>{this.isInitialized();const i=Nr(_e.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:c,resolve:l,reject:f}=zs();this.events.once(wt("pairing_ping",s),({error:h})=>{h?f(h):l()}),await c()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Ut("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{const c=ta(i,s),l=await this.core.crypto.encode(n,c),f=wc[i].req;return this.core.history.set(n,c),this.core.relayer.publish(n,l,f),c.id},this.sendResult=async(n,i,s)=>{const c=Vl(n,s),l=await this.core.crypto.encode(i,c),f=await this.core.history.get(i,n),h=wc[f.request.method].res;await this.core.relayer.publish(i,l,h),await this.core.history.resolve(c)},this.sendError=async(n,i,s)=>{const c=Gl(n,s),l=await this.core.crypto.encode(i,c),f=await this.core.history.get(i,n),h=wc[f.request.method]?wc[f.request.method].res:wc.unregistered_method.res;await this.core.relayer.publish(i,l,h),await this.core.history.resolve(c)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Ut("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>is(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:s}=n,c=(await this.core.history.get(i,s.id)).request.method;switch(c){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(c)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(ra.ping,{id:s,topic:n})}catch(c){await this.sendError(s,n,c),this.logger.error(c)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{bi(i)?this.events.emit(wt("pairing_ping",s),{}):Tn(i)&&this.events.emit(wt("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(ra.delete,{id:s,topic:n})}catch(c){await this.sendError(s,n,c),this.logger.error(c)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:c}=i;try{if(this.registeredMethods.includes(c))return;const l=Ut("WC_METHOD_UNSUPPORTED",c);await this.sendError(s,n,l),this.logger.error(l)}catch(l){await this.sendError(s,n,l),this.logger.error(l)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Ut("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{var i;if(!rn(n)){const{message:c}=me("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(c)}if(!gA(n.uri)){const{message:c}=me("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(c)}const s=Om(n.uri);if(!((i=s?.relay)!=null&&i.protocol)){const{message:c}=me("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(c)}if(!(s!=null&&s.symKey)){const{message:c}=me("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(c)}if(s!=null&&s.expiryTimestamp&&_e.toMiliseconds(s?.expiryTimestamp)<Date.now()){const{message:c}=me("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}},this.isValidPing=async n=>{if(!rn(n)){const{message:s}=me("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!rn(n)){const{message:s}=me("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ur(n,!1)){const{message:i}=me("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=me("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(is(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=me("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=vn(r,this.name),this.pairings=new Zs(this.core,this.logger,this.name,this.storagePrefix)}get context(){return mn(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(yn.message,async e=>{const{topic:r,message:n}=e;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const i=await this.core.crypto.decode(r,n);try{r0(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Yl(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Nn.expired,async e=>{const{topic:r}=cg(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(ra.expire,{topic:r}))})}}class VI extends cx{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new Dr.exports.EventEmitter,this.name=bI,this.version=_I,this.cached=[],this.initialized=!1,this.storagePrefix=hs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;const c={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:Nr(_e.THIRTY_DAYS)};this.records.set(c.id,c),this.persist(),this.events.emit(ti.created,c)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Tn(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(ti.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(ti.deleted,s)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=vn(r,this.name)}get context(){return mn(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(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:ta(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),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 r=this.records.get(e);if(!r){const{message:n}=me("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(ti.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=me("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}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(ti.created,e=>{const r=ti.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(ti.updated,e=>{const r=ti.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(ti.deleted,e=>{const r=ti.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(ea.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{_e.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(ti.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class GI extends px{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new Dr.exports.EventEmitter,this.name=EI,this.version=AI,this.cached=[],this.initialized=!1,this.storagePrefix=hs,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const s=this.formatTarget(n),c={target:s,expiry:i};this.expirations.set(s,c),this.checkExpiry(s,c),this.events.emit(Nn.created,{target:s,expiration:c})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Nn.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=vn(r,this.name)}get context(){return mn(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 F_(e);if(typeof e=="number")return j_(e);const{message:r}=me("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}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(Nn.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=me("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}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 r=this.expirations.get(e);if(!r){const{message:n}=me("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;_e.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Nn.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(ea.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Nn.created,e=>{const r=Nn.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Nn.expired,e=>{const r=Nn.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Nn.deleted,e=>{const r=Nn.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}}}class YI extends gx{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=c0,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async n=>{if(this.verifyDisabled||jo()||!ko())return;const i=this.getVerifyUrl(n?.verifyUrl);this.verifyUrl!==i&&this.removeIframe(),this.verifyUrl=i;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s)}if(!this.initialized){this.removeIframe(),this.verifyUrl=l0;try{await this.createIframe()}catch(s){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(s),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";const i=this.getVerifyUrl(n?.verifyUrl);let s;try{s=await this.fetchAttestation(n.attestationId,i)}catch(c){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(c),s=await this.fetchAttestation(n.attestationId,l0)}return s},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);const s=this.startAbortTimer(_e.ONE_SECOND*2),c=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(s),c.status===200?await c.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n;const i=s=>{s.data==="verify_ready"&&(this.onInit(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(s=>{const c=document.getElementById(c0);if(c)return this.iframe=c,this.onInit(),s();window.addEventListener("message",i);const l=document.createElement("iframe");l.id=c0,l.src=`${this.verifyUrl}/${this.projectId}`,l.style.display="none",document.body.append(l),this.iframe=l,n=s}),new Promise((s,c)=>setTimeout(()=>{window.removeEventListener("message",i),c("verify iframe load timeout")},_e.toMiliseconds(_e.FIVE_SECONDS)))])},this.onInit=()=>{this.initialized=!0,this.processQueue()},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=n=>{let i=n||na;return xI.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${na}`),i=na),i},this.logger=vn(r,this.name),this.verifyUrl=na,this.abortController=new AbortController,this.isDevEnv=Ga()&&process.env.IS_VITEST}get context(){return mn(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),_e.toMiliseconds(e))}}class JI extends mx{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=SI,this.registerDeviceToken=async n=>{const{clientId:i,token:s,notificationType:c,enableEncrypted:l=!1}=n,f=`${II}/${this.projectId}/clients`;await xS(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:c,token:s,always_raw:l})})},this.logger=vn(r,this.context)}}var QI=Object.defineProperty,iy=Object.getOwnPropertySymbols,ZI=Object.prototype.hasOwnProperty,XI=Object.prototype.propertyIsEnumerable,sy=(t,e,r)=>e in t?QI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,oy=(t,e)=>{for(var r in e||(e={}))ZI.call(e,r)&&sy(t,r,e[r]);if(iy)for(var r of iy(e))XI.call(e,r)&&sy(t,r,e[r]);return t};class h0 extends ax{constructor(e){var r;super(e),this.protocol=Wv,this.version=J9,this.name=a0,this.events=new Dr.exports.EventEmitter,this.initialized=!1,this.on=(c,l)=>this.events.on(c,l),this.once=(c,l)=>this.events.once(c,l),this.off=(c,l)=>this.events.off(c,l),this.removeListener=(c,l)=>this.events.removeListener(c,l),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||Yv,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=sv({level:typeof e?.logger=="string"&&e.logger?e.logger:Q9.logger}),{logger:i,chunkLoggerController:s}=ox({opts:n,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var c,l;(c=this.logChunkController)!=null&&c.downloadLogsBlobInBrowser&&((l=this.logChunkController)==null||l.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=vn(i,this.name),this.heartbeat=new ea.HeartBeat,this.crypto=new CI(this,this.logger,e?.keychain),this.history=new VI(this,this.logger),this.expirer=new GI(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new w7(oy(oy({},Z9),e?.storageOptions)),this.relayer=new qI({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new WI(this,this.logger),this.verify=new YI(this.projectId||"",this.logger),this.echoClient=new JI(this.projectId||"",this.logger)}static async init(e){const r=new h0(e);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(pI,n),r}get context(){return mn(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const eD=h0;var Xs={};/*! *****************************************************************************
47
57
  Copyright (c) Microsoft Corporation.
48
58
 
49
59
  Permission to use, copy, modify, and/or distribute this software for any
@@ -56,84 +66,84 @@
56
66
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
57
67
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
58
68
  PERFORMANCE OF THIS SOFTWARE.
59
- ***************************************************************************** */var Au=function(r,e){return Au=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},Au(r,e)};function _E(r,e){Au(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Pu=function(){return Pu=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Pu.apply(this,arguments)};function EE(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function xE(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var u=r.length-1;u>=0;u--)(c=r[u])&&(a=(i<3?c(a):i>3?c(e,t,a):c(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function IE(r,e){return function(t,n){e(t,n,r)}}function DE(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function SE(r,e,t,n){function i(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function u(m){try{h(n.next(m))}catch(w){c(w)}}function f(m){try{h(n.throw(m))}catch(w){c(w)}}function h(m){m.done?a(m.value):i(m.value).then(u,f)}h((n=n.apply(r,e||[])).next())})}function OE(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=h[0]&2?i.return:h[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,h[1])).done)return a;switch(i=0,a&&(h=[h[0]&2,a.value]),h[0]){case 0:case 1:a=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,i=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){t.label=h[1];break}if(h[0]===6&&t.label<a[1]){t.label=a[1],a=h;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(h);break}a[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(m){h=[6,m],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function CE(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}function $E(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function Tu(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function zp(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(u){c={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(c)throw c.error}}return a}function AE(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(zp(arguments[e]));return r}function PE(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],c=0,u=a.length;c<u;c++,i++)n[i]=a[c];return n}function Mo(r){return this instanceof Mo?(this.v=r,this):new Mo(r)}function TE(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(y){n[y]&&(i[y]=function(_){return new Promise(function(S,P){a.push([y,_,S,P])>1||u(y,_)})})}function u(y,_){try{f(n[y](_))}catch(S){w(a[0][3],S)}}function f(y){y.value instanceof Mo?Promise.resolve(y.value.v).then(h,m):w(a[0][2],y)}function h(y){u("next",y)}function m(y){u("throw",y)}function w(y,_){y(_),a.shift(),a.length&&u(a[0][0],a[0][1])}}function RE(r){var e,t;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,a){e[i]=r[i]?function(c){return(t=!t)?{value:Mo(r[i](c)),done:i==="return"}:a?a(c):c}:a}}function NE(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 Tu=="function"?Tu(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(c){return new Promise(function(u,f){c=r[a](c),i(u,f,c.done,c.value)})}}function i(a,c,u,f){Promise.resolve(f).then(function(h){a({value:h,done:u})},c)}}function LE(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function ME(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 UE(r){return r&&r.__esModule?r:{default:r}}function jE(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function FE(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 BE=Object.freeze({__proto__:null,__extends:_E,get __assign(){return Pu},__rest:EE,__decorate:xE,__param:IE,__metadata:DE,__awaiter:SE,__generator:OE,__createBinding:CE,__exportStar:$E,__values:Tu,__read:zp,__spread:AE,__spreadArrays:PE,__await:Mo,__asyncGenerator:TE,__asyncDelegator:RE,__asyncValues:NE,__makeTemplateObject:LE,__importStar:ME,__importDefault:UE,__classPrivateFieldGet:jE,__classPrivateFieldSet:FE}),kE=Pi(BE),Ln={},Hp;function qE(){if(Hp)return Ln;Hp=1,Object.defineProperty(Ln,"__esModule",{value:!0}),Ln.isBrowserCryptoAvailable=Ln.getSubtleCrypto=Ln.getBrowerCrypto=void 0;function r(){return vr?.crypto||vr?.msCrypto||{}}Ln.getBrowerCrypto=r;function e(){const n=r();return n.subtle||n.webkitSubtle}Ln.getSubtleCrypto=e;function t(){return!!r()&&!!e()}return Ln.isBrowserCryptoAvailable=t,Ln}var Mn={},Wp;function zE(){if(Wp)return Mn;Wp=1,Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.isBrowser=Mn.isNode=Mn.isReactNative=void 0;function r(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Mn.isReactNative=r;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Mn.isNode=e;function t(){return!r()&&!e()}return Mn.isBrowser=t,Mn}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=kE;e.__exportStar(qE(),r),e.__exportStar(zE(),r)})(qp);function Os(r=3){const e=Date.now()*Math.pow(10,r),t=Math.floor(Math.random()*Math.pow(10,r));return e+t}function qi(r=6){return BigInt(Os(r))}function Cs(r,e,t){return{id:t||Os(),jsonrpc:"2.0",method:r,params:e}}function Ka(r,e){return{id:r,jsonrpc:"2.0",result:e}}function Va(r,e,t){return{id:r,jsonrpc:"2.0",error:HE(e,t)}}function HE(r,e){return typeof r>"u"?Bp(jp):(typeof r=="string"&&(r=Object.assign(Object.assign({},Bp($u)),{message:r})),typeof e<"u"&&(r.data=e),wE(r.code)&&(r=bE(r.code)),r)}class WE{}class KE extends WE{constructor(){super()}}class VE extends KE{constructor(e){super()}}const GE="^https?:",YE="^wss?:";function ZE(r){const e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Kp(r,e){const t=ZE(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function Vp(r){return Kp(r,GE)}function Gp(r){return Kp(r,YE)}function JE(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function Yp(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function Ru(r){return Yp(r)&&"method"in r}function Ga(r){return Yp(r)&&(Un(r)||pn(r))}function Un(r){return"result"in r}function pn(r){return"error"in r}class jn extends VE{constructor(e){super(e),this.events=new lr.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(Cs(e.method,e.params||[],e.id||qi().toString()),t)}async requestStrict(e,t){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(a){i(a)}this.events.on(`${e.id}`,a=>{pn(a)?i(a.error):n(a.result)});try{await this.connection.send(e,t)}catch(a){i(a)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Ga(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 QE=()=>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"),XE=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",Zp=r=>r.split("?")[0],Jp=10,e6=QE();class t6{constructor(e){if(this.url=e,this.events=new lr.exports.EventEmitter,this.registering=!1,!Gp(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=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(ji(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!Gp(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((n,i)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),i(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,n)=>{const i=new URLSearchParams(e).get("origin"),a=qp.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!JE(e)},c=new e6(e,[],a);XE()?c.onerror=u=>{const f=u;n(this.emitError(f.error))}:c.on("error",u=>{n(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"?Ao(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),i=n.message||n.toString(),a=Va(e,i);this.events.emit("payload",a)}parseError(e,t=this.url){return kp(e,Zp(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>Jp&&this.events.setMaxListeners(Jp)}emitError(e){const t=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${Zp(this.url)}`));return this.events.emit("register_error",t),t}}var Nu={exports:{}};(function(r,e){var t=200,n="__lodash_hash_undefined__",i=1,a=2,c=9007199254740991,u="[object Arguments]",f="[object Array]",h="[object AsyncFunction]",m="[object Boolean]",w="[object Date]",y="[object Error]",_="[object Function]",S="[object GeneratorFunction]",P="[object Map]",j="[object Number]",U="[object Null]",A="[object Object]",T="[object Promise]",O="[object Proxy]",$="[object RegExp]",x="[object Set]",d="[object String]",b="[object Symbol]",H="[object Undefined]",F="[object WeakMap]",V="[object ArrayBuffer]",se="[object DataView]",ce="[object Float32Array]",I="[object Float64Array]",N="[object Int8Array]",X="[object Int16Array]",ee="[object Int32Array]",Y="[object Uint8Array]",Z="[object Uint8ClampedArray]",Q="[object Uint16Array]",ie="[object Uint32Array]",Ee=/[\\^$.*+?()[\]{}|]/g,ae=/^\[object .+?Constructor\]$/,xe=/^(?:0|[1-9]\d*)$/,de={};de[ce]=de[I]=de[N]=de[X]=de[ee]=de[Y]=de[Z]=de[Q]=de[ie]=!0,de[u]=de[f]=de[V]=de[m]=de[se]=de[w]=de[y]=de[_]=de[P]=de[j]=de[A]=de[$]=de[x]=de[d]=de[F]=!1;var be=typeof vr=="object"&&vr&&vr.Object===Object&&vr,K=typeof self=="object"&&self&&self.Object===Object&&self,W=be||K||Function("return this")(),B=e&&!e.nodeType&&e,g=B&&!0&&r&&!r.nodeType&&r,L=g&&g.exports===B,le=L&&be.process,pe=function(){try{return le&&le.binding&&le.binding("util")}catch{}}(),Oe=pe&&pe.isTypedArray;function Ke(C,k){for(var ne=-1,ge=C==null?0:C.length,yt=0,Ne=[];++ne<ge;){var It=C[ne];k(It,ne,C)&&(Ne[yt++]=It)}return Ne}function Ze(C,k){for(var ne=-1,ge=k.length,yt=C.length;++ne<ge;)C[yt+ne]=k[ne];return C}function ke(C,k){for(var ne=-1,ge=C==null?0:C.length;++ne<ge;)if(k(C[ne],ne,C))return!0;return!1}function Ot(C,k){for(var ne=-1,ge=Array(C);++ne<C;)ge[ne]=k(ne);return ge}function Ct(C){return function(k){return C(k)}}function ze(C,k){return C.has(k)}function Ce(C,k){return C?.[k]}function Ue(C){var k=-1,ne=Array(C.size);return C.forEach(function(ge,yt){ne[++k]=[yt,ge]}),ne}function je(C,k){return function(ne){return C(k(ne))}}function He(C){var k=-1,ne=Array(C.size);return C.forEach(function(ge){ne[++k]=ge}),ne}var Ae=Array.prototype,Fe=Function.prototype,Se=Object.prototype,Te=W["__core-js_shared__"],Ve=Fe.toString,$e=Se.hasOwnProperty,Je=function(){var C=/[^.]+$/.exec(Te&&Te.keys&&Te.keys.IE_PROTO||"");return C?"Symbol(src)_1."+C:""}(),et=Se.toString,at=RegExp("^"+Ve.call($e).replace(Ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ct=L?W.Buffer:void 0,nt=W.Symbol,Dr=W.Uint8Array,Mr=Se.propertyIsEnumerable,$n=Ae.splice,Sr=nt?nt.toStringTag:void 0,Wn=Object.getOwnPropertySymbols,bi=ct?ct.isBuffer:void 0,ns=je(Object.keys,Object),Mt=Gr(W,"DataView"),$t=Gr(W,"Map"),Ut=Gr(W,"Promise"),jt=Gr(W,"Set"),Rt=Gr(W,"WeakMap"),At=Gr(Object,"create"),Gt=Vn(Mt),Yt=Vn($t),Ft=Vn(Ut),Zt=Vn(jt),Bt=Vn(Rt),Ht=nt?nt.prototype:void 0,kt=Ht?Ht.valueOf:void 0;function Et(C){var k=-1,ne=C==null?0:C.length;for(this.clear();++k<ne;){var ge=C[k];this.set(ge[0],ge[1])}}function Jt(){this.__data__=At?At(null):{},this.size=0}function Qt(C){var k=this.has(C)&&delete this.__data__[C];return this.size-=k?1:0,k}function uf(C){var k=this.__data__;if(At){var ne=k[C];return ne===n?void 0:ne}return $e.call(k,C)?k[C]:void 0}function hf(C){var k=this.__data__;return At?k[C]!==void 0:$e.call(k,C)}function ff(C,k){var ne=this.__data__;return this.size+=this.has(C)?0:1,ne[C]=At&&k===void 0?n:k,this}Et.prototype.clear=Jt,Et.prototype.delete=Qt,Et.prototype.get=uf,Et.prototype.has=hf,Et.prototype.set=ff;function nn(C){var k=-1,ne=C==null?0:C.length;for(this.clear();++k<ne;){var ge=C[k];this.set(ge[0],ge[1])}}function df(){this.__data__=[],this.size=0}function pf(C){var k=this.__data__,ne=is(k,C);if(ne<0)return!1;var ge=k.length-1;return ne==ge?k.pop():$n.call(k,ne,1),--this.size,!0}function gf(C){var k=this.__data__,ne=is(k,C);return ne<0?void 0:k[ne][1]}function mf(C){return is(this.__data__,C)>-1}function vf(C,k){var ne=this.__data__,ge=is(ne,C);return ge<0?(++this.size,ne.push([C,k])):ne[ge][1]=k,this}nn.prototype.clear=df,nn.prototype.delete=pf,nn.prototype.get=gf,nn.prototype.has=mf,nn.prototype.set=vf;function Kn(C){var k=-1,ne=C==null?0:C.length;for(this.clear();++k<ne;){var ge=C[k];this.set(ge[0],ge[1])}}function Ys(){this.size=0,this.__data__={hash:new Et,map:new($t||nn),string:new Et}}function yf(C){var k=_i(this,C).delete(C);return this.size-=k?1:0,k}function Zs(C){return _i(this,C).get(C)}function wf(C){return _i(this,C).has(C)}function bf(C,k){var ne=_i(this,C),ge=ne.size;return ne.set(C,k),this.size+=ne.size==ge?0:1,this}Kn.prototype.clear=Ys,Kn.prototype.delete=yf,Kn.prototype.get=Zs,Kn.prototype.has=wf,Kn.prototype.set=bf;function Js(C){var k=-1,ne=C==null?0:C.length;for(this.__data__=new Kn;++k<ne;)this.add(C[k])}function Ac(C){return this.__data__.set(C,n),this}function Pc(C){return this.__data__.has(C)}Js.prototype.add=Js.prototype.push=Ac,Js.prototype.has=Pc;function gn(C){var k=this.__data__=new nn(C);this.size=k.size}function _f(){this.__data__=new nn,this.size=0}function Ef(C){var k=this.__data__,ne=k.delete(C);return this.size=k.size,ne}function xf(C){return this.__data__.get(C)}function If(C){return this.__data__.has(C)}function Tc(C,k){var ne=this.__data__;if(ne instanceof nn){var ge=ne.__data__;if(!$t||ge.length<t-1)return ge.push([C,k]),this.size=++ne.size,this;ne=this.__data__=new Kn(ge)}return ne.set(C,k),this.size=ne.size,this}gn.prototype.clear=_f,gn.prototype.delete=Ef,gn.prototype.get=xf,gn.prototype.has=If,gn.prototype.set=Tc;function Rc(C,k){var ne=eo(C),ge=!ne&&Wc(C),yt=!ne&&!ge&&la(C),Ne=!ne&&!ge&&!yt&&Gc(C),It=ne||ge||yt||Ne,Xt=It?Ot(C.length,String):[],it=Xt.length;for(var wt in C)(k||$e.call(C,wt))&&!(It&&(wt=="length"||yt&&(wt=="offset"||wt=="parent")||Ne&&(wt=="buffer"||wt=="byteLength"||wt=="byteOffset")||Bc(wt,it)))&&Xt.push(wt);return Xt}function is(C,k){for(var ne=C.length;ne--;)if(Hc(C[ne][0],k))return ne;return-1}function aa(C,k,ne){var ge=k(C);return eo(C)?ge:Ze(ge,ne(C))}function ss(C){return C==null?C===void 0?H:U:Sr&&Sr in Object(C)?jc(C):Of(C)}function ca(C){return as(C)&&ss(C)==u}function os(C,k,ne,ge,yt){return C===k?!0:C==null||k==null||!as(C)&&!as(k)?C!==C&&k!==k:Nc(C,k,ne,ge,os,yt)}function Nc(C,k,ne,ge,yt,Ne){var It=eo(C),Xt=eo(k),it=It?f:An(C),wt=Xt?f:An(k);it=it==u?A:it,wt=wt==u?A:wt;var Wt=it==A,Ur=wt==A,er=it==wt;if(er&&la(C)){if(!la(k))return!1;It=!0,Wt=!1}if(er&&!Wt)return Ne||(Ne=new gn),It||Gc(C)?Qs(C,k,ne,ge,yt,Ne):Sf(C,k,it,ne,ge,yt,Ne);if(!(ne&i)){var Dt=Wt&&$e.call(C,"__wrapped__"),Or=Ur&&$e.call(k,"__wrapped__");if(Dt||Or){var mn=Dt?C.value():C,sn=Or?k.value():k;return Ne||(Ne=new gn),yt(mn,sn,ne,ge,Ne)}}return er?(Ne||(Ne=new gn),Uc(C,k,ne,ge,yt,Ne)):!1}function Df(C){if(!Vc(C)||qc(C))return!1;var k=to(C)?at:ae;return k.test(Vn(C))}function Lc(C){return as(C)&&Kc(C.length)&&!!de[ss(C)]}function Mc(C){if(!zc(C))return ns(C);var k=[];for(var ne in Object(C))$e.call(C,ne)&&ne!="constructor"&&k.push(ne);return k}function Qs(C,k,ne,ge,yt,Ne){var It=ne&i,Xt=C.length,it=k.length;if(Xt!=it&&!(It&&it>Xt))return!1;var wt=Ne.get(C);if(wt&&Ne.get(k))return wt==k;var Wt=-1,Ur=!0,er=ne&a?new Js:void 0;for(Ne.set(C,k),Ne.set(k,C);++Wt<Xt;){var Dt=C[Wt],Or=k[Wt];if(ge)var mn=It?ge(Or,Dt,Wt,k,C,Ne):ge(Dt,Or,Wt,C,k,Ne);if(mn!==void 0){if(mn)continue;Ur=!1;break}if(er){if(!ke(k,function(sn,Pn){if(!ze(er,Pn)&&(Dt===sn||yt(Dt,sn,ne,ge,Ne)))return er.push(Pn)})){Ur=!1;break}}else if(!(Dt===Or||yt(Dt,Or,ne,ge,Ne))){Ur=!1;break}}return Ne.delete(C),Ne.delete(k),Ur}function Sf(C,k,ne,ge,yt,Ne,It){switch(ne){case se:if(C.byteLength!=k.byteLength||C.byteOffset!=k.byteOffset)return!1;C=C.buffer,k=k.buffer;case V:return!(C.byteLength!=k.byteLength||!Ne(new Dr(C),new Dr(k)));case m:case w:case j:return Hc(+C,+k);case y:return C.name==k.name&&C.message==k.message;case $:case d:return C==k+"";case P:var Xt=Ue;case x:var it=ge&i;if(Xt||(Xt=He),C.size!=k.size&&!it)return!1;var wt=It.get(C);if(wt)return wt==k;ge|=a,It.set(C,k);var Wt=Qs(Xt(C),Xt(k),ge,yt,Ne,It);return It.delete(C),Wt;case b:if(kt)return kt.call(C)==kt.call(k)}return!1}function Uc(C,k,ne,ge,yt,Ne){var It=ne&i,Xt=Xs(C),it=Xt.length,wt=Xs(k),Wt=wt.length;if(it!=Wt&&!It)return!1;for(var Ur=it;Ur--;){var er=Xt[Ur];if(!(It?er in k:$e.call(k,er)))return!1}var Dt=Ne.get(C);if(Dt&&Ne.get(k))return Dt==k;var Or=!0;Ne.set(C,k),Ne.set(k,C);for(var mn=It;++Ur<it;){er=Xt[Ur];var sn=C[er],Pn=k[er];if(ge)var ua=It?ge(Pn,sn,er,k,C,Ne):ge(sn,Pn,er,C,k,Ne);if(!(ua===void 0?sn===Pn||yt(sn,Pn,ne,ge,Ne):ua)){Or=!1;break}mn||(mn=er=="constructor")}if(Or&&!mn){var cs=C.constructor,ar=k.constructor;cs!=ar&&"constructor"in C&&"constructor"in k&&!(typeof cs=="function"&&cs instanceof cs&&typeof ar=="function"&&ar instanceof ar)&&(Or=!1)}return Ne.delete(C),Ne.delete(k),Or}function Xs(C){return aa(C,Af,Fc)}function _i(C,k){var ne=C.__data__;return kc(k)?ne[typeof k=="string"?"string":"hash"]:ne.map}function Gr(C,k){var ne=Ce(C,k);return Df(ne)?ne:void 0}function jc(C){var k=$e.call(C,Sr),ne=C[Sr];try{C[Sr]=void 0;var ge=!0}catch{}var yt=et.call(C);return ge&&(k?C[Sr]=ne:delete C[Sr]),yt}var Fc=Wn?function(C){return C==null?[]:(C=Object(C),Ke(Wn(C),function(k){return Mr.call(C,k)}))}:vt,An=ss;(Mt&&An(new Mt(new ArrayBuffer(1)))!=se||$t&&An(new $t)!=P||Ut&&An(Ut.resolve())!=T||jt&&An(new jt)!=x||Rt&&An(new Rt)!=F)&&(An=function(C){var k=ss(C),ne=k==A?C.constructor:void 0,ge=ne?Vn(ne):"";if(ge)switch(ge){case Gt:return se;case Yt:return P;case Ft:return T;case Zt:return x;case Bt:return F}return k});function Bc(C,k){return k=k??c,!!k&&(typeof C=="number"||xe.test(C))&&C>-1&&C%1==0&&C<k}function kc(C){var k=typeof C;return k=="string"||k=="number"||k=="symbol"||k=="boolean"?C!=="__proto__":C===null}function qc(C){return!!Je&&Je in C}function zc(C){var k=C&&C.constructor,ne=typeof k=="function"&&k.prototype||Se;return C===ne}function Of(C){return et.call(C)}function Vn(C){if(C!=null){try{return Ve.call(C)}catch{}try{return C+""}catch{}}return""}function Hc(C,k){return C===k||C!==C&&k!==k}var Wc=ca(function(){return arguments}())?ca:function(C){return as(C)&&$e.call(C,"callee")&&!Mr.call(C,"callee")},eo=Array.isArray;function Cf(C){return C!=null&&Kc(C.length)&&!to(C)}var la=bi||mt;function $f(C,k){return os(C,k)}function to(C){if(!Vc(C))return!1;var k=ss(C);return k==_||k==S||k==h||k==O}function Kc(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=c}function Vc(C){var k=typeof C;return C!=null&&(k=="object"||k=="function")}function as(C){return C!=null&&typeof C=="object"}var Gc=Oe?Ct(Oe):Lc;function Af(C){return Cf(C)?Rc(C):Mc(C)}function vt(){return[]}function mt(){return!1}r.exports=$f})(Nu,Nu.exports);var r6=Nu.exports;function n6(r,e){return e=e||{},new Promise(function(t,n){var i=new XMLHttpRequest,a=[],c=[],u={},f=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:f,headers:{keys:function(){return a},entries:function(){return c},get:function(m){return u[m.toLowerCase()]},has:function(m){return m.toLowerCase()in u}}}};for(var h in i.open(e.method||"get",r,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(m,w,y){a.push(w=w.toLowerCase()),c.push([w,y]),u[w]=u[w]?u[w]+","+y:y}),t(f())},i.onerror=n,i.withCredentials=e.credentials=="include",e.headers)i.setRequestHeader(h,e.headers[h]);i.send(e.body||null)})}var i6=Object.freeze({__proto__:null,default:n6}),Qp=Pi(i6),s6=self.fetch||(self.fetch=Qp.default||Qp),o6=Object.defineProperty,Xp=Object.getOwnPropertySymbols,a6=Object.prototype.hasOwnProperty,c6=Object.prototype.propertyIsEnumerable,e1=(r,e,t)=>e in r?o6(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Er=(r,e)=>{for(var t in e||(e={}))a6.call(e,t)&&e1(r,t,e[t]);if(Xp)for(var t of Xp(e))c6.call(e,t)&&e1(r,t,e[t]);return r};function l6(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<r.length;i++){var a=r.charAt(i),c=a.charCodeAt(0);if(t[c]!==255)throw new TypeError(a+" is ambiguous");t[c]=i}var u=r.length,f=r.charAt(0),h=Math.log(u)/Math.log(256),m=Math.log(256)/Math.log(u);function w(S){if(S instanceof Uint8Array||(ArrayBuffer.isView(S)?S=new Uint8Array(S.buffer,S.byteOffset,S.byteLength):Array.isArray(S)&&(S=Uint8Array.from(S))),!(S instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(S.length===0)return"";for(var P=0,j=0,U=0,A=S.length;U!==A&&S[U]===0;)U++,P++;for(var T=(A-U)*m+1>>>0,O=new Uint8Array(T);U!==A;){for(var $=S[U],x=0,d=T-1;($!==0||x<j)&&d!==-1;d--,x++)$+=256*O[d]>>>0,O[d]=$%u>>>0,$=$/u>>>0;if($!==0)throw new Error("Non-zero carry");j=x,U++}for(var b=T-j;b!==T&&O[b]===0;)b++;for(var H=f.repeat(P);b<T;++b)H+=r.charAt(O[b]);return H}function y(S){if(typeof S!="string")throw new TypeError("Expected String");if(S.length===0)return new Uint8Array;var P=0;if(S[P]!==" "){for(var j=0,U=0;S[P]===f;)j++,P++;for(var A=(S.length-P)*h+1>>>0,T=new Uint8Array(A);S[P];){var O=t[S.charCodeAt(P)];if(O===255)return;for(var $=0,x=A-1;(O!==0||$<U)&&x!==-1;x--,$++)O+=u*T[x]>>>0,T[x]=O%256>>>0,O=O/256>>>0;if(O!==0)throw new Error("Non-zero carry");U=$,P++}if(S[P]!==" "){for(var d=A-U;d!==A&&T[d]===0;)d++;for(var b=new Uint8Array(j+(A-d)),H=j;d!==A;)b[H++]=T[d++];return b}}}function _(S){var P=y(S);if(P)return P;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:y,decode:_}}var u6=l6,h6=u6;const t1=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")},f6=r=>new TextEncoder().encode(r),d6=r=>new TextDecoder().decode(r);class p6{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class g6{constructor(e,t,n){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=n}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 r1(this,e)}}class m6{constructor(e){this.decoders=e}or(e){return r1(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const r1=(r,e)=>new m6(Er(Er({},r.decoders||{[r.prefix]:r}),e.decoders||{[e.prefix]:e}));class v6{constructor(e,t,n,i){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=i,this.encoder=new p6(e,t,n),this.decoder=new g6(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Ya=({name:r,prefix:e,encode:t,decode:n})=>new v6(r,e,t,n),Uo=({prefix:r,name:e,alphabet:t})=>{const{encode:n,decode:i}=h6(t,e);return Ya({prefix:r,name:e,encode:n,decode:a=>t1(i(a))})},y6=(r,e,t,n)=>{const i={};for(let m=0;m<e.length;++m)i[e[m]]=m;let a=r.length;for(;r[a-1]==="=";)--a;const c=new Uint8Array(a*t/8|0);let u=0,f=0,h=0;for(let m=0;m<a;++m){const w=i[r[m]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<t|w,u+=t,u>=8&&(u-=8,c[h++]=255&f>>u)}if(u>=t||255&f<<8-u)throw new SyntaxError("Unexpected end of data");return c},w6=(r,e,t)=>{const n=e[e.length-1]==="=",i=(1<<t)-1;let a="",c=0,u=0;for(let f=0;f<r.length;++f)for(u=u<<8|r[f],c+=8;c>t;)c-=t,a+=e[i&u>>c];if(c&&(a+=e[i&u<<t-c]),n)for(;a.length*t&7;)a+="=";return a},hr=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>Ya({prefix:e,name:r,encode(i){return w6(i,n,t)},decode(i){return y6(i,n,t,r)}}),b6=Ya({prefix:"\0",name:"identity",encode:r=>d6(r),decode:r=>f6(r)});var _6=Object.freeze({__proto__:null,identity:b6});const E6=hr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var x6=Object.freeze({__proto__:null,base2:E6});const I6=hr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var D6=Object.freeze({__proto__:null,base8:I6});const S6=Uo({prefix:"9",name:"base10",alphabet:"0123456789"});var O6=Object.freeze({__proto__:null,base10:S6});const C6=hr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),$6=hr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var A6=Object.freeze({__proto__:null,base16:C6,base16upper:$6});const P6=hr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),T6=hr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),R6=hr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),N6=hr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),L6=hr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),M6=hr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),U6=hr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),j6=hr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),F6=hr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var B6=Object.freeze({__proto__:null,base32:P6,base32upper:T6,base32pad:R6,base32padupper:N6,base32hex:L6,base32hexupper:M6,base32hexpad:U6,base32hexpadupper:j6,base32z:F6});const k6=Uo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),q6=Uo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var z6=Object.freeze({__proto__:null,base36:k6,base36upper:q6});const H6=Uo({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),W6=Uo({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var K6=Object.freeze({__proto__:null,base58btc:H6,base58flickr:W6});const V6=hr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),G6=hr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Y6=hr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Z6=hr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var J6=Object.freeze({__proto__:null,base64:V6,base64pad:G6,base64url:Y6,base64urlpad:Z6});const n1=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}"),Q6=n1.reduce((r,e,t)=>(r[t]=e,r),[]),X6=n1.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function e4(r){return r.reduce((e,t)=>(e+=Q6[t],e),"")}function t4(r){const e=[];for(const t of r){const n=X6[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}const r4=Ya({prefix:"\u{1F680}",name:"base256emoji",encode:e4,decode:t4});var n4=Object.freeze({__proto__:null,base256emoji:r4}),i4=s1,i1=128,s4=127,o4=~s4,a4=Math.pow(2,31);function s1(r,e,t){e=e||[],t=t||0;for(var n=t;r>=a4;)e[t++]=r&255|i1,r/=128;for(;r&o4;)e[t++]=r&255|i1,r>>>=7;return e[t]=r|0,s1.bytes=t-n+1,e}var c4=Lu,l4=128,o1=127;function Lu(r,n){var t=0,n=n||0,i=0,a=n,c,u=r.length;do{if(a>=u)throw Lu.bytes=0,new RangeError("Could not decode varint");c=r[a++],t+=i<28?(c&o1)<<i:(c&o1)*Math.pow(2,i),i+=7}while(c>=l4);return Lu.bytes=a-n,t}var u4=Math.pow(2,7),h4=Math.pow(2,14),f4=Math.pow(2,21),d4=Math.pow(2,28),p4=Math.pow(2,35),g4=Math.pow(2,42),m4=Math.pow(2,49),v4=Math.pow(2,56),y4=Math.pow(2,63),w4=function(r){return r<u4?1:r<h4?2:r<f4?3:r<d4?4:r<p4?5:r<g4?6:r<m4?7:r<v4?8:r<y4?9:10},b4={encode:i4,decode:c4,encodingLength:w4},a1=b4;const c1=(r,e,t=0)=>(a1.encode(r,e,t),e),l1=r=>a1.encodingLength(r),Mu=(r,e)=>{const t=e.byteLength,n=l1(r),i=n+l1(t),a=new Uint8Array(i+t);return c1(r,a,0),c1(t,a,n),a.set(e,i),new _4(r,t,e,a)};class _4{constructor(e,t,n,i){this.code=e,this.size=t,this.digest=n,this.bytes=i}}const u1=({name:r,code:e,encode:t})=>new E4(r,e,t);class E4{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Mu(this.code,t):t.then(n=>Mu(this.code,n))}else throw Error("Unknown type, must be binary type")}}const h1=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),x4=u1({name:"sha2-256",code:18,encode:h1("SHA-256")}),I4=u1({name:"sha2-512",code:19,encode:h1("SHA-512")});var D4=Object.freeze({__proto__:null,sha256:x4,sha512:I4});const f1=0,S4="identity",d1=t1;var O4=Object.freeze({__proto__:null,identity:{code:f1,name:S4,encode:d1,digest:r=>Mu(f1,d1(r))}});new TextEncoder,new TextDecoder;const p1=Er(Er(Er(Er(Er(Er(Er(Er(Er(Er({},_6),x6),D6),O6),A6),B6),z6),K6),J6),n4);Er(Er({},D4),O4);function g1(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function C4(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?g1(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function m1(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}const v1=m1("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Uu=m1("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=C4(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),$4=Er({utf8:v1,"utf-8":v1,hex:p1.base16,latin1:Uu,ascii:Uu,binary:Uu},p1);function A4(r,e="utf8"){const t=$4[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?g1(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}const y1="wc",P4=2,ju="core",si=`${y1}@2:${ju}:`,T4={name:ju,logger:"error"},R4={database:":memory:"},N4="crypto",w1="client_ed25519_seed",L4=me.ONE_DAY,M4="keychain",U4="0.3",j4="messages",F4="0.3",B4=me.SIX_HOURS,k4="publisher",b1="irn",q4="error",_1="wss://relay.walletconnect.com",E1="wss://relay.walletconnect.org",z4="relayer",Wr={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"},H4="_subscription",en={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},W4=me.ONE_SECOND,K4="2.11.3",V4=1e4,G4="0.3",Y4="WALLETCONNECT_CLIENT_ID",xn={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},Z4="subscription",J4="0.3",Q4=me.FIVE_SECONDS*1e3,X4="pairing",e8="0.3",jo={wc_pairingDelete:{req:{ttl:me.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:me.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:me.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:me.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:me.ONE_DAY,prompt:!1,tag:0},res:{ttl:me.ONE_DAY,prompt:!1,tag:0}}},$s={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},In={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},t8="history",r8="0.3",n8="expirer",tn={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},i8="0.3",Fu="verify-api",As="https://verify.walletconnect.com",Bu="https://verify.walletconnect.org",s8=[As,Bu],o8="echo",a8="https://echo.walletconnect.com";class c8{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=M4,this.version=U4,this.initialized=!1,this.storagePrefix=si,this.init=async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:a}=ue("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(a)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=Xe.generateChildLogger(t,this.name)}get context(){return Xe.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,Q0(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?X0(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class l8{constructor(e,t,n){this.core=e,this.logger=t,this.name=N4,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),a=Up(i);return Mp(a.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=X2();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const a=await this.getClientSeed(),c=Up(a),u=cu();return await dE(u,i,L4,c)},this.generateSharedKey=(i,a,c)=>{this.isInitialized();const u=this.getPrivateKey(i),f=e_(u,a);return this.setSymKey(f,c)},this.setSymKey=async(i,a)=>{this.isInitialized();const c=a||t_(i);return await this.keychain.set(c,i),c},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,a,c)=>{this.isInitialized();const u=V0(c),f=ji(a);if(G0(u)){const y=u.senderPublicKey,_=u.receiverPublicKey;i=await this.generateSharedKey(y,_)}const h=this.getSymKey(i),{type:m,senderPublicKey:w}=u;return n_({type:m,symKey:h,message:f,senderPublicKey:w})},this.decode=async(i,a,c)=>{this.isInitialized();const u=o_(a,c);if(G0(u)){const f=u.receiverPublicKey,h=u.senderPublicKey;i=await this.generateSharedKey(f,h)}try{const f=this.getSymKey(i),h=i_({symKey:f,encoded:a});return Ao(h)}catch(f){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(f)}},this.getPayloadType=i=>{const a=Ua(i);return Eo(a.type)},this.getPayloadSenderPublicKey=i=>{const a=Ua(i);return a.senderPublicKey?yr(a.senderPublicKey,wr):void 0},this.core=e,this.logger=Xe.generateChildLogger(t,this.name),this.keychain=n||new c8(this.core,this.logger)}get context(){return Xe.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(w1)}catch{e=cu(),await this.keychain.set(w1,e)}return A4(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class u8 extends H5{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=j4,this.version=F4,this.initialized=!1,this.storagePrefix=si,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const a=_s(i);let c=this.messages.get(n);return typeof c>"u"&&(c={}),typeof c[a]<"u"||(c[a]=i,this.messages.set(n,c),await this.persist()),a},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const a=this.get(n),c=_s(i);return typeof a[c]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Xe.generateChildLogger(e,this.name),this.core=t}get context(){return Xe.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,Q0(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?X0(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class h8 extends W5{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new lr.exports.EventEmitter,this.name=k4,this.queue=new Map,this.publishTimeout=me.toMiliseconds(me.ONE_MINUTE),this.failedPublishTimeout=me.toMiliseconds(me.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,a)=>{var c;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:a}});const u=a?.ttl||B4,f=uu(a),h=a?.prompt||!1,m=a?.tag||0,w=a?.id||qi().toString(),y={topic:n,message:i,opts:{ttl:u,relay:f,prompt:h,tag:m,id:w}},_=`Failed to publish payload, please try again. id:${w} tag:${m}`,S=Date.now();let P,j=1;try{for(;P===void 0;){if(Date.now()-S>this.publishTimeout)throw new Error(_);this.logger.trace({id:w,attempts:j},`publisher.publish - attempt ${j}`),P=await await Do(this.rpcPublish(n,i,u,f,h,m,w).catch(U=>this.logger.warn(U)),this.publishTimeout,_),j++,P||await new Promise(U=>setTimeout(U,this.failedPublishTimeout))}this.relayer.events.emit(Wr.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:w,topic:n,message:i,opts:a}})}catch(U){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(U),(c=a?.internal)!=null&&c.throwOnFailedPublish)throw U;this.queue.set(w,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=Xe.generateChildLogger(t,this.name),this.registerEventListeners()}get context(){return Xe.getLoggerContext(this.logger)}rpcPublish(e,t,n,i,a,c,u){var f,h,m,w;const y={method:ja(i.protocol).publish,params:{topic:e,message:t,ttl:n,prompt:a,tag:c},id:u};return br((f=y.params)==null?void 0:f.prompt)&&((h=y.params)==null||delete h.prompt),br((m=y.params)==null?void 0:m.tag)&&((w=y.params)==null||delete w.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:y}),this.relayer.request(y)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:t,message:n,opts:i}=e;await this.publish(t,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(Ss.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Wr.connection_stalled);return}this.checkQueue()}),this.relayer.on(Wr.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class f8{constructor(){this.map=new Map,this.set=(e,t)=>{const n=this.get(e);this.exists(e,t)||this.map.set(e,[...n,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 n=this.get(e);if(!this.exists(e,t))return;const i=n.filter(a=>a!==t);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var d8=Object.defineProperty,p8=Object.defineProperties,g8=Object.getOwnPropertyDescriptors,x1=Object.getOwnPropertySymbols,m8=Object.prototype.hasOwnProperty,v8=Object.prototype.propertyIsEnumerable,I1=(r,e,t)=>e in r?d8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Fo=(r,e)=>{for(var t in e||(e={}))m8.call(e,t)&&I1(r,t,e[t]);if(x1)for(var t of x1(e))v8.call(e,t)&&I1(r,t,e[t]);return r},ku=(r,e)=>p8(r,g8(e));class y8 extends G5{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new f8,this.events=new lr.exports.EventEmitter,this.name=Z4,this.version=J4,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=si,this.subscribeTimeout=me.toMiliseconds(me.ONE_MINUTE),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(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const a=uu(i),c={topic:n,relay:a};this.pending.set(n,c);const u=await this.rpcSubscribe(n,a);return typeof u=="string"&&(this.onSubscribe(u,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),u}catch(a){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(a),a}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((a,c)=>{const u=new me.Watch;u.start(i);const f=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(f),u.stop(i),a(!0)),u.elapsed(i)>=Q4&&(clearInterval(f),u.stop(i),c(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Xe.generateChildLogger(t,this.name),this.clientId=""}get context(){return Xe.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 n=!1;try{n=this.getSubscription(e).topic===t}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,t)))}async unsubscribeById(e,t,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}});try{const i=uu(n);await this.rpcUnsubscribe(e,t,i);const a=xt("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:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,t){const n={method:ja(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Do(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)?_s(e+this.clientId):null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Wr.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,n={method:ja(t.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Do(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(Wr.connection_stalled)}}rpcUnsubscribe(e,t,n){const i={method:ja(n.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,t){this.setSubscription(e,ku(Fo({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,Fo({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,n){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,Fo({},t)),this.topicMap.set(t.topic,e),this.events.emit(xn.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:n}=ue("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(xn.deleted,ku(Fo({},n),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(xn.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const n=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(n)}}this.events.emit(xn.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=ue("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);En(t)&&this.onBatchSubscribe(t.map((n,i)=>ku(Fo({},e[i]),{id:n})))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(Ss.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.events.on(xn.created,async e=>{const t=xn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(xn.deleted,async e=>{const t=xn.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}=ue("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 w8=Object.defineProperty,D1=Object.getOwnPropertySymbols,b8=Object.prototype.hasOwnProperty,_8=Object.prototype.propertyIsEnumerable,S1=(r,e,t)=>e in r?w8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,E8=(r,e)=>{for(var t in e||(e={}))b8.call(e,t)&&S1(r,t,e[t]);if(D1)for(var t of D1(e))_8.call(e,t)&&S1(r,t,e[t]);return r};class x8 extends K5{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new lr.exports.EventEmitter,this.name=z4,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=me.toMiliseconds(me.THIRTY_SECONDS+me.ONE_SECOND),this.request=async t=>{var n,i;this.logger.debug("Publishing Request Payload");const a=t.id||qi().toString();await this.toEstablishConnection();try{const c=this.provider.request(t);this.requestsInFlight.set(a,{promise:c,request:t}),this.logger.trace({id:a,method:t.method,topic:(n=t.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const u=await new Promise(async(f,h)=>{const m=()=>{h(new Error(`relayer.request - publish interrupted, id: ${a}`))};this.provider.on(en.disconnect,m);const w=await c;this.provider.off(en.disconnect,m),f(w)});return this.logger.trace({id:a,method:t.method,topic:(i=t.params)==null?void 0:i.topic},"relayer.request - published"),u}catch(c){throw this.logger.debug(`Failed to Publish Request: ${a}`),c}finally{this.requestsInFlight.delete(a)}},this.resetPingTimeout=()=>{if(xo())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var t,n,i;(i=(n=(t=this.provider)==null?void 0:t.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(t){this.logger.warn(t)}},this.onPayloadHandler=t=>{this.onProviderPayload(t),this.resetPingTimeout()},this.onConnectHandler=()=>{this.startPingTimeout(),this.events.emit(Wr.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(Wr.error,t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(en.payload,this.onPayloadHandler),this.provider.on(en.connect,this.onConnectHandler),this.provider.on(en.disconnect,this.onDisconnectHandler),this.provider.on(en.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Xe.generateChildLogger(e.logger,this.name):Xe.pino(Xe.getDefaultLoggerOptions({level:e.logger||q4})),this.messages=new u8(this.logger,e.core),this.subscriber=new y8(this,this.logger),this.publisher=new h8(this,this.logger),this.relayUrl=e?.relayUrl||_1,this.projectId=e.projectId,this.bundleId=f_(),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 ${E1}...`),await this.restartTransport(E1)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&this.subscriber.pending.size===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},V4)}get context(){return Xe.getLoggerContext(this.logger)}get connected(){var e,t,n;return((n=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:n.readyState)===1}get connecting(){var e,t,n;return((n=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:n.readyState)===0}async publish(e,t,n){this.isInitialized(),await this.publisher.publish(e,t,n),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now()})}async subscribe(e,t){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"",a;const c=u=>{u.topic===e&&(this.subscriber.off(xn.created,c),a())};return await Promise.all([new Promise(u=>{a=u,this.subscriber.on(xn.created,c)}),new Promise(async u=>{i=await this.subscriber.subscribe(e,t)||i,u()})]),i}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await Do(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect(),await this.createProvider()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(t,n)=>{const i=()=>{this.provider.off(en.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(en.disconnect,i),await Do(this.provider.connect(),me.toMiliseconds(me.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(a=>{n(a)}),await this.subscriber.start(),this.hasExperiencedNetworkDisruption=!1,t()})}catch(t){this.logger.error(t);const n=t;if(!this.isConnectionStalled(n.message))throw t}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await hp())throw new Error("No internet connection detected. Please restart your network and try again.")}startPingTimeout(){var e,t,n,i,a;if(xo())try{(t=(e=this.provider)==null?void 0:e.connection)!=null&&t.socket&&((a=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||a.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(c){this.logger.warn(c)}}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 jn(new t6(y_({sdkVersion:K4,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:n}=e;await this.messages.set(t,n)}async shouldIgnoreMessageEvent(e){const{topic:t,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const i=this.messages.has(t,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Ru(e)){if(!e.method.endsWith(H4))return;const t=e.params,{topic:n,message:i,publishedAt:a}=t.data,c={topic:n,message:i,publishedAt:a};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(E8({type:"event",event:t.id},c)),this.events.emit(t.id,c),await this.acknowledgePayload(e),await this.onMessageEvent(c)}else Ga(e)&&this.events.emit(Wr.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Wr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=Ka(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(en.payload,this.onPayloadHandler),this.provider.off(en.connect,this.onConnectHandler),this.provider.off(en.disconnect,this.onDisconnectHandler),this.provider.off(en.error,this.onProviderErrorHandler)}async registerEventListeners(){let e=await hp();f3(async t=>{e!==t&&(e=t,t?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.events.emit(Wr.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},me.toMiliseconds(W4))}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var I8=Object.defineProperty,O1=Object.getOwnPropertySymbols,D8=Object.prototype.hasOwnProperty,S8=Object.prototype.propertyIsEnumerable,C1=(r,e,t)=>e in r?I8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$1=(r,e)=>{for(var t in e||(e={}))D8.call(e,t)&&C1(r,t,e[t]);if(O1)for(var t of O1(e))S8.call(e,t)&&C1(r,t,e[t]);return r};class Za extends V5{constructor(e,t,n,i=si,a=void 0){super(e,t,n,i),this.core=e,this.logger=t,this.name=n,this.map=new Map,this.version=G4,this.cached=[],this.initialized=!1,this.storagePrefix=si,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(c=>{this.getKey&&c!==null&&!br(c)?this.map.set(this.getKey(c),c):z_(c)?this.map.set(c.id,c):H_(c)&&this.map.set(c.topic,c)}),this.cached=[],this.initialized=!0)},this.set=async(c,u)=>{this.isInitialized(),this.map.has(c)?await this.update(c,u):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:c,value:u}),this.map.set(c,u),await this.persist())},this.get=c=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:c}),this.getData(c)),this.getAll=c=>(this.isInitialized(),c?this.values.filter(u=>Object.keys(c).every(f=>r6(u[f],c[f]))):this.values),this.update=async(c,u)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:c,update:u});const f=$1($1({},this.getData(c)),u);this.map.set(c,f),await this.persist()},this.delete=async(c,u)=>{this.isInitialized(),this.map.has(c)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:c,reason:u}),this.map.delete(c),this.addToRecentlyDeleted(c),await this.persist())},this.logger=Xe.generateChildLogger(t,this.name),this.storagePrefix=i,this.getKey=a}get context(){return Xe.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())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:i}=ue("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ue("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}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}=ue("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}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class O8{constructor(e,t){this.core=e,this.logger=t,this.name=X4,this.version=e8,this.events=new lr.exports,this.initialized=!1,this.storagePrefix=si,this.ignoredPayloadTypes=[Li],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:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();const n=cu(),i=await this.core.crypto.setSymKey(n),a=Hr(me.FIVE_MINUTES),c={protocol:b1},u={topic:i,expiry:a,relay:c,active:!1},f=N_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:c,expiryTimestamp:a});return await this.pairings.set(i,u),await this.core.relayer.subscribe(i),this.core.expirer.set(i,a),{topic:i,uri:f}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:i,symKey:a,relay:c,expiryTimestamp:u}=ip(n.uri);let f;if(this.pairings.keys.includes(i)&&(f=this.pairings.get(i),f.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);const h=u||Hr(me.FIVE_MINUTES),m={topic:i,relay:c,expiry:h,active:!1};return await this.pairings.set(i,m),this.core.expirer.set(i,h),n.activatePairing&&await this.activate({topic:i}),this.events.emit($s.create,m),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(a,i),await this.core.relayer.subscribe(i,{relay:c}),m},this.activate=async({topic:n})=>{this.isInitialized();const i=Hr(me.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const a=await this.sendRequest(i,"wc_pairingPing",{}),{done:c,resolve:u,reject:f}=Is();this.events.once(gt("pairing_ping",a),({error:h})=>{h?f(h):u()}),await c()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",xt("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,a)=>{const c=Cs(i,a),u=await this.core.crypto.encode(n,c),f=jo[i].req;return this.core.history.set(n,c),this.core.relayer.publish(n,u,f),c.id},this.sendResult=async(n,i,a)=>{const c=Ka(n,a),u=await this.core.crypto.encode(i,c),f=await this.core.history.get(i,n),h=jo[f.request.method].res;await this.core.relayer.publish(i,u,h),await this.core.history.resolve(c)},this.sendError=async(n,i,a)=>{const c=Va(n,a),u=await this.core.crypto.encode(i,c),f=await this.core.history.get(i,n),h=jo[f.request.method]?jo[f.request.method].res:jo.unregistered_method.res;await this.core.relayer.publish(i,u,h),await this.core.history.resolve(c)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,xt("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>ii(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:a}=n;switch(a.method){case"wc_pairingPing":return this.onPairingPingRequest(i,a);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,a);default:return this.onUnknownRpcMethodRequest(i,a)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:a}=n,c=(await this.core.history.get(i,a.id)).request.method;switch(c){case"wc_pairingPing":return this.onPairingPingResponse(i,a);default:return this.onUnknownRpcMethodResponse(c)}},this.onPairingPingRequest=async(n,i)=>{const{id:a}=i;try{this.isValidPing({topic:n}),await this.sendResult(a,n,!0),this.events.emit($s.ping,{id:a,topic:n})}catch(c){await this.sendError(a,n,c),this.logger.error(c)}},this.onPairingPingResponse=(n,i)=>{const{id:a}=i;setTimeout(()=>{Un(i)?this.events.emit(gt("pairing_ping",a),{}):pn(i)&&this.events.emit(gt("pairing_ping",a),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:a}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit($s.delete,{id:a,topic:n})}catch(c){await this.sendError(a,n,c),this.logger.error(c)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:a,method:c}=i;try{if(this.registeredMethods.includes(c))return;const u=xt("WC_METHOD_UNSUPPORTED",c);await this.sendError(a,n,u),this.logger.error(u)}catch(u){await this.sendError(a,n,u),this.logger.error(u)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(xt("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{var i;if(!Tr(n)){const{message:c}=ue("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(c)}if(!q_(n.uri)){const{message:c}=ue("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(c)}const a=ip(n.uri);if(!((i=a?.relay)!=null&&i.protocol)){const{message:c}=ue("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(c)}if(!(a!=null&&a.symKey)){const{message:c}=ue("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(c)}if(a!=null&&a.expiryTimestamp&&me.toMiliseconds(a?.expiryTimestamp)<Date.now()){const{message:c}=ue("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}},this.isValidPing=async n=>{if(!Tr(n)){const{message:a}=ue("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(a)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!Tr(n)){const{message:a}=ue("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(a)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ir(n,!1)){const{message:i}=ue("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ue("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ii(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ue("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Xe.generateChildLogger(t,this.name),this.pairings=new Za(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Xe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Wr.message,async e=>{const{topic:t,message:n}=e;if(!this.pairings.keys.includes(t)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const i=await this.core.crypto.decode(t,n);try{Ru(i)?(this.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):Ga(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:t,payload:i}),this.core.history.delete(t,i.id))}catch(a){this.logger.error(a)}})}registerExpirerEvents(){this.core.expirer.on(tn.expired,async e=>{const{topic:t}=tp(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit($s.expire,{topic:t}))})}}class C8 extends z5{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new lr.exports.EventEmitter,this.name=t8,this.version=r8,this.cached=[],this.initialized=!1,this.storagePrefix=si,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,a)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:a}),this.records.has(i.id))return;const c={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:a,expiry:Hr(me.THIRTY_DAYS)};this.records.set(c.id,c),this.events.emit(In.created,c)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=pn(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(In.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(a=>{if(a.topic===n){if(typeof i<"u"&&a.id!==i)return;this.records.delete(a.id),this.events.emit(In.deleted,a)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Xe.generateChildLogger(t,this.name)}get context(){return Xe.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 n={topic:t.topic,request:Cs(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(n)}),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:n}=ue("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(In.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=ue("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(In.created,e=>{const t=In.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(In.updated,e=>{const t=In.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(In.deleted,e=>{const t=In.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.core.heartbeat.on(Ss.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{me.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}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class $8 extends Y5{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new lr.exports.EventEmitter,this.name=n8,this.version=i8,this.cached=[],this.initialized=!1,this.storagePrefix=si,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const a=this.formatTarget(n),c={target:a,expiry:i};this.expirations.set(a,c),this.checkExpiry(a,c),this.events.emit(tn.created,{target:a,expiration:c})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),a=this.getExpiration(i);this.expirations.delete(i),this.events.emit(tn.deleted,{target:i,expiration:a})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Xe.generateChildLogger(t,this.name)}get context(){return Xe.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 w_(e);if(typeof e=="number")return b_(e);const{message:t}=ue("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(tn.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=ue("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:n}=ue("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return t}checkExpiry(e,t){const{expiry:n}=t;me.toMiliseconds(n)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(tn.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(Ss.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(tn.created,e=>{const t=tn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(tn.expired,e=>{const t=tn.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(tn.deleted,e=>{const t=tn.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class A8 extends Z5{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.name=Fu,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async n=>{if(this.verifyDisabled||Es()||!xs())return;const i=this.getVerifyUrl(n?.verifyUrl);this.verifyUrl!==i&&this.removeIframe(),this.verifyUrl=i;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=Bu;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 n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";const i=this.getVerifyUrl(n?.verifyUrl);let a;try{a=await this.fetchAttestation(n.attestationId,i)}catch(c){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(c),a=await this.fetchAttestation(n.attestationId,Bu)}return a},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);const a=this.startAbortTimer(me.ONE_SECOND*2),c=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(a),c.status===200?await c.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n;const i=a=>{a.data==="verify_ready"&&(this.onInit(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(a=>{const c=document.getElementById(Fu);if(c)return this.iframe=c,this.onInit(),a();window.addEventListener("message",i);const u=document.createElement("iframe");u.id=Fu,u.src=`${this.verifyUrl}/${this.projectId}`,u.style.display="none",document.body.append(u),this.iframe=u,n=a}),new Promise((a,c)=>setTimeout(()=>{window.removeEventListener("message",i),c("verify iframe load timeout")},me.toMiliseconds(me.FIVE_SECONDS)))])},this.onInit=()=>{this.initialized=!0,this.processQueue()},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=n=>{let i=n||As;return s8.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${As}`),i=As),i},this.logger=Xe.generateChildLogger(t,this.name),this.verifyUrl=As,this.abortController=new AbortController,this.isDevEnv=xo()&&process.env.IS_VITEST}get context(){return Xe.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),me.toMiliseconds(e))}}class P8 extends J5{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=o8,this.registerDeviceToken=async n=>{const{clientId:i,token:a,notificationType:c,enableEncrypted:u=!1}=n,f=`${a8}/${this.projectId}/clients`;await s6(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:c,token:a,always_raw:u})})},this.logger=Xe.generateChildLogger(t,this.context)}}var T8=Object.defineProperty,A1=Object.getOwnPropertySymbols,R8=Object.prototype.hasOwnProperty,N8=Object.prototype.propertyIsEnumerable,P1=(r,e,t)=>e in r?T8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,T1=(r,e)=>{for(var t in e||(e={}))R8.call(e,t)&&P1(r,t,e[t]);if(A1)for(var t of A1(e))N8.call(e,t)&&P1(r,t,e[t]);return r};class qu extends q5{constructor(e){super(e),this.protocol=y1,this.version=P4,this.name=ju,this.events=new lr.exports.EventEmitter,this.initialized=!1,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||_1,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Xe.pino(Xe.getDefaultLoggerOptions({level:e?.logger||T4.logger}));this.logger=Xe.generateChildLogger(t,this.name),this.heartbeat=new Ss.HeartBeat,this.crypto=new l8(this,this.logger,e?.keychain),this.history=new C8(this,this.logger),this.expirer=new $8(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new K3(T1(T1({},R4),e?.storageOptions)),this.relayer=new x8({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new O8(this,this.logger),this.verify=new A8(this.projectId||"",this.logger),this.echoClient=new P8(this.projectId||"",this.logger)}static async init(e){const t=new qu(e);await t.initialize();const n=await t.crypto.getClientId();return await t.storage.setItem(Y4,n),t}get context(){return Xe.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 L8=qu,R1="wc",N1=2,L1="client",zu=`${R1}@${N1}:${L1}:`,Hu={name:L1,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},M1="WALLETCONNECT_DEEPLINK_CHOICE",M8="proposal",U1="Proposal expired",U8="session",Ja=me.SEVEN_DAYS,j8="engine",Fn={wc_sessionPropose:{req:{ttl:me.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:me.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:me.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:me.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:me.ONE_DAY,prompt:!1,tag:1104},res:{ttl:me.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:me.ONE_DAY,prompt:!1,tag:1106},res:{ttl:me.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:me.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:me.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:me.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:me.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:me.ONE_DAY,prompt:!1,tag:1112},res:{ttl:me.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:me.ONE_DAY,prompt:!1,tag:1114},res:{ttl:me.ONE_DAY,prompt:!1,tag:1115}}},Wu={min:me.FIVE_MINUTES,max:me.SEVEN_DAYS},Bn={idle:"IDLE",active:"ACTIVE"},F8="request",B8=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var k8=Object.defineProperty,q8=Object.defineProperties,z8=Object.getOwnPropertyDescriptors,j1=Object.getOwnPropertySymbols,H8=Object.prototype.hasOwnProperty,W8=Object.prototype.propertyIsEnumerable,F1=(r,e,t)=>e in r?k8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xr=(r,e)=>{for(var t in e||(e={}))H8.call(e,t)&&F1(r,t,e[t]);if(j1)for(var t of j1(e))W8.call(e,t)&&F1(r,t,e[t]);return r},Ps=(r,e)=>q8(r,z8(e));class K8 extends X5{constructor(e){super(e),this.name=j8,this.events=new lr.exports,this.initialized=!1,this.ignoredPayloadTypes=[Li],this.requestQueue={state:Bn.idle,queue:[]},this.sessionRequestQueue={state:Bn.idle,queue:[]},this.requestQueueDelay=me.ONE_SECOND,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(Fn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},me.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{await this.isInitialized();const n=Ps(xr({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:a,optionalNamespaces:c,sessionProperties:u,relays:f}=n;let h=i,m,w=!1;try{h&&(w=this.client.core.pairing.pairings.get(h).active)}catch(O){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),O}if(!h||!w){const{topic:O,uri:$}=await this.client.core.pairing.create();h=O,m=$}if(!h){const{message:O}=ue("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(O)}const y=await this.client.core.crypto.generateKeyPair(),_=Fn.wc_sessionPropose.req.ttl||me.FIVE_MINUTES,S=Hr(_),P=xr({requiredNamespaces:a,optionalNamespaces:c,relays:f??[{protocol:b1}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:S},u&&{sessionProperties:u}),{reject:j,resolve:U,done:A}=Is(_,U1);this.events.once(gt("session_connect"),async({error:O,session:$})=>{if(O)j(O);else if($){$.self.publicKey=y;const x=Ps(xr({},$),{requiredNamespaces:P.requiredNamespaces,optionalNamespaces:P.optionalNamespaces});await this.client.session.set($.topic,x),await this.setExpiry($.topic,$.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:$.peer.metadata}),U(x)}});const T=await this.sendRequest({topic:h,method:"wc_sessionPropose",params:P,throwOnFailedPublish:!0});return await this.setProposal(T,xr({id:T},P)),{uri:m,approval:A}},this.pair=async t=>{await this.isInitialized();try{return await this.client.core.pairing.pair(t)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async t=>{await this.isInitialized();try{await this.isValidApprove(t)}catch(U){throw this.client.logger.error("approve() -> isValidApprove() failed"),U}const{id:n,relayProtocol:i,namespaces:a,sessionProperties:c}=t;let u;try{u=this.client.proposal.get(n)}catch(U){throw this.client.logger.error(`approve() -> proposal.get(${n}) failed`),U}let{pairingTopic:f,proposer:h,requiredNamespaces:m,optionalNamespaces:w}=u;f=f||"";const y=await this.client.core.crypto.generateKeyPair(),_=h.publicKey,S=await this.client.core.crypto.generateSharedKey(y,_),P=xr({relay:{protocol:i??"irn"},namespaces:a,pairingTopic:f,controller:{publicKey:y,metadata:this.client.metadata},expiry:Hr(Ja)},c&&{sessionProperties:c});await this.client.core.relayer.subscribe(S);const j=Ps(xr({},P),{topic:S,requiredNamespaces:m,optionalNamespaces:w,pairingTopic:f,acknowledged:!1,self:P.controller,peer:{publicKey:h.publicKey,metadata:h.metadata},controller:y});await this.client.session.set(S,j);try{await this.sendResult({id:n,topic:f,result:{relay:{protocol:i??"irn"},responderPublicKey:y},throwOnFailedPublish:!0}),await this.sendRequest({topic:S,method:"wc_sessionSettle",params:P,throwOnFailedPublish:!0})}catch(U){throw this.client.logger.error(U),this.client.session.delete(S,xt("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(S),U}return await this.client.core.pairing.updateMetadata({topic:f,metadata:h.metadata}),await this.client.proposal.delete(n,xt("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:f}),await this.setExpiry(S,Hr(Ja)),{topic:S,acknowledged:()=>new Promise(U=>setTimeout(()=>U(this.client.session.get(S)),500))}},this.reject=async t=>{await this.isInitialized();try{await this.isValidReject(t)}catch(c){throw this.client.logger.error("reject() -> isValidReject() failed"),c}const{id:n,reason:i}=t;let a;try{a=this.client.proposal.get(n).pairingTopic}catch(c){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),c}a&&(await this.sendError(n,a,i),await this.client.proposal.delete(n,xt("USER_DISCONNECTED")))},this.update=async t=>{await this.isInitialized();try{await this.isValidUpdate(t)}catch(w){throw this.client.logger.error("update() -> isValidUpdate() failed"),w}const{topic:n,namespaces:i}=t,{done:a,resolve:c,reject:u}=Is(),f=Os(),h=qi().toString(),m=this.client.session.get(n).namespaces;return this.events.once(gt("session_update",f),async({error:w})=>{w?u(w):(await this.client.session.update(n,{namespaces:i}),c())}),this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:f,relayRpcId:h}).catch(w=>{this.client.logger.error(w),this.client.session.update(n,{namespaces:m}),u(w)}),{acknowledged:a}},this.extend=async t=>{await this.isInitialized();try{await this.isValidExtend(t)}catch(f){throw this.client.logger.error("extend() -> isValidExtend() failed"),f}const{topic:n}=t,i=Os(),{done:a,resolve:c,reject:u}=Is();return this.events.once(gt("session_extend",i),({error:f})=>{f?u(f):c()}),await this.setExpiry(n,Hr(Ja)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(f=>{u(f)}),{acknowledged:a}},this.request=async t=>{await this.isInitialized();try{await this.isValidRequest(t)}catch(y){throw this.client.logger.error("request() -> isValidRequest() failed"),y}const{chainId:n,request:i,topic:a,expiry:c=Fn.wc_sessionRequest.req.ttl}=t,u=Os(),f=qi().toString(),{done:h,resolve:m,reject:w}=Is(c,"Request expired. Please try again.");return this.events.once(gt("session_request",u),({error:y,result:_})=>{y?w(y):m(_)}),await Promise.all([new Promise(async y=>{await this.sendRequest({clientRpcId:u,relayRpcId:f,topic:a,method:"wc_sessionRequest",params:{request:Ps(xr({},i),{expiryTimestamp:Hr(c)}),chainId:n},expiry:c,throwOnFailedPublish:!0}).catch(_=>w(_)),this.client.events.emit("session_request_sent",{topic:a,request:i,chainId:n,id:u}),y()}),new Promise(async y=>{const _=await E_(this.client.core.storage,M1);__({id:u,topic:a,wcDeepLink:_}),y()}),h()]).then(y=>y[2])},this.respond=async t=>{await this.isInitialized(),await this.isValidRespond(t);const{topic:n,response:i}=t,{id:a}=i;Un(i)?await this.sendResult({id:a,topic:n,result:i.result,throwOnFailedPublish:!0}):pn(i)&&await this.sendError(a,n,i.error),this.cleanupAfterResponse(t)},this.ping=async t=>{await this.isInitialized();try{await this.isValidPing(t)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=t;if(this.client.session.keys.includes(n)){const i=Os(),a=qi().toString(),{done:c,resolve:u,reject:f}=Is();this.events.once(gt("session_ping",i),({error:h})=>{h?f(h):u()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:a}),c()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async t=>{await this.isInitialized(),await this.isValidEmit(t);const{topic:n,event:i,chainId:a}=t,c=qi().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:a},throwOnFailedPublish:!0,relayRpcId:c})},this.disconnect=async t=>{await this.isInitialized(),await this.isValidDisconnect(t);const{topic:n}=t;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:xt("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ue("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(n=>B_(n,t))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const n=this.client.core.pairing.pairings.get(t.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(a=>{var c,u;return((c=a.peerMetadata)==null?void 0:c.url)&&((u=a.peerMetadata)==null?void 0:u.url)===t.peer.metadata.url&&a.topic&&a.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(a=>this.client.core.pairing.disconnect({topic:a.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async t=>{const{topic:n,expirerHasDeleted:i=!1,emitEvent:a=!0,id:c=0}=t,{self:u}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,xt("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),i||this.client.core.expirer.del(n),this.client.core.storage.removeItem(M1).catch(f=>this.client.logger.warn(f)),this.getPendingSessionRequests().forEach(f=>{f.topic===n&&this.deletePendingSessionRequest(f.id,xt("USER_DISCONNECTED"))}),a&&this.client.events.emit("session_delete",{id:c,topic:n})},this.deleteProposal=async(t,n)=>{await Promise.all([this.client.proposal.delete(t,xt("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"proposal")},this.deletePendingSessionRequest=async(t,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,n),i?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(a=>a.id!==t),i&&(this.sessionRequestQueue.state=Bn.idle,this.client.events.emit("session_request_expire",{id:t}))},this.setExpiry=async(t,n)=>{this.client.session.keys.includes(t)&&await this.client.session.update(t,{expiry:n}),this.client.core.expirer.set(t,n)},this.setProposal=async(t,n)=>{await this.client.proposal.set(t,n),this.client.core.expirer.set(t,Hr(Fn.wc_sessionPropose.req.ttl))},this.setPendingSessionRequest=async t=>{const{id:n,topic:i,params:a,verifyContext:c}=t,u=a.request.expiryTimestamp||Hr(Fn.wc_sessionRequest.req.ttl);await this.client.pendingRequest.set(n,{id:n,topic:i,params:a,verifyContext:c}),u&&this.client.core.expirer.set(n,u)},this.sendRequest=async t=>{const{topic:n,method:i,params:a,expiry:c,relayRpcId:u,clientRpcId:f,throwOnFailedPublish:h}=t,m=Cs(i,a,f);if(xs()&&B8.includes(i)){const _=_s(JSON.stringify(m));this.client.core.verify.register({attestationId:_})}let w;try{w=await this.client.core.crypto.encode(n,m)}catch(_){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),_}const y=Fn[i].req;return c&&(y.ttl=c),u&&(y.id=u),this.client.core.history.set(n,m),h?(y.internal=Ps(xr({},y.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,w,y)):this.client.core.relayer.publish(n,w,y).catch(_=>this.client.logger.error(_)),m.id},this.sendResult=async t=>{const{id:n,topic:i,result:a,throwOnFailedPublish:c}=t,u=Ka(n,a);let f;try{f=await this.client.core.crypto.encode(i,u)}catch(w){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),w}let h;try{h=await this.client.core.history.get(i,n)}catch(w){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),w}const m=Fn[h.request.method].res;c?(m.internal=Ps(xr({},m.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,f,m)):this.client.core.relayer.publish(i,f,m).catch(w=>this.client.logger.error(w)),await this.client.core.history.resolve(u)},this.sendError=async(t,n,i)=>{const a=Va(t,i);let c;try{c=await this.client.core.crypto.encode(n,a)}catch(h){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),h}let u;try{u=await this.client.core.history.get(n,t)}catch(h){throw this.client.logger.error(`sendError() -> history.get(${n}, ${t}) failed`),h}const f=Fn[u.request.method].res;this.client.core.relayer.publish(n,c,f),await this.client.core.history.resolve(a)},this.cleanup=async()=>{const t=[],n=[];this.client.session.getAll().forEach(i=>{let a=!1;ii(i.expiry)&&(a=!0),this.client.core.crypto.keychain.has(i.topic)||(a=!0),a&&t.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{ii(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...t.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Bn.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=Bn.active;const t=this.requestQueue.queue.shift();if(t)try{this.processRequest(t),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Bn.idle},this.processRequest=t=>{const{topic:n,payload:i}=t,a=i.method;switch(a){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${a}`)}},this.onRelayEventResponse=async t=>{const{topic:n,payload:i}=t,a=(await this.client.core.history.get(n,i.id)).request.method;switch(a){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${a}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:n}=t,{message:i}=ue("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.onSessionProposeRequest=async(t,n)=>{const{params:i,id:a}=n;try{this.isValidConnect(xr({},n.params));const c=i.expiryTimestamp||Hr(Fn.wc_sessionPropose.req.ttl),u=xr({id:a,pairingTopic:t,expiryTimestamp:c},i);await this.setProposal(a,u);const f=_s(JSON.stringify(n)),h=await this.getVerifyContext(f,u.proposer.metadata);this.client.events.emit("session_proposal",{id:a,params:u,verifyContext:h})}catch(c){await this.sendError(a,t,c),this.client.logger.error(c)}},this.onSessionProposeResponse=async(t,n)=>{const{id:i}=n;if(Un(n)){const{result:a}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:a});const c=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});const u=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const f=a.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:f});const h=await this.client.core.crypto.generateSharedKey(u,f);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:h});const m=await this.client.core.relayer.subscribe(h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:m}),await this.client.core.pairing.activate({topic:t})}else if(pn(n)){await this.client.proposal.delete(i,xt("USER_DISCONNECTED"));const a=gt("session_connect");if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners, 954`);this.events.emit(gt("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(t,n)=>{const{id:i,params:a}=n;try{this.isValidSessionSettleRequest(a);const{relay:c,controller:u,expiry:f,namespaces:h,sessionProperties:m,pairingTopic:w}=n.params,y=xr({topic:t,relay:c,expiry:f,namespaces:h,acknowledged:!0,pairingTopic:w,requiredNamespaces:{},optionalNamespaces:{},controller:u.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:u.publicKey,metadata:u.metadata}},m&&{sessionProperties:m});await this.sendResult({id:n.id,topic:t,result:!0,throwOnFailedPublish:!0});const _=gt("session_connect");if(this.events.listenerCount(_)===0)throw new Error(`emitting ${_} without any listeners 997`);this.events.emit(gt("session_connect"),{session:y}),this.cleanupDuplicatePairings(y)}catch(c){await this.sendError(i,t,c),this.client.logger.error(c)}},this.onSessionSettleResponse=async(t,n)=>{const{id:i}=n;Un(n)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(gt("session_approve",i),{})):pn(n)&&(await this.client.session.delete(t,xt("USER_DISCONNECTED")),this.events.emit(gt("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(t,n)=>{const{params:i,id:a}=n;try{const c=`${t}_session_update`,u=Co.get(c);if(u&&this.isRequestOutOfSync(u,a)){this.client.logger.info(`Discarding out of sync request - ${a}`),this.sendError(a,t,xt("INVALID_UPDATE_REQUEST"));return}this.isValidUpdate(xr({topic:t},i));try{Co.set(c,a),await this.client.session.update(t,{namespaces:i.namespaces}),await this.sendResult({id:a,topic:t,result:!0,throwOnFailedPublish:!0})}catch(f){throw Co.delete(c),f}this.client.events.emit("session_update",{id:a,topic:t,params:i})}catch(c){await this.sendError(a,t,c),this.client.logger.error(c)}},this.isRequestOutOfSync=(t,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(t.toString().slice(0,-3)),this.onSessionUpdateResponse=(t,n)=>{const{id:i}=n,a=gt("session_update",i);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);Un(n)?this.events.emit(gt("session_update",i),{}):pn(n)&&this.events.emit(gt("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(t,n)=>{const{id:i}=n;try{this.isValidExtend({topic:t}),await this.setExpiry(t,Hr(Ja)),await this.sendResult({id:i,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:t})}catch(a){await this.sendError(i,t,a),this.client.logger.error(a)}},this.onSessionExtendResponse=(t,n)=>{const{id:i}=n,a=gt("session_extend",i);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);Un(n)?this.events.emit(gt("session_extend",i),{}):pn(n)&&this.events.emit(gt("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(t,n)=>{const{id:i}=n;try{this.isValidPing({topic:t}),await this.sendResult({id:i,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:t})}catch(a){await this.sendError(i,t,a),this.client.logger.error(a)}},this.onSessionPingResponse=(t,n)=>{const{id:i}=n,a=gt("session_ping",i);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);setTimeout(()=>{Un(n)?this.events.emit(gt("session_ping",i),{}):pn(n)&&this.events.emit(gt("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(t,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:t,reason:n.params}),await Promise.all([new Promise(a=>{this.client.core.relayer.once(Wr.publish,async()=>{a(await this.deleteSession({topic:t,id:i}))})}),this.sendResult({id:i,topic:t,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:t,error:xt("USER_DISCONNECTED")})])}catch(a){this.client.logger.error(a)}},this.onSessionRequest=async(t,n)=>{const{id:i,params:a}=n;try{this.isValidRequest(xr({topic:t},a));const c=_s(JSON.stringify(Cs("wc_sessionRequest",a,i))),u=this.client.session.get(t),f=await this.getVerifyContext(c,u.peer.metadata),h={id:i,topic:t,params:a,verifyContext:f};await this.setPendingSessionRequest(h),this.addSessionRequestToSessionRequestQueue(h),this.processSessionRequestQueue()}catch(c){await this.sendError(i,t,c),this.client.logger.error(c)}},this.onSessionRequestResponse=(t,n)=>{const{id:i}=n,a=gt("session_request",i);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);Un(n)?this.events.emit(gt("session_request",i),{result:n.result}):pn(n)&&this.events.emit(gt("session_request",i),{error:n.error})},this.onSessionEventRequest=async(t,n)=>{const{id:i,params:a}=n;try{const c=`${t}_session_event_${a.event.name}`,u=Co.get(c);if(u&&this.isRequestOutOfSync(u,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(xr({topic:t},a)),this.client.events.emit("session_event",{id:i,topic:t,params:a}),Co.set(c,i)}catch(c){await this.sendError(i,t,c),this.client.logger.error(c)}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Bn.idle,this.processSessionRequestQueue()},me.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:t,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(a=>a.topic===t&&a.request.method==="wc_sessionRequest").forEach(a=>{const c=a.request.id,u=gt("session_request",c);if(this.events.listenerCount(u)===0)throw new Error(`emitting ${u} without any listeners`);this.events.emit(gt("session_request",a.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Bn.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=Bn.active,this.client.events.emit("session_request",t)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=t=>{if(t.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===t.topic);n&&this.onSessionProposeRequest(t.topic,Cs("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id))},this.isValidConnect=async t=>{if(!Tr(t)){const{message:f}=ue("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(f)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:a,sessionProperties:c,relays:u}=t;if(br(n)||await this.isValidPairingTopic(n),!Q_(u,!0)){const{message:f}=ue("MISSING_OR_INVALID",`connect() relays: ${u}`);throw new Error(f)}!br(i)&&Oo(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!br(a)&&Oo(a)!==0&&this.validateNamespaces(a,"optionalNamespaces"),br(c)||this.validateSessionProps(c,"sessionProperties")},this.validateNamespaces=(t,n)=>{const i=J_(t,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async t=>{if(!Tr(t))throw new Error(ue("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:n,namespaces:i,relayProtocol:a,sessionProperties:c}=t;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const u=this.client.proposal.get(n),f=du(i,"approve()");if(f)throw new Error(f.message);const h=lp(u.requiredNamespaces,i,"approve()");if(h)throw new Error(h.message);if(!ir(a,!0)){const{message:m}=ue("MISSING_OR_INVALID",`approve() relayProtocol: ${a}`);throw new Error(m)}br(c)||this.validateSessionProps(c,"sessionProperties")},this.isValidReject=async t=>{if(!Tr(t)){const{message:a}=ue("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(a)}const{id:n,reason:i}=t;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!e3(i)){const{message:a}=ue("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidSessionSettleRequest=t=>{if(!Tr(t)){const{message:h}=ue("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(h)}const{relay:n,controller:i,namespaces:a,expiry:c}=t;if(!ap(n)){const{message:h}=ue("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}const u=W_(i,"onSessionSettleRequest()");if(u)throw new Error(u.message);const f=du(a,"onSessionSettleRequest()");if(f)throw new Error(f.message);if(ii(c)){const{message:h}=ue("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async t=>{if(!Tr(t)){const{message:f}=ue("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(f)}const{topic:n,namespaces:i}=t;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const a=this.client.session.get(n),c=du(i,"update()");if(c)throw new Error(c.message);const u=lp(a.requiredNamespaces,i,"update()");if(u)throw new Error(u.message)},this.isValidExtend=async t=>{if(!Tr(t)){const{message:i}=ue("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(i)}const{topic:n}=t;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async t=>{if(!Tr(t)){const{message:f}=ue("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(f)}const{topic:n,request:i,chainId:a,expiry:c}=t;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:u}=this.client.session.get(n);if(!cp(u,a)){const{message:f}=ue("MISSING_OR_INVALID",`request() chainId: ${a}`);throw new Error(f)}if(!t3(i)){const{message:f}=ue("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(f)}if(!i3(u,a,i.method)){const{message:f}=ue("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(f)}if(c&&!c3(c,Wu)){const{message:f}=ue("MISSING_OR_INVALID",`request() expiry: ${c}. Expiry must be a number (in seconds) between ${Wu.min} and ${Wu.max}`);throw new Error(f)}},this.isValidRespond=async t=>{var n;if(!Tr(t)){const{message:c}=ue("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(c)}const{topic:i,response:a}=t;try{await this.isValidSessionTopic(i)}catch(c){throw(n=t?.response)!=null&&n.id&&this.cleanupAfterResponse(t),c}if(!r3(a)){const{message:c}=ue("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(a)}`);throw new Error(c)}},this.isValidPing=async t=>{if(!Tr(t)){const{message:i}=ue("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(i)}const{topic:n}=t;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async t=>{if(!Tr(t)){const{message:u}=ue("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(u)}const{topic:n,event:i,chainId:a}=t;await this.isValidSessionTopic(n);const{namespaces:c}=this.client.session.get(n);if(!cp(c,a)){const{message:u}=ue("MISSING_OR_INVALID",`emit() chainId: ${a}`);throw new Error(u)}if(!n3(i)){const{message:u}=ue("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(u)}if(!s3(c,a,i.name)){const{message:u}=ue("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(u)}},this.isValidDisconnect=async t=>{if(!Tr(t)){const{message:i}=ue("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(i)}const{topic:n}=t;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(t,n)=>{const i={verified:{verifyUrl:n.verifyUrl||As,validation:"UNKNOWN",origin:n.url||""}};try{const a=await this.client.core.verify.resolve({attestationId:t,verifyUrl:n.verifyUrl});a&&(i.verified.origin=a.origin,i.verified.isScam=a.isScam,i.verified.validation=a.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(a){this.client.logger.info(a)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(t,n)=>{Object.values(t).forEach(i=>{if(!ir(i,!1)){const{message:a}=ue("MISSING_OR_INVALID",`${n} must be in Record<string, string> format. Received: ${JSON.stringify(i)}`);throw new Error(a)}})},this.addToRecentlyDeleted=(t,n)=>{if(this.recentlyDeletedMap.set(t,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const a=this.recentlyDeletedLimit/2;for(const c of this.recentlyDeletedMap.keys()){if(i++>=a)break;this.recentlyDeletedMap.delete(c)}}},this.checkRecentlyDeleted=t=>{const n=this.recentlyDeletedMap.get(t);if(n){const{message:i}=ue("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${t}`);throw new Error(i)}}}async isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Wr.message,async e=>{const{topic:t,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;const i=await this.client.core.crypto.decode(t,n);try{Ru(i)?(this.client.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):Ga(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:t,payload:i}),this.client.core.history.delete(t,i.id)):this.onRelayEventUnknownPayload({topic:t,payload:i})}catch(a){this.client.logger.error(a)}})}registerExpirerEvents(){this.client.core.expirer.on(tn.expired,async e=>{const{topic:t,id:n}=tp(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ue("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on($s.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on($s.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!ir(e,!1)){const{message:t}=ue("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}=ue("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(ii(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=ue("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!ir(e,!1)){const{message:t}=ue("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=ue("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(ii(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=ue("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=ue("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(ir(e,!1)){const{message:t}=ue("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=ue("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!X_(e)){const{message:t}=ue("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=ue("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(ii(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=ue("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class V8 extends Za{constructor(e,t){super(e,t,M8,zu),this.core=e,this.logger=t}}class G8 extends Za{constructor(e,t){super(e,t,U8,zu),this.core=e,this.logger=t}}class Y8 extends Za{constructor(e,t){super(e,t,F8,zu,n=>n.id),this.core=e,this.logger=t}}class Ku extends Q5{constructor(e){super(e),this.protocol=R1,this.version=N1,this.name=Hu.name,this.events=new lr.exports.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||Hu.name,this.metadata=e?.metadata||p_();const t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Xe.pino(Xe.getDefaultLoggerOptions({level:e?.logger||Hu.logger}));this.core=e?.core||new L8(e),this.logger=Xe.generateChildLogger(t,this.name),this.session=new G8(this.core,this.logger),this.proposal=new V8(this.core,this.logger),this.pendingRequest=new Y8(this.core,this.logger),this.engine=new K8(this)}static async init(e){const t=new Ku(e);return await t.initialize(),t}get context(){return Xe.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 Vu={exports:{}};(function(r,e){var t=typeof self<"u"?self:vr,n=function(){function a(){this.fetch=!1,this.DOMException=t.DOMException}return a.prototype=t,new a}();(function(a){(function(c){var u={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 f(I){return I&&DataView.prototype.isPrototypeOf(I)}if(u.arrayBuffer)var h=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=ArrayBuffer.isView||function(I){return I&&h.indexOf(Object.prototype.toString.call(I))>-1};function w(I){if(typeof I!="string"&&(I=String(I)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(I))throw new TypeError("Invalid character in header field name");return I.toLowerCase()}function y(I){return typeof I!="string"&&(I=String(I)),I}function _(I){var N={next:function(){var X=I.shift();return{done:X===void 0,value:X}}};return u.iterable&&(N[Symbol.iterator]=function(){return N}),N}function S(I){this.map={},I instanceof S?I.forEach(function(N,X){this.append(X,N)},this):Array.isArray(I)?I.forEach(function(N){this.append(N[0],N[1])},this):I&&Object.getOwnPropertyNames(I).forEach(function(N){this.append(N,I[N])},this)}S.prototype.append=function(I,N){I=w(I),N=y(N);var X=this.map[I];this.map[I]=X?X+", "+N:N},S.prototype.delete=function(I){delete this.map[w(I)]},S.prototype.get=function(I){return I=w(I),this.has(I)?this.map[I]:null},S.prototype.has=function(I){return this.map.hasOwnProperty(w(I))},S.prototype.set=function(I,N){this.map[w(I)]=y(N)},S.prototype.forEach=function(I,N){for(var X in this.map)this.map.hasOwnProperty(X)&&I.call(N,this.map[X],X,this)},S.prototype.keys=function(){var I=[];return this.forEach(function(N,X){I.push(X)}),_(I)},S.prototype.values=function(){var I=[];return this.forEach(function(N){I.push(N)}),_(I)},S.prototype.entries=function(){var I=[];return this.forEach(function(N,X){I.push([X,N])}),_(I)},u.iterable&&(S.prototype[Symbol.iterator]=S.prototype.entries);function P(I){if(I.bodyUsed)return Promise.reject(new TypeError("Already read"));I.bodyUsed=!0}function j(I){return new Promise(function(N,X){I.onload=function(){N(I.result)},I.onerror=function(){X(I.error)}})}function U(I){var N=new FileReader,X=j(N);return N.readAsArrayBuffer(I),X}function A(I){var N=new FileReader,X=j(N);return N.readAsText(I),X}function T(I){for(var N=new Uint8Array(I),X=new Array(N.length),ee=0;ee<N.length;ee++)X[ee]=String.fromCharCode(N[ee]);return X.join("")}function O(I){if(I.slice)return I.slice(0);var N=new Uint8Array(I.byteLength);return N.set(new Uint8Array(I)),N.buffer}function $(){return this.bodyUsed=!1,this._initBody=function(I){this._bodyInit=I,I?typeof I=="string"?this._bodyText=I:u.blob&&Blob.prototype.isPrototypeOf(I)?this._bodyBlob=I:u.formData&&FormData.prototype.isPrototypeOf(I)?this._bodyFormData=I:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(I)?this._bodyText=I.toString():u.arrayBuffer&&u.blob&&f(I)?(this._bodyArrayBuffer=O(I.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(I)||m(I))?this._bodyArrayBuffer=O(I):this._bodyText=I=Object.prototype.toString.call(I):this._bodyText="",this.headers.get("content-type")||(typeof I=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(I)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var I=P(this);if(I)return I;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?P(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(U)}),this.text=function(){var I=P(this);if(I)return I;if(this._bodyBlob)return A(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(T(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(H)}),this.json=function(){return this.text().then(JSON.parse)},this}var x=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function d(I){var N=I.toUpperCase();return x.indexOf(N)>-1?N:I}function b(I,N){N=N||{};var X=N.body;if(I instanceof b){if(I.bodyUsed)throw new TypeError("Already read");this.url=I.url,this.credentials=I.credentials,N.headers||(this.headers=new S(I.headers)),this.method=I.method,this.mode=I.mode,this.signal=I.signal,!X&&I._bodyInit!=null&&(X=I._bodyInit,I.bodyUsed=!0)}else this.url=String(I);if(this.credentials=N.credentials||this.credentials||"same-origin",(N.headers||!this.headers)&&(this.headers=new S(N.headers)),this.method=d(N.method||this.method||"GET"),this.mode=N.mode||this.mode||null,this.signal=N.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&X)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(X)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})};function H(I){var N=new FormData;return I.trim().split("&").forEach(function(X){if(X){var ee=X.split("="),Y=ee.shift().replace(/\+/g," "),Z=ee.join("=").replace(/\+/g," ");N.append(decodeURIComponent(Y),decodeURIComponent(Z))}}),N}function F(I){var N=new S,X=I.replace(/\r?\n[\t ]+/g," ");return X.split(/\r?\n/).forEach(function(ee){var Y=ee.split(":"),Z=Y.shift().trim();if(Z){var Q=Y.join(":").trim();N.append(Z,Q)}}),N}$.call(b.prototype);function V(I,N){N||(N={}),this.type="default",this.status=N.status===void 0?200:N.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in N?N.statusText:"OK",this.headers=new S(N.headers),this.url=N.url||"",this._initBody(I)}$.call(V.prototype),V.prototype.clone=function(){return new V(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new S(this.headers),url:this.url})},V.error=function(){var I=new V(null,{status:0,statusText:""});return I.type="error",I};var se=[301,302,303,307,308];V.redirect=function(I,N){if(se.indexOf(N)===-1)throw new RangeError("Invalid status code");return new V(null,{status:N,headers:{location:I}})},c.DOMException=a.DOMException;try{new c.DOMException}catch{c.DOMException=function(N,X){this.message=N,this.name=X;var ee=Error(N);this.stack=ee.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function ce(I,N){return new Promise(function(X,ee){var Y=new b(I,N);if(Y.signal&&Y.signal.aborted)return ee(new c.DOMException("Aborted","AbortError"));var Z=new XMLHttpRequest;function Q(){Z.abort()}Z.onload=function(){var ie={status:Z.status,statusText:Z.statusText,headers:F(Z.getAllResponseHeaders()||"")};ie.url="responseURL"in Z?Z.responseURL:ie.headers.get("X-Request-URL");var Ee="response"in Z?Z.response:Z.responseText;X(new V(Ee,ie))},Z.onerror=function(){ee(new TypeError("Network request failed"))},Z.ontimeout=function(){ee(new TypeError("Network request failed"))},Z.onabort=function(){ee(new c.DOMException("Aborted","AbortError"))},Z.open(Y.method,Y.url,!0),Y.credentials==="include"?Z.withCredentials=!0:Y.credentials==="omit"&&(Z.withCredentials=!1),"responseType"in Z&&u.blob&&(Z.responseType="blob"),Y.headers.forEach(function(ie,Ee){Z.setRequestHeader(Ee,ie)}),Y.signal&&(Y.signal.addEventListener("abort",Q),Z.onreadystatechange=function(){Z.readyState===4&&Y.signal.removeEventListener("abort",Q)}),Z.send(typeof Y._bodyInit>"u"?null:Y._bodyInit)})}return ce.polyfill=!0,a.fetch||(a.fetch=ce,a.Headers=S,a.Request=b,a.Response=V),c.Headers=S,c.Request=b,c.Response=V,c.fetch=ce,Object.defineProperty(c,"__esModule",{value:!0}),c})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,r.exports=e})(Vu,Vu.exports);var B1=Cy(Vu.exports);const k1={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},q1=10;class oi{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new lr.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!Vp(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 n=ji(e),a=await(await B1(this.url,Object.assign(Object.assign({},k1),{body:n}))).json();this.onPayload({data:a})}catch(n){this.onError(e.id,n)}}async register(e=this.url){if(!Vp(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((n,i)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),i(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=ji({id:1,jsonrpc:"2.0",method:"test",params:[]});await B1(e,Object.assign(Object.assign({},k1),{body:t}))}this.onOpen()}catch(t){const n=this.parseError(t);throw this.events.emit("register_error",n),this.onClose(),n}}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"?Ao(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),i=n.message||n.toString(),a=Va(e,i);this.events.emit("payload",a)}parseError(e,t=this.url){return kp(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>q1&&this.events.setMaxListeners(q1)}}const z1="error",Z8="wss://relay.walletconnect.com",J8="wc",Q8="universal_provider",H1=`${J8}@2:${Q8}:`,X8="https://rpc.walletconnect.com/v1/",kn={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Bo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Gu={exports:{}};/**
69
+ ***************************************************************************** */var f0=function(t,e){return f0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},f0(t,e)};function tD(t,e){f0(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var d0=function(){return d0=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},d0.apply(this,arguments)};function rD(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function nD(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(c=t[l])&&(s=(i<3?c(s):i>3?c(e,r,s):c(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function iD(t,e){return function(r,n){e(r,n,t)}}function sD(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function oD(t,e,r,n){function i(s){return s instanceof r?s:new r(function(c){c(s)})}return new(r||(r=Promise))(function(s,c){function l(m){try{h(n.next(m))}catch(_){c(_)}}function f(m){try{h(n.throw(m))}catch(_){c(_)}}function h(m){m.done?s(m.value):i(m.value).then(l,f)}h((n=n.apply(t,e||[])).next())})}function aD(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=h[0]&2?i.return:h[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,h[1])).done)return s;switch(i=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return r.label++,{value:h[1],done:!1};case 5:r.label++,i=h[1],h=[0];continue;case 7:h=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){r=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]<s[3])){r.label=h[1];break}if(h[0]===6&&r.label<s[1]){r.label=s[1],s=h;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(h);break}s[2]&&r.ops.pop(),r.trys.pop();continue}h=e.call(t,r)}catch(m){h=[6,m],i=0}finally{n=s=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function cD(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function lD(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function p0(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ay(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(l){c={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return s}function uD(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(ay(arguments[e]));return t}function hD(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],c=0,l=s.length;c<l;c++,i++)n[i]=s[c];return n}function _c(t){return this instanceof _c?(this.v=t,this):new _c(t)}function fD(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(E){n[E]&&(i[E]=function(A){return new Promise(function(I,R){s.push([E,A,I,R])>1||l(E,A)})})}function l(E,A){try{f(n[E](A))}catch(I){_(s[0][3],I)}}function f(E){E.value instanceof _c?Promise.resolve(E.value.v).then(h,m):_(s[0][2],E)}function h(E){l("next",E)}function m(E){l("throw",E)}function _(E,A){E(A),s.shift(),s.length&&l(s[0][0],s[0][1])}}function dD(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(c){return(r=!r)?{value:_c(t[i](c)),done:i==="return"}:s?s(c):c}:s}}function pD(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof p0=="function"?p0(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(c){return new Promise(function(l,f){c=t[s](c),i(l,f,c.done,c.value)})}}function i(s,c,l,f){Promise.resolve(f).then(function(h){s({value:h,done:l})},c)}}function gD(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function mD(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function vD(t){return t&&t.__esModule?t:{default:t}}function yD(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function wD(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var bD=Object.freeze({__proto__:null,__extends:tD,get __assign(){return d0},__rest:rD,__decorate:nD,__param:iD,__metadata:sD,__awaiter:oD,__generator:aD,__createBinding:cD,__exportStar:lD,__values:p0,__read:ay,__spread:uD,__spreadArrays:hD,__await:_c,__asyncGenerator:fD,__asyncDelegator:dD,__asyncValues:pD,__makeTemplateObject:gD,__importStar:mD,__importDefault:vD,__classPrivateFieldGet:yD,__classPrivateFieldSet:wD}),_D=Us(bD),eo={},cy;function ly(){return cy||(cy=1,Object.defineProperty(eo,"__esModule",{value:!0}),eo.PINO_CUSTOM_CONTEXT_KEY=eo.PINO_LOGGER_DEFAULTS=void 0,eo.PINO_LOGGER_DEFAULTS={level:"info"},eo.PINO_CUSTOM_CONTEXT_KEY="custom_context"),eo}var Kr={},uy;function ED(){if(uy)return Kr;uy=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.generateChildLogger=Kr.formatChildLoggerContext=Kr.getLoggerContext=Kr.setBrowserLoggerContext=Kr.getBrowserLoggerContext=Kr.getDefaultLoggerOptions=void 0;const t=ly();function e(l){return Object.assign(Object.assign({},l),{level:l?.level||t.PINO_LOGGER_DEFAULTS.level})}Kr.getDefaultLoggerOptions=e;function r(l,f=t.PINO_CUSTOM_CONTEXT_KEY){return l[f]||""}Kr.getBrowserLoggerContext=r;function n(l,f,h=t.PINO_CUSTOM_CONTEXT_KEY){return l[h]=f,l}Kr.setBrowserLoggerContext=n;function i(l,f=t.PINO_CUSTOM_CONTEXT_KEY){let h="";return typeof l.bindings>"u"?h=r(l,f):h=l.bindings().context||"",h}Kr.getLoggerContext=i;function s(l,f,h=t.PINO_CUSTOM_CONTEXT_KEY){const m=i(l,h);return m.trim()?`${m}/${f}`:f}Kr.formatChildLoggerContext=s;function c(l,f,h=t.PINO_CUSTOM_CONTEXT_KEY){const m=s(l,f,h),_=l.child({context:m});return n(_,m,h)}return Kr.generateChildLogger=c,Kr}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.pino=void 0;const e=_D,r=e.__importDefault(ev());Object.defineProperty(t,"pino",{enumerable:!0,get:function(){return r.default}}),e.__exportStar(ly(),t),e.__exportStar(ED(),t)})(Xs);const hy="wc",fy=2,dy="client",g0=`${hy}@${fy}:${dy}:`,m0={name:dy,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},py="WALLETCONNECT_DEEPLINK_CHOICE",AD="proposal",gy="Proposal expired",xD="session",ia=_e.SEVEN_DAYS,SD="engine",Rn={wc_sessionPropose:{req:{ttl:_e.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1104},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1106},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:_e.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:_e.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:_e.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1112},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:_e.ONE_DAY,prompt:!1,tag:1114},res:{ttl:_e.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:_e.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:_e.ONE_HOUR,prompt:!1,tag:1117}}},v0={min:_e.FIVE_MINUTES,max:_e.SEVEN_DAYS},qi={idle:"IDLE",active:"ACTIVE"},ID="request",DD=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],CD="wc",OD="auth",PD="authKeys",MD="pairingTopics",TD="requests",Ql=`${CD}@${1.5}:${OD}:`,Zl=`${Ql}:PUB_KEY`;var $D=Object.defineProperty,ND=Object.defineProperties,RD=Object.getOwnPropertyDescriptors,my=Object.getOwnPropertySymbols,LD=Object.prototype.hasOwnProperty,BD=Object.prototype.propertyIsEnumerable,vy=(t,e,r)=>e in t?$D(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Er=(t,e)=>{for(var r in e||(e={}))LD.call(e,r)&&vy(t,r,e[r]);if(my)for(var r of my(e))BD.call(e,r)&&vy(t,r,e[r]);return t},sa=(t,e)=>ND(t,RD(e));class UD extends yx{constructor(e){super(e),this.name=SD,this.events=new Dr.exports,this.initialized=!1,this.requestQueue={state:qi.idle,queue:[]},this.sessionRequestQueue={state:qi.idle,queue:[]},this.requestQueueDelay=_e.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(Rn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},_e.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();const n=sa(Er({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:c,sessionProperties:l,relays:f}=n;let h=i,m,_=!1;try{h&&(_=this.client.core.pairing.pairings.get(h).active)}catch($){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),$}if(!h||!_){const{topic:$,uri:j}=await this.client.core.pairing.create();h=$,m=j}if(!h){const{message:$}=me("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error($)}const E=await this.client.core.crypto.generateKeyPair(),A=Rn.wc_sessionPropose.req.ttl||_e.FIVE_MINUTES,I=Nr(A),R=Er({requiredNamespaces:s,optionalNamespaces:c,relays:f??[{protocol:Gv}],proposer:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:I},l&&{sessionProperties:l}),{reject:W,resolve:Y,done:F}=zs(A,gy);this.events.once(wt("session_connect"),async({error:$,session:j})=>{if($)W($);else if(j){j.self.publicKey=E;const P=sa(Er({},j),{requiredNamespaces:R.requiredNamespaces,optionalNamespaces:R.optionalNamespaces});await this.client.session.set(j.topic,P),await this.setExpiry(j.topic,j.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:j.peer.metadata}),Y(P)}});const z=await this.sendRequest({topic:h,method:"wc_sessionPropose",params:R,throwOnFailedPublish:!0});return await this.setProposal(z,Er({id:z},R)),{uri:m,approval:F}},this.pair=async r=>{await this.isInitialized();try{return await this.client.core.pairing.pair(r)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async r=>{await this.isInitialized();try{await this.isValidApprove(r)}catch(F){throw this.client.logger.error("approve() -> isValidApprove() failed"),F}const{id:n,relayProtocol:i,namespaces:s,sessionProperties:c,sessionConfig:l}=r;let f;try{f=this.client.proposal.get(n)}catch(F){throw this.client.logger.error(`approve() -> proposal.get(${n}) failed`),F}let{pairingTopic:h,proposer:m,requiredNamespaces:_,optionalNamespaces:E}=f;h=h||"";const A=await this.client.core.crypto.generateKeyPair(),I=m.publicKey,R=await this.client.core.crypto.generateSharedKey(A,I),W=Er(Er({relay:{protocol:i??"irn"},namespaces:s,pairingTopic:h,controller:{publicKey:A,metadata:this.client.metadata},expiry:Nr(ia)},c&&{sessionProperties:c}),l&&{sessionConfig:l});await this.client.core.relayer.subscribe(R);const Y=sa(Er({},W),{topic:R,requiredNamespaces:_,optionalNamespaces:E,pairingTopic:h,acknowledged:!1,self:W.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:A});await this.client.session.set(R,Y);try{await this.sendResult({id:n,topic:h,result:{relay:{protocol:i??"irn"},responderPublicKey:A},throwOnFailedPublish:!0}),await this.sendRequest({topic:R,method:"wc_sessionSettle",params:W,throwOnFailedPublish:!0})}catch(F){throw this.client.logger.error(F),this.client.session.delete(R,Ut("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(R),F}return await this.client.core.pairing.updateMetadata({topic:h,metadata:m.metadata}),await this.client.proposal.delete(n,Ut("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:h}),await this.setExpiry(R,Nr(ia)),{topic:R,acknowledged:()=>new Promise(F=>setTimeout(()=>F(this.client.session.get(R)),500))}},this.reject=async r=>{await this.isInitialized();try{await this.isValidReject(r)}catch(c){throw this.client.logger.error("reject() -> isValidReject() failed"),c}const{id:n,reason:i}=r;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(c){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),c}s&&(await this.sendError({id:n,topic:s,error:i}),await this.client.proposal.delete(n,Ut("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized();try{await this.isValidUpdate(r)}catch(_){throw this.client.logger.error("update() -> isValidUpdate() failed"),_}const{topic:n,namespaces:i}=r,{done:s,resolve:c,reject:l}=zs(),f=us(),h=Qs().toString(),m=this.client.session.get(n).namespaces;return this.events.once(wt("session_update",f),({error:_})=>{_?l(_):c()}),await this.client.session.update(n,{namespaces:i}),this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:f,relayRpcId:h}).catch(_=>{this.client.logger.error(_),this.client.session.update(n,{namespaces:m}),l(_)}),{acknowledged:s}},this.extend=async r=>{await this.isInitialized();try{await this.isValidExtend(r)}catch(f){throw this.client.logger.error("extend() -> isValidExtend() failed"),f}const{topic:n}=r,i=us(),{done:s,resolve:c,reject:l}=zs();return this.events.once(wt("session_extend",i),({error:f})=>{f?l(f):c()}),await this.setExpiry(n,Nr(ia)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(f=>{l(f)}),{acknowledged:s}},this.request=async r=>{await this.isInitialized();try{await this.isValidRequest(r)}catch(A){throw this.client.logger.error("request() -> isValidRequest() failed"),A}const{chainId:n,request:i,topic:s,expiry:c=Rn.wc_sessionRequest.req.ttl}=r,l=this.client.session.get(s),f=us(),h=Qs().toString(),{done:m,resolve:_,reject:E}=zs(c,"Request expired. Please try again.");return this.events.once(wt("session_request",f),({error:A,result:I})=>{A?E(A):_(I)}),await Promise.all([new Promise(async A=>{await this.sendRequest({clientRpcId:f,relayRpcId:h,topic:s,method:"wc_sessionRequest",params:{request:sa(Er({},i),{expiryTimestamp:Nr(c)}),chainId:n},expiry:c,throwOnFailedPublish:!0}).catch(I=>E(I)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:f}),A()}),new Promise(async A=>{var I;if(!((I=l.sessionConfig)!=null&&I.disableDeepLink)){const R=await q_(this.client.core.storage,py);k_({id:f,topic:s,wcDeepLink:R})}A()}),m()]).then(A=>A[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i;bi(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0}):Tn(i)&&await this.sendError({id:s,topic:n,error:i.error}),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized();try{await this.isValidPing(r)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=us(),s=Qs().toString(),{done:c,resolve:l,reject:f}=zs();this.events.once(wt("session_ping",i),({error:h})=>{h?f(h):l()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),c()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{await this.isInitialized(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r,c=Qs().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:c})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);const{topic:n}=r;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Ut("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=me("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>dA(n,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async r=>{this.isInitialized(),this.isValidAuthenticate(r);const{chains:n,statement:i="",uri:s,domain:c,nonce:l,type:f,exp:h,nbf:m,methods:_=[]}=r,E=[...r.resources||[]],{topic:A,uri:I}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"]});this.client.logger.info({message:"Generated new pairing",pairing:{topic:A,uri:I}});const R=await this.client.core.crypto.generateKeyPair(),W=Rl(R);if(await Promise.all([this.client.auth.authKeys.set(Zl,{responseTopic:W,publicKey:R}),this.client.auth.pairingTopics.set(W,{topic:W,pairingTopic:A})]),await this.client.core.relayer.subscribe(W),this.client.logger.info(`sending request to new pairing topic: ${A}`),_.length>0){const{namespace:ae}=yl(n[0]);let p=BE(ae,"request",_);Nl(E)&&(p=FE(p,E.pop())),E.push(p)}const Y=Nr(Rn.wc_sessionPropose.req.ttl),F={authPayload:{type:f??"caip122",chains:n,statement:i,aud:s,domain:c,version:"1",nonce:l,iat:new Date().toISOString(),exp:h,nbf:m,resources:E},requester:{publicKey:R,metadata:this.client.metadata},expiryTimestamp:Y},z={eip155:{chains:n,methods:[...new Set(["personal_sign",..._])],events:["chainChanged","accountsChanged"]}},$={requiredNamespaces:{},optionalNamespaces:z,relays:[{protocol:"irn"}],proposer:{publicKey:R,metadata:this.client.metadata},expiryTimestamp:Y},{done:j,resolve:P,reject:g}=zs(Rn.wc_sessionAuthenticate.req.ttl,"Request expired"),C=async({error:ae,session:p})=>{if(this.events.off(wt("session_request",J),Z),ae)g(ae);else if(p){p.self.publicKey=R,await this.client.session.set(p.topic,p),await this.setExpiry(p.topic,p.expiry),A&&await this.client.core.pairing.updateMetadata({topic:A,metadata:p.peer.metadata});const d=this.client.session.get(p.topic);P({session:d})}},Z=async ae=>{if(this.events.off(wt("session_connect"),C),ae.error){const U=Ut("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return ae.error.code===U.code?void 0:g(ae.error.message)}const{cacaos:p,responder:d}=ae.result,b=[],D=[];for(const U of p){await mm({cacao:U,projectId:this.client.core.projectId})||(this.client.logger.error(U,"Signature verification failed"),g(Ut("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:O}=U,v=Nl(O.resources),L=[gm(O.iss)],oe=$l(O.iss);if(v){const de=wm(v),x=bm(v);b.push(...de),L.push(...x)}for(const de of L)D.push(`${de}:${oe}`)}const M=await this.client.core.crypto.generateSharedKey(R,d.publicKey);let N;b.length>0&&(N={topic:M,acknowledged:!0,self:{publicKey:R,metadata:this.client.metadata},peer:d,controller:d.publicKey,expiry:Nr(ia),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:A,namespaces:Pm([...new Set(b)],[...new Set(D)])},await this.client.core.relayer.subscribe(M),await this.client.session.set(M,N),N=this.client.session.get(M)),P({auths:p,session:N})},J=us(),te=us();this.events.once(wt("session_connect"),C),this.events.once(wt("session_request",J),Z);try{await Promise.all([this.sendRequest({topic:A,method:"wc_sessionAuthenticate",params:F,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:J}),this.sendRequest({topic:A,method:"wc_sessionPropose",params:$,expiry:Rn.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:te})])}catch(ae){throw this.events.off(wt("session_connect"),C),this.events.off(wt("session_request",J),Z),ae}return await this.setProposal(te,Er({id:te},$)),await this.client.auth.requests.set(J,{authPayload:F.authPayload,requester:F.requester,expiryTimestamp:Y,id:J,pairingTopic:A,verifyContext:{}}),{uri:I,response:j}},this.approveSessionAuthenticate=async r=>{this.isInitialized();const{id:n,auths:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);const c=s.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),f=Rl(c),h={type:cs,receiverPublicKey:c,senderPublicKey:l},m=[],_=[];for(const I of i){if(!await mm({cacao:I,projectId:this.client.core.projectId})){const z=Ut("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:f,error:z,encodeOpts:h}),new Error(z.message)}const{p:R}=I,W=Nl(R.resources),Y=[gm(R.iss)],F=$l(R.iss);if(W){const z=wm(W),$=bm(W);m.push(...z),Y.push(...$)}for(const z of Y)_.push(`${z}:${F}`)}const E=await this.client.core.crypto.generateSharedKey(l,c);let A;return m?.length>0&&(A={topic:E,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:c,metadata:s.requester.metadata},controller:c,expiry:Nr(ia),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:"",namespaces:Pm([...new Set(m)],[...new Set(_)])},await this.client.core.relayer.subscribe(E),await this.client.session.set(E,A)),await this.sendResult({topic:f,id:n,result:{cacaos:i,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:h,throwOnFailedPublish:!0}),await this.client.auth.requests.delete(n,{message:"fullfilled",code:0}),await this.client.core.pairing.activate({topic:s.pairingTopic}),{session:A}},this.rejectSessionAuthenticate=async r=>{await this.isInitialized();const{id:n,reason:i}=r,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);const c=s.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),f=Rl(c),h={type:cs,receiverPublicKey:c,senderPublicKey:l};await this.sendError({id:n,topic:f,error:i,encodeOpts:h}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.client.proposal.delete(n,Ut("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:n,iss:i}=r;return vm(n,i)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var c,l;return((c=s.peerMetadata)==null?void 0:c.url)&&((l=s.peerMetadata)==null?void 0:l.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async r=>{const{topic:n,expirerHasDeleted:i=!1,emitEvent:s=!0,id:c=0}=r,{self:l}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,Ut("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),i||this.client.core.expirer.del(n),this.client.core.storage.removeItem(py).catch(f=>this.client.logger.warn(f)),this.getPendingSessionRequests().forEach(f=>{f.topic===n&&this.deletePendingSessionRequest(f.id,Ut("USER_DISCONNECTED"))}),s&&this.client.events.emit("session_delete",{id:c,topic:n})},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,Ut("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=qi.idle,this.client.events.emit("session_request_expire",{id:r}))},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,Nr(Rn.wc_sessionPropose.req.ttl))},this.setPendingSessionRequest=async r=>{const{id:n,topic:i,params:s,verifyContext:c}=r,l=s.request.expiryTimestamp||Nr(Rn.wc_sessionRequest.req.ttl);await this.client.pendingRequest.set(n,{id:n,topic:i,params:s,verifyContext:c}),l&&this.client.core.expirer.set(n,l)},this.sendRequest=async r=>{const{topic:n,method:i,params:s,expiry:c,relayRpcId:l,clientRpcId:f,throwOnFailedPublish:h}=r,m=ta(i,s,f);if(ko()&&DD.includes(i)){const A=Vs(JSON.stringify(m));this.client.core.verify.register({attestationId:A})}let _;try{_=await this.client.core.crypto.encode(n,m)}catch(A){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),A}const E=Rn[i].req;return c&&(E.ttl=c),l&&(E.id=l),this.client.core.history.set(n,m),h?(E.internal=sa(Er({},E.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,_,E)):this.client.core.relayer.publish(n,_,E).catch(A=>this.client.logger.error(A)),m.id},this.sendResult=async r=>{const{id:n,topic:i,result:s,throwOnFailedPublish:c,encodeOpts:l}=r,f=Vl(n,s);let h;try{h=await this.client.core.crypto.encode(i,f,l)}catch(E){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),E}let m;try{m=await this.client.core.history.get(i,n)}catch(E){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),E}const _=Rn[m.request.method].res;c?(_.internal=sa(Er({},_.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,h,_)):this.client.core.relayer.publish(i,h,_).catch(E=>this.client.logger.error(E)),await this.client.core.history.resolve(f)},this.sendError=async r=>{const{id:n,topic:i,error:s,encodeOpts:c}=r,l=Gl(n,s);let f;try{f=await this.client.core.crypto.encode(i,l,c)}catch(_){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),_}let h;try{h=await this.client.core.history.get(i,n)}catch(_){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),_}const m=Rn[h.request.method].res;this.client.core.relayer.publish(i,f,m),await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{let s=!1;is(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{is(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===qi.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=qi.active;const r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=qi.idle},this.processRequest=r=>{const{topic:n,payload:i}=r,s=i.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:s}))switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:i}=me("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.shouldIgnorePairingRequest=r=>{const{topic:n,requestMethod:i}=r,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async(r,n)=>{const{params:i,id:s}=n;try{this.isValidConnect(Er({},n.params));const c=i.expiryTimestamp||Nr(Rn.wc_sessionPropose.req.ttl),l=Er({id:s,pairingTopic:r,expiryTimestamp:c},i);await this.setProposal(s,l);const f=Vs(JSON.stringify(n)),h=await this.getVerifyContext(f,l.proposer.metadata);this.client.events.emit("session_proposal",{id:s,params:l,verifyContext:h})}catch(c){await this.sendError({id:s,topic:r,error:c}),this.client.logger.error(c)}},this.onSessionProposeResponse=async(r,n)=>{const{id:i}=n;if(bi(n)){const{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});const c=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});const l=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const f=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:f});const h=await this.client.core.crypto.generateSharedKey(l,f);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:h});const m=await this.client.core.relayer.subscribe(h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:m}),await this.client.core.pairing.activate({topic:r})}else if(Tn(n)){await this.client.proposal.delete(i,Ut("USER_DISCONNECTED"));const s=wt("session_connect");if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners, 954`);this.events.emit(wt("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:c,controller:l,expiry:f,namespaces:h,sessionProperties:m,pairingTopic:_,sessionConfig:E}=n.params,A=Er(Er({topic:r,relay:c,expiry:f,namespaces:h,acknowledged:!0,pairingTopic:_,requiredNamespaces:{},optionalNamespaces:{},controller:l.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:l.publicKey,metadata:l.metadata}},m&&{sessionProperties:m}),E&&{sessionConfig:E});await this.sendResult({id:n.id,topic:r,result:!0,throwOnFailedPublish:!0});const I=wt("session_connect");if(this.events.listenerCount(I)===0)throw new Error(`emitting ${I} without any listeners 997`);this.events.emit(wt("session_connect"),{session:A}),this.cleanupDuplicatePairings(A)}catch(c){await this.sendError({id:i,topic:r,error:c}),this.client.logger.error(c)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;bi(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(wt("session_approve",i),{})):Tn(n)&&(await this.client.session.delete(r,Ut("USER_DISCONNECTED")),this.events.emit(wt("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{const c=`${r}_session_update`,l=lc.get(c);if(l&&this.isRequestOutOfSync(l,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:Ut("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(Er({topic:r},i));try{lc.set(c,s),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(f){throw lc.delete(c),f}this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(c){await this.sendError({id:s,topic:r,error:c}),this.client.logger.error(c)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n,s=wt("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bi(n)?this.events.emit(wt("session_update",i),{}):Tn(n)&&this.events.emit(wt("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Nr(ia)),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n,s=wt("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bi(n)?this.events.emit(wt("session_extend",i),{}):Tn(n)&&this.events.emit(wt("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError({id:i,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n,s=wt("session_ping",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{bi(n)?this.events.emit(wt("session_ping",i),{}):Tn(n)&&this.events.emit(wt("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(yn.publish,async()=>{s(await this.deleteSession({topic:r,id:i}))})}),this.sendResult({id:i,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:Ut("USER_DISCONNECTED")})])}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{const{id:i,params:s}=n;try{await this.isValidRequest(Er({topic:r},s));const c=Vs(JSON.stringify(ta("wc_sessionRequest",s,i))),l=this.client.session.get(r),f=await this.getVerifyContext(c,l.peer.metadata),h={id:i,topic:r,params:s,verifyContext:f};await this.setPendingSessionRequest(h),this.addSessionRequestToSessionRequestQueue(h),this.processSessionRequestQueue()}catch(c){await this.sendError({id:i,topic:r,error:c}),this.client.logger.error(c)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n,s=wt("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);bi(n)?this.events.emit(wt("session_request",i),{result:n.result}):Tn(n)&&this.events.emit(wt("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{const c=`${r}_session_event_${s.event.name}`,l=lc.get(c);if(l&&this.isRequestOutOfSync(l,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(Er({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),lc.set(c,i)}catch(c){await this.sendError({id:i,topic:r,error:c}),this.client.logger.error(c)}},this.onSessionAuthenticateResponse=(r,n)=>{const{id:i}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:n}),bi(n)?this.events.emit(wt("session_request",i),{result:n.result}):Tn(n)&&this.events.emit(wt("session_request",i),{error:n.error})},this.onSessionAuthenticateRequest=async(r,n)=>{const{requester:i,authPayload:s,expiryTimestamp:c}=n.params,l=Vs(JSON.stringify(n)),f=await this.getVerifyContext(l,this.client.metadata),h={requester:i,pairingTopic:r,id:n.id,authPayload:s,verifyContext:f,expiryTimestamp:c};await this.client.auth.requests.set(n.id,h),this.client.events.emit("session_authenticate",{topic:r,params:n.params,id:n.id})},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=qi.idle,this.processSessionRequestQueue()},_e.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const c=s.request.id,l=wt("session_request",c);if(this.events.listenerCount(l)===0)throw new Error(`emitting ${l} without any listeners`);this.events.emit(wt("session_request",s.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===qi.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=qi.active,this.client.events.emit("session_request",r)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,ta("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id))},this.isValidConnect=async r=>{if(!rn(r)){const{message:f}=me("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(f)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:c,relays:l}=r;if(zr(n)||await this.isValidPairingTopic(n),!SA(l,!0)){const{message:f}=me("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(f)}!zr(i)&&cc(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!zr(s)&&cc(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),zr(c)||this.validateSessionProps(c,"sessionProperties")},this.validateNamespaces=(r,n)=>{const i=xA(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!rn(r))throw new Error(me("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s,sessionProperties:c}=r;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const l=this.client.proposal.get(n),f=Uf(i,"approve()");if(f)throw new Error(f.message);const h=Rm(l.requiredNamespaces,i,"approve()");if(h)throw new Error(h.message);if(!ur(s,!0)){const{message:m}=me("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(m)}zr(c)||this.validateSessionProps(c,"sessionProperties")},this.isValidReject=async r=>{if(!rn(r)){const{message:s}=me("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!DA(i)){const{message:s}=me("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!rn(r)){const{message:h}=me("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(h)}const{relay:n,controller:i,namespaces:s,expiry:c}=r;if(!$m(n)){const{message:h}=me("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}const l=yA(i,"onSessionSettleRequest()");if(l)throw new Error(l.message);const f=Uf(s,"onSessionSettleRequest()");if(f)throw new Error(f.message);if(is(c)){const{message:h}=me("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async r=>{if(!rn(r)){const{message:f}=me("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(f)}const{topic:n,namespaces:i}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),c=Uf(i,"update()");if(c)throw new Error(c.message);const l=Rm(s.requiredNamespaces,i,"update()");if(l)throw new Error(l.message)},this.isValidExtend=async r=>{if(!rn(r)){const{message:i}=me("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!rn(r)){const{message:f}=me("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(f)}const{topic:n,request:i,chainId:s,expiry:c}=r;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:l}=this.client.session.get(n);if(!Nm(l,s)){const{message:f}=me("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(f)}if(!CA(i)){const{message:f}=me("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(f)}if(!MA(l,s,i.method)){const{message:f}=me("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(f)}if(c&&!RA(c,v0)){const{message:f}=me("MISSING_OR_INVALID",`request() expiry: ${c}. Expiry must be a number (in seconds) between ${v0.min} and ${v0.max}`);throw new Error(f)}},this.isValidRespond=async r=>{var n;if(!rn(r)){const{message:c}=me("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(c)}const{topic:i,response:s}=r;try{await this.isValidSessionTopic(i)}catch(c){throw(n=r?.response)!=null&&n.id&&this.cleanupAfterResponse(r),c}if(!OA(s)){const{message:c}=me("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(c)}},this.isValidPing=async r=>{if(!rn(r)){const{message:i}=me("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!rn(r)){const{message:l}=me("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(l)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:c}=this.client.session.get(n);if(!Nm(c,s)){const{message:l}=me("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(l)}if(!PA(i)){const{message:l}=me("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(l)}if(!TA(c,s,i.name)){const{message:l}=me("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(l)}},this.isValidDisconnect=async r=>{if(!rn(r)){const{message:i}=me("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidAuthenticate=r=>{const{chains:n,uri:i,domain:s,nonce:c}=r;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!ur(i,!1))throw new Error("uri is required parameter");if(!ur(s,!1))throw new Error("domain is required parameter");if(!ur(c,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(f=>yl(f).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:l}=yl(n[0]);if(l!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async(r,n)=>{const i={verified:{verifyUrl:n.verifyUrl||na,validation:"UNKNOWN",origin:n.url||""}};try{const s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s.origin,i.verified.isScam=s.isScam,i.verified.validation=s.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.info(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!ur(i,!1)){const{message:s}=me("MISSING_OR_INVALID",`${n} must be in Record<string, string> format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const n=this.client.auth.requests.get(r);return typeof n=="object"?n:void 0},this.addToRecentlyDeleted=(r,n)=>{if(this.recentlyDeletedMap.set(r,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const c of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(c)}}},this.checkRecentlyDeleted=r=>{const n=this.recentlyDeletedMap.get(r);if(n){const{message:i}=me("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${r}`);throw new Error(i)}}}async isInitialized(){if(!this.initialized){const{message:e}=me("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(yn.message,async e=>{const{topic:r,message:n}=e,{publicKey:i}=this.client.auth.authKeys.keys.includes(Zl)?this.client.auth.authKeys.get(Zl):{responseTopic:void 0,publicKey:void 0},s=await this.client.core.crypto.decode(r,n,{receiverPublicKey:i});try{r0(s)?(this.client.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):Yl(s)?(await this.client.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.client.core.history.delete(r,s.id)):this.onRelayEventUnknownPayload({topic:r,payload:s})}catch(c){this.client.logger.error(c)}})}registerExpirerEvents(){this.client.core.expirer.on(Nn.expired,async e=>{const{topic:r,id:n}=cg(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,me("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(ra.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(ra.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!ur(e,!1)){const{message:r}=me("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=me("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(is(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=me("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!ur(e,!1)){const{message:r}=me("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=me("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(is(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=me("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=me("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(ur(e,!1)){const{message:r}=me("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=me("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!IA(e)){const{message:r}=me("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=me("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(is(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=me("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class FD extends Zs{constructor(e,r){super(e,r,AD,g0),this.core=e,this.logger=r}}class jD extends Zs{constructor(e,r){super(e,r,xD,g0),this.core=e,this.logger=r}}class kD extends Zs{constructor(e,r){super(e,r,ID,g0,n=>n.id),this.core=e,this.logger=r}}class qD extends Zs{constructor(e,r){super(e,r,PD,Ql,()=>Zl),this.core=e,this.logger=r}}class zD extends Zs{constructor(e,r){super(e,r,MD,Ql),this.core=e,this.logger=r}}class HD extends Zs{constructor(e,r){super(e,r,TD,Ql,n=>n.id),this.core=e,this.logger=r}}class KD{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new qD(this.core,this.logger),this.pairingTopics=new zD(this.core,this.logger),this.requests=new HD(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class y0 extends vx{constructor(e){super(e),this.protocol=hy,this.version=fy,this.name=m0.name,this.events=new Dr.exports.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.authenticate=async n=>{try{return await this.engine.authenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.formatAuthMessage=n=>{try{return this.engine.formatAuthMessage(n)}catch(i){throw this.logger.error(i.message),i}},this.approveSessionAuthenticate=async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.rejectSessionAuthenticate=async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(i){throw this.logger.error(i.message),i}},this.name=e?.name||m0.name,this.metadata=e?.metadata||N_();const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Xs.pino(Xs.getDefaultLoggerOptions({level:e?.logger||m0.logger}));this.core=e?.core||new eD(e),this.logger=Xs.generateChildLogger(r,this.name),this.session=new jD(this.core,this.logger),this.proposal=new FD(this.core,this.logger),this.pendingRequest=new kD(this.core,this.logger),this.engine=new UD(this),this.auth=new KD(this.core,this.logger)}static async init(e){const r=new y0(e);return await r.initialize(),r}get context(){return Xs.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(),await this.auth.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 w0={exports:{}};(function(t,e){var r=typeof self<"u"?self:Jn,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(c){var l={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function f(d){return d&&DataView.prototype.isPrototypeOf(d)}if(l.arrayBuffer)var h=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=ArrayBuffer.isView||function(d){return d&&h.indexOf(Object.prototype.toString.call(d))>-1};function _(d){if(typeof d!="string"&&(d=String(d)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(d))throw new TypeError("Invalid character in header field name");return d.toLowerCase()}function E(d){return typeof d!="string"&&(d=String(d)),d}function A(d){var b={next:function(){var D=d.shift();return{done:D===void 0,value:D}}};return l.iterable&&(b[Symbol.iterator]=function(){return b}),b}function I(d){this.map={},d instanceof I?d.forEach(function(b,D){this.append(D,b)},this):Array.isArray(d)?d.forEach(function(b){this.append(b[0],b[1])},this):d&&Object.getOwnPropertyNames(d).forEach(function(b){this.append(b,d[b])},this)}I.prototype.append=function(d,b){d=_(d),b=E(b);var D=this.map[d];this.map[d]=D?D+", "+b:b},I.prototype.delete=function(d){delete this.map[_(d)]},I.prototype.get=function(d){return d=_(d),this.has(d)?this.map[d]:null},I.prototype.has=function(d){return this.map.hasOwnProperty(_(d))},I.prototype.set=function(d,b){this.map[_(d)]=E(b)},I.prototype.forEach=function(d,b){for(var D in this.map)this.map.hasOwnProperty(D)&&d.call(b,this.map[D],D,this)},I.prototype.keys=function(){var d=[];return this.forEach(function(b,D){d.push(D)}),A(d)},I.prototype.values=function(){var d=[];return this.forEach(function(b){d.push(b)}),A(d)},I.prototype.entries=function(){var d=[];return this.forEach(function(b,D){d.push([D,b])}),A(d)},l.iterable&&(I.prototype[Symbol.iterator]=I.prototype.entries);function R(d){if(d.bodyUsed)return Promise.reject(new TypeError("Already read"));d.bodyUsed=!0}function W(d){return new Promise(function(b,D){d.onload=function(){b(d.result)},d.onerror=function(){D(d.error)}})}function Y(d){var b=new FileReader,D=W(b);return b.readAsArrayBuffer(d),D}function F(d){var b=new FileReader,D=W(b);return b.readAsText(d),D}function z(d){for(var b=new Uint8Array(d),D=new Array(b.length),M=0;M<b.length;M++)D[M]=String.fromCharCode(b[M]);return D.join("")}function $(d){if(d.slice)return d.slice(0);var b=new Uint8Array(d.byteLength);return b.set(new Uint8Array(d)),b.buffer}function j(){return this.bodyUsed=!1,this._initBody=function(d){this._bodyInit=d,d?typeof d=="string"?this._bodyText=d:l.blob&&Blob.prototype.isPrototypeOf(d)?this._bodyBlob=d:l.formData&&FormData.prototype.isPrototypeOf(d)?this._bodyFormData=d:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(d)?this._bodyText=d.toString():l.arrayBuffer&&l.blob&&f(d)?(this._bodyArrayBuffer=$(d.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(d)||m(d))?this._bodyArrayBuffer=$(d):this._bodyText=d=Object.prototype.toString.call(d):this._bodyText="",this.headers.get("content-type")||(typeof d=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(d)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var d=R(this);if(d)return d;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?R(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(Y)}),this.text=function(){var d=R(this);if(d)return d;if(this._bodyBlob)return F(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(z(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},l.formData&&(this.formData=function(){return this.text().then(Z)}),this.json=function(){return this.text().then(JSON.parse)},this}var P=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function g(d){var b=d.toUpperCase();return P.indexOf(b)>-1?b:d}function C(d,b){b=b||{};var D=b.body;if(d instanceof C){if(d.bodyUsed)throw new TypeError("Already read");this.url=d.url,this.credentials=d.credentials,b.headers||(this.headers=new I(d.headers)),this.method=d.method,this.mode=d.mode,this.signal=d.signal,!D&&d._bodyInit!=null&&(D=d._bodyInit,d.bodyUsed=!0)}else this.url=String(d);if(this.credentials=b.credentials||this.credentials||"same-origin",(b.headers||!this.headers)&&(this.headers=new I(b.headers)),this.method=g(b.method||this.method||"GET"),this.mode=b.mode||this.mode||null,this.signal=b.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&D)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(D)}C.prototype.clone=function(){return new C(this,{body:this._bodyInit})};function Z(d){var b=new FormData;return d.trim().split("&").forEach(function(D){if(D){var M=D.split("="),N=M.shift().replace(/\+/g," "),U=M.join("=").replace(/\+/g," ");b.append(decodeURIComponent(N),decodeURIComponent(U))}}),b}function J(d){var b=new I,D=d.replace(/\r?\n[\t ]+/g," ");return D.split(/\r?\n/).forEach(function(M){var N=M.split(":"),U=N.shift().trim();if(U){var O=N.join(":").trim();b.append(U,O)}}),b}j.call(C.prototype);function te(d,b){b||(b={}),this.type="default",this.status=b.status===void 0?200:b.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in b?b.statusText:"OK",this.headers=new I(b.headers),this.url=b.url||"",this._initBody(d)}j.call(te.prototype),te.prototype.clone=function(){return new te(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new I(this.headers),url:this.url})},te.error=function(){var d=new te(null,{status:0,statusText:""});return d.type="error",d};var ae=[301,302,303,307,308];te.redirect=function(d,b){if(ae.indexOf(b)===-1)throw new RangeError("Invalid status code");return new te(null,{status:b,headers:{location:d}})},c.DOMException=s.DOMException;try{new c.DOMException}catch{c.DOMException=function(b,D){this.message=b,this.name=D;var M=Error(b);this.stack=M.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function p(d,b){return new Promise(function(D,M){var N=new C(d,b);if(N.signal&&N.signal.aborted)return M(new c.DOMException("Aborted","AbortError"));var U=new XMLHttpRequest;function O(){U.abort()}U.onload=function(){var v={status:U.status,statusText:U.statusText,headers:J(U.getAllResponseHeaders()||"")};v.url="responseURL"in U?U.responseURL:v.headers.get("X-Request-URL");var L="response"in U?U.response:U.responseText;D(new te(L,v))},U.onerror=function(){M(new TypeError("Network request failed"))},U.ontimeout=function(){M(new TypeError("Network request failed"))},U.onabort=function(){M(new c.DOMException("Aborted","AbortError"))},U.open(N.method,N.url,!0),N.credentials==="include"?U.withCredentials=!0:N.credentials==="omit"&&(U.withCredentials=!1),"responseType"in U&&l.blob&&(U.responseType="blob"),N.headers.forEach(function(v,L){U.setRequestHeader(L,v)}),N.signal&&(N.signal.addEventListener("abort",O),U.onreadystatechange=function(){U.readyState===4&&N.signal.removeEventListener("abort",O)}),U.send(typeof N._bodyInit>"u"?null:N._bodyInit)})}return p.polyfill=!0,s.fetch||(s.fetch=p,s.Headers=I,s.Request=C,s.Response=te),c.Headers=I,c.Request=C,c.Response=te,c.fetch=p,Object.defineProperty(c,"__esModule",{value:!0}),c})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(w0,w0.exports);var yy=s3(w0.exports);const wy={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},by=10;class fs{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new Dr.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!_v(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}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,r){this.isAvailable||await this.register();try{const n=Ui(e),s=await(await yy(this.url,Object.assign(Object.assign({},wy),{body:n}))).json();this.onPayload({data:s})}catch(n){this.onError(e.id,n)}}async register(e=this.url){if(!_v(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=Ui({id:1,jsonrpc:"2.0",method:"test",params:[]});await yy(e,Object.assign(Object.assign({},wy),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}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 r=typeof e.data=="string"?hc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Gl(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return gv(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>by&&this.events.setMaxListeners(by)}}const _y="error",WD="wss://relay.walletconnect.com",VD="wc",GD="universal_provider",Ey=`${VD}@2:${GD}:`,YD="https://rpc.walletconnect.com/v1/",zi={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Ec=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},b0={exports:{}};/**
60
70
  * @license
61
71
  * Lodash <https://lodash.com/>
62
72
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
63
73
  * Released under MIT license <https://lodash.com/license>
64
74
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
65
75
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
66
- */(function(r,e){(function(){var t,n="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",u="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,m="__lodash_placeholder__",w=1,y=2,_=4,S=1,P=2,j=1,U=2,A=4,T=8,O=16,$=32,x=64,d=128,b=256,H=512,F=30,V="...",se=800,ce=16,I=1,N=2,X=3,ee=1/0,Y=9007199254740991,Z=17976931348623157e292,Q=0/0,ie=4294967295,Ee=ie-1,ae=ie>>>1,xe=[["ary",d],["bind",j],["bindKey",U],["curry",T],["curryRight",O],["flip",H],["partial",$],["partialRight",x],["rearg",b]],de="[object Arguments]",be="[object Array]",K="[object AsyncFunction]",W="[object Boolean]",B="[object Date]",g="[object DOMException]",L="[object Error]",le="[object Function]",pe="[object GeneratorFunction]",Oe="[object Map]",Ke="[object Number]",Ze="[object Null]",ke="[object Object]",Ot="[object Promise]",Ct="[object Proxy]",ze="[object RegExp]",Ce="[object Set]",Ue="[object String]",je="[object Symbol]",He="[object Undefined]",Ae="[object WeakMap]",Fe="[object WeakSet]",Se="[object ArrayBuffer]",Te="[object DataView]",Ve="[object Float32Array]",$e="[object Float64Array]",Je="[object Int8Array]",et="[object Int16Array]",at="[object Int32Array]",ct="[object Uint8Array]",nt="[object Uint8ClampedArray]",Dr="[object Uint16Array]",Mr="[object Uint32Array]",$n=/\b__p \+= '';/g,Sr=/\b(__p \+=) '' \+/g,Wn=/(__e\(.*?\)|\b__t\)) \+\n'';/g,bi=/&(?:amp|lt|gt|quot|#39);/g,ns=/[&<>"']/g,Mt=RegExp(bi.source),$t=RegExp(ns.source),Ut=/<%-([\s\S]+?)%>/g,jt=/<%([\s\S]+?)%>/g,Rt=/<%=([\s\S]+?)%>/g,At=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Gt=/^\w*$/,Yt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ft=/[\\^$.*+?()[\]{}|]/g,Zt=RegExp(Ft.source),Bt=/^\s+/,Ht=/\s/,kt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Et=/\{\n\/\* \[wrapped with (.+)\] \*/,Jt=/,? & /,Qt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,uf=/[()=,{}\[\]\/\s]/,hf=/\\(\\)?/g,ff=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,nn=/\w*$/,df=/^[-+]0x[0-9a-f]+$/i,pf=/^0b[01]+$/i,gf=/^\[object .+?Constructor\]$/,mf=/^0o[0-7]+$/i,vf=/^(?:0|[1-9]\d*)$/,Kn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ys=/($^)/,yf=/['\n\r\u2028\u2029\\]/g,Zs="\\ud800-\\udfff",wf="\\u0300-\\u036f",bf="\\ufe20-\\ufe2f",Js="\\u20d0-\\u20ff",Ac=wf+bf+Js,Pc="\\u2700-\\u27bf",gn="a-z\\xdf-\\xf6\\xf8-\\xff",_f="\\xac\\xb1\\xd7\\xf7",Ef="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",xf="\\u2000-\\u206f",If=" \\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",Tc="A-Z\\xc0-\\xd6\\xd8-\\xde",Rc="\\ufe0e\\ufe0f",is=_f+Ef+xf+If,aa="['\u2019]",ss="["+Zs+"]",ca="["+is+"]",os="["+Ac+"]",Nc="\\d+",Df="["+Pc+"]",Lc="["+gn+"]",Mc="[^"+Zs+is+Nc+Pc+gn+Tc+"]",Qs="\\ud83c[\\udffb-\\udfff]",Sf="(?:"+os+"|"+Qs+")",Uc="[^"+Zs+"]",Xs="(?:\\ud83c[\\udde6-\\uddff]){2}",_i="[\\ud800-\\udbff][\\udc00-\\udfff]",Gr="["+Tc+"]",jc="\\u200d",Fc="(?:"+Lc+"|"+Mc+")",An="(?:"+Gr+"|"+Mc+")",Bc="(?:"+aa+"(?:d|ll|m|re|s|t|ve))?",kc="(?:"+aa+"(?:D|LL|M|RE|S|T|VE))?",qc=Sf+"?",zc="["+Rc+"]?",Of="(?:"+jc+"(?:"+[Uc,Xs,_i].join("|")+")"+zc+qc+")*",Vn="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Hc="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Wc=zc+qc+Of,eo="(?:"+[Df,Xs,_i].join("|")+")"+Wc,Cf="(?:"+[Uc+os+"?",os,Xs,_i,ss].join("|")+")",la=RegExp(aa,"g"),$f=RegExp(os,"g"),to=RegExp(Qs+"(?="+Qs+")|"+Cf+Wc,"g"),Kc=RegExp([Gr+"?"+Lc+"+"+Bc+"(?="+[ca,Gr,"$"].join("|")+")",An+"+"+kc+"(?="+[ca,Gr+Fc,"$"].join("|")+")",Gr+"?"+Fc+"+"+Bc,Gr+"+"+kc,Hc,Vn,Nc,eo].join("|"),"g"),Vc=RegExp("["+jc+Zs+Ac+Rc+"]"),as=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Gc=["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"],Af=-1,vt={};vt[Ve]=vt[$e]=vt[Je]=vt[et]=vt[at]=vt[ct]=vt[nt]=vt[Dr]=vt[Mr]=!0,vt[de]=vt[be]=vt[Se]=vt[W]=vt[Te]=vt[B]=vt[L]=vt[le]=vt[Oe]=vt[Ke]=vt[ke]=vt[ze]=vt[Ce]=vt[Ue]=vt[Ae]=!1;var mt={};mt[de]=mt[be]=mt[Se]=mt[Te]=mt[W]=mt[B]=mt[Ve]=mt[$e]=mt[Je]=mt[et]=mt[at]=mt[Oe]=mt[Ke]=mt[ke]=mt[ze]=mt[Ce]=mt[Ue]=mt[je]=mt[ct]=mt[nt]=mt[Dr]=mt[Mr]=!0,mt[L]=mt[le]=mt[Ae]=!1;var C={\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"},k={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ne={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},ge={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},yt=parseFloat,Ne=parseInt,It=typeof Bo=="object"&&Bo&&Bo.Object===Object&&Bo,Xt=typeof self=="object"&&self&&self.Object===Object&&self,it=It||Xt||Function("return this")(),wt=e&&!e.nodeType&&e,Wt=wt&&!0&&r&&!r.nodeType&&r,Ur=Wt&&Wt.exports===wt,er=Ur&&It.process,Dt=function(){try{var q=Wt&&Wt.require&&Wt.require("util").types;return q||er&&er.binding&&er.binding("util")}catch{}}(),Or=Dt&&Dt.isArrayBuffer,mn=Dt&&Dt.isDate,sn=Dt&&Dt.isMap,Pn=Dt&&Dt.isRegExp,ua=Dt&&Dt.isSet,cs=Dt&&Dt.isTypedArray;function ar(q,J,G){switch(G.length){case 0:return q.call(J);case 1:return q.call(J,G[0]);case 2:return q.call(J,G[0],G[1]);case 3:return q.call(J,G[0],G[1],G[2])}return q.apply(J,G)}function uC(q,J,G,ve){for(var Re=-1,ut=q==null?0:q.length;++Re<ut;){var rr=q[Re];J(ve,rr,G(rr),q)}return ve}function on(q,J){for(var G=-1,ve=q==null?0:q.length;++G<ve&&J(q[G],G,q)!==!1;);return q}function hC(q,J){for(var G=q==null?0:q.length;G--&&J(q[G],G,q)!==!1;);return q}function $m(q,J){for(var G=-1,ve=q==null?0:q.length;++G<ve;)if(!J(q[G],G,q))return!1;return!0}function Ei(q,J){for(var G=-1,ve=q==null?0:q.length,Re=0,ut=[];++G<ve;){var rr=q[G];J(rr,G,q)&&(ut[Re++]=rr)}return ut}function Yc(q,J){var G=q==null?0:q.length;return!!G&&ro(q,J,0)>-1}function Pf(q,J,G){for(var ve=-1,Re=q==null?0:q.length;++ve<Re;)if(G(J,q[ve]))return!0;return!1}function Pt(q,J){for(var G=-1,ve=q==null?0:q.length,Re=Array(ve);++G<ve;)Re[G]=J(q[G],G,q);return Re}function xi(q,J){for(var G=-1,ve=J.length,Re=q.length;++G<ve;)q[Re+G]=J[G];return q}function Tf(q,J,G,ve){var Re=-1,ut=q==null?0:q.length;for(ve&&ut&&(G=q[++Re]);++Re<ut;)G=J(G,q[Re],Re,q);return G}function fC(q,J,G,ve){var Re=q==null?0:q.length;for(ve&&Re&&(G=q[--Re]);Re--;)G=J(G,q[Re],Re,q);return G}function Rf(q,J){for(var G=-1,ve=q==null?0:q.length;++G<ve;)if(J(q[G],G,q))return!0;return!1}var dC=Nf("length");function pC(q){return q.split("")}function gC(q){return q.match(Qt)||[]}function Am(q,J,G){var ve;return G(q,function(Re,ut,rr){if(J(Re,ut,rr))return ve=ut,!1}),ve}function Zc(q,J,G,ve){for(var Re=q.length,ut=G+(ve?1:-1);ve?ut--:++ut<Re;)if(J(q[ut],ut,q))return ut;return-1}function ro(q,J,G){return J===J?OC(q,J,G):Zc(q,Pm,G)}function mC(q,J,G,ve){for(var Re=G-1,ut=q.length;++Re<ut;)if(ve(q[Re],J))return Re;return-1}function Pm(q){return q!==q}function Tm(q,J){var G=q==null?0:q.length;return G?Mf(q,J)/G:Q}function Nf(q){return function(J){return J==null?t:J[q]}}function Lf(q){return function(J){return q==null?t:q[J]}}function Rm(q,J,G,ve,Re){return Re(q,function(ut,rr,bt){G=ve?(ve=!1,ut):J(G,ut,rr,bt)}),G}function vC(q,J){var G=q.length;for(q.sort(J);G--;)q[G]=q[G].value;return q}function Mf(q,J){for(var G,ve=-1,Re=q.length;++ve<Re;){var ut=J(q[ve]);ut!==t&&(G=G===t?ut:G+ut)}return G}function Uf(q,J){for(var G=-1,ve=Array(q);++G<q;)ve[G]=J(G);return ve}function yC(q,J){return Pt(J,function(G){return[G,q[G]]})}function Nm(q){return q&&q.slice(0,jm(q)+1).replace(Bt,"")}function Yr(q){return function(J){return q(J)}}function jf(q,J){return Pt(J,function(G){return q[G]})}function ha(q,J){return q.has(J)}function Lm(q,J){for(var G=-1,ve=q.length;++G<ve&&ro(J,q[G],0)>-1;);return G}function Mm(q,J){for(var G=q.length;G--&&ro(J,q[G],0)>-1;);return G}function wC(q,J){for(var G=q.length,ve=0;G--;)q[G]===J&&++ve;return ve}var bC=Lf(C),_C=Lf(k);function EC(q){return"\\"+ge[q]}function xC(q,J){return q==null?t:q[J]}function no(q){return Vc.test(q)}function IC(q){return as.test(q)}function DC(q){for(var J,G=[];!(J=q.next()).done;)G.push(J.value);return G}function Ff(q){var J=-1,G=Array(q.size);return q.forEach(function(ve,Re){G[++J]=[Re,ve]}),G}function Um(q,J){return function(G){return q(J(G))}}function Ii(q,J){for(var G=-1,ve=q.length,Re=0,ut=[];++G<ve;){var rr=q[G];(rr===J||rr===m)&&(q[G]=m,ut[Re++]=G)}return ut}function Jc(q){var J=-1,G=Array(q.size);return q.forEach(function(ve){G[++J]=ve}),G}function SC(q){var J=-1,G=Array(q.size);return q.forEach(function(ve){G[++J]=[ve,ve]}),G}function OC(q,J,G){for(var ve=G-1,Re=q.length;++ve<Re;)if(q[ve]===J)return ve;return-1}function CC(q,J,G){for(var ve=G+1;ve--;)if(q[ve]===J)return ve;return ve}function io(q){return no(q)?AC(q):dC(q)}function vn(q){return no(q)?PC(q):pC(q)}function jm(q){for(var J=q.length;J--&&Ht.test(q.charAt(J)););return J}var $C=Lf(ne);function AC(q){for(var J=to.lastIndex=0;to.test(q);)++J;return J}function PC(q){return q.match(to)||[]}function TC(q){return q.match(Kc)||[]}var RC=function q(J){J=J==null?it:so.defaults(it.Object(),J,so.pick(it,Gc));var G=J.Array,ve=J.Date,Re=J.Error,ut=J.Function,rr=J.Math,bt=J.Object,Bf=J.RegExp,NC=J.String,an=J.TypeError,Qc=G.prototype,LC=ut.prototype,oo=bt.prototype,Xc=J["__core-js_shared__"],el=LC.toString,dt=oo.hasOwnProperty,MC=0,Fm=function(){var s=/[^.]+$/.exec(Xc&&Xc.keys&&Xc.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),tl=oo.toString,UC=el.call(bt),jC=it._,FC=Bf("^"+el.call(dt).replace(Ft,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rl=Ur?J.Buffer:t,Di=J.Symbol,nl=J.Uint8Array,Bm=rl?rl.allocUnsafe:t,il=Um(bt.getPrototypeOf,bt),km=bt.create,qm=oo.propertyIsEnumerable,sl=Qc.splice,zm=Di?Di.isConcatSpreadable:t,fa=Di?Di.iterator:t,ls=Di?Di.toStringTag:t,ol=function(){try{var s=ps(bt,"defineProperty");return s({},"",{}),s}catch{}}(),BC=J.clearTimeout!==it.clearTimeout&&J.clearTimeout,kC=ve&&ve.now!==it.Date.now&&ve.now,qC=J.setTimeout!==it.setTimeout&&J.setTimeout,al=rr.ceil,cl=rr.floor,kf=bt.getOwnPropertySymbols,zC=rl?rl.isBuffer:t,Hm=J.isFinite,HC=Qc.join,WC=Um(bt.keys,bt),nr=rr.max,gr=rr.min,KC=ve.now,VC=J.parseInt,Wm=rr.random,GC=Qc.reverse,qf=ps(J,"DataView"),da=ps(J,"Map"),zf=ps(J,"Promise"),ao=ps(J,"Set"),pa=ps(J,"WeakMap"),ga=ps(bt,"create"),ll=pa&&new pa,co={},YC=gs(qf),ZC=gs(da),JC=gs(zf),QC=gs(ao),XC=gs(pa),ul=Di?Di.prototype:t,ma=ul?ul.valueOf:t,Km=ul?ul.toString:t;function E(s){if(qt(s)&&!Le(s)&&!(s instanceof tt)){if(s instanceof cn)return s;if(dt.call(s,"__wrapped__"))return Vv(s)}return new cn(s)}var lo=function(){function s(){}return function(o){if(!Nt(o))return{};if(km)return km(o);s.prototype=o;var l=new s;return s.prototype=t,l}}();function hl(){}function cn(s,o){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=t}E.templateSettings={escape:Ut,evaluate:jt,interpolate:Rt,variable:"",imports:{_:E}},E.prototype=hl.prototype,E.prototype.constructor=E,cn.prototype=lo(hl.prototype),cn.prototype.constructor=cn;function tt(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ie,this.__views__=[]}function e7(){var s=new tt(this.__wrapped__);return s.__actions__=jr(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=jr(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=jr(this.__views__),s}function t7(){if(this.__filtered__){var s=new tt(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function r7(){var s=this.__wrapped__.value(),o=this.__dir__,l=Le(s),p=o<0,v=l?s.length:0,D=p$(0,v,this.__views__),R=D.start,M=D.end,z=M-R,te=p?M:R-1,re=this.__iteratees__,oe=re.length,fe=0,ye=gr(z,this.__takeCount__);if(!l||!p&&v==z&&ye==z)return mv(s,this.__actions__);var Ie=[];e:for(;z--&&fe<ye;){te+=o;for(var We=-1,De=s[te];++We<oe;){var Qe=re[We],st=Qe.iteratee,Qr=Qe.type,Ar=st(De);if(Qr==N)De=Ar;else if(!Ar){if(Qr==I)continue e;break e}}Ie[fe++]=De}return Ie}tt.prototype=lo(hl.prototype),tt.prototype.constructor=tt;function us(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var p=s[o];this.set(p[0],p[1])}}function n7(){this.__data__=ga?ga(null):{},this.size=0}function i7(s){var o=this.has(s)&&delete this.__data__[s];return this.size-=o?1:0,o}function s7(s){var o=this.__data__;if(ga){var l=o[s];return l===f?t:l}return dt.call(o,s)?o[s]:t}function o7(s){var o=this.__data__;return ga?o[s]!==t:dt.call(o,s)}function a7(s,o){var l=this.__data__;return this.size+=this.has(s)?0:1,l[s]=ga&&o===t?f:o,this}us.prototype.clear=n7,us.prototype.delete=i7,us.prototype.get=s7,us.prototype.has=o7,us.prototype.set=a7;function Gn(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var p=s[o];this.set(p[0],p[1])}}function c7(){this.__data__=[],this.size=0}function l7(s){var o=this.__data__,l=fl(o,s);if(l<0)return!1;var p=o.length-1;return l==p?o.pop():sl.call(o,l,1),--this.size,!0}function u7(s){var o=this.__data__,l=fl(o,s);return l<0?t:o[l][1]}function h7(s){return fl(this.__data__,s)>-1}function f7(s,o){var l=this.__data__,p=fl(l,s);return p<0?(++this.size,l.push([s,o])):l[p][1]=o,this}Gn.prototype.clear=c7,Gn.prototype.delete=l7,Gn.prototype.get=u7,Gn.prototype.has=h7,Gn.prototype.set=f7;function Yn(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var p=s[o];this.set(p[0],p[1])}}function d7(){this.size=0,this.__data__={hash:new us,map:new(da||Gn),string:new us}}function p7(s){var o=Il(this,s).delete(s);return this.size-=o?1:0,o}function g7(s){return Il(this,s).get(s)}function m7(s){return Il(this,s).has(s)}function v7(s,o){var l=Il(this,s),p=l.size;return l.set(s,o),this.size+=l.size==p?0:1,this}Yn.prototype.clear=d7,Yn.prototype.delete=p7,Yn.prototype.get=g7,Yn.prototype.has=m7,Yn.prototype.set=v7;function hs(s){var o=-1,l=s==null?0:s.length;for(this.__data__=new Yn;++o<l;)this.add(s[o])}function y7(s){return this.__data__.set(s,f),this}function w7(s){return this.__data__.has(s)}hs.prototype.add=hs.prototype.push=y7,hs.prototype.has=w7;function yn(s){var o=this.__data__=new Gn(s);this.size=o.size}function b7(){this.__data__=new Gn,this.size=0}function _7(s){var o=this.__data__,l=o.delete(s);return this.size=o.size,l}function E7(s){return this.__data__.get(s)}function x7(s){return this.__data__.has(s)}function I7(s,o){var l=this.__data__;if(l instanceof Gn){var p=l.__data__;if(!da||p.length<i-1)return p.push([s,o]),this.size=++l.size,this;l=this.__data__=new Yn(p)}return l.set(s,o),this.size=l.size,this}yn.prototype.clear=b7,yn.prototype.delete=_7,yn.prototype.get=E7,yn.prototype.has=x7,yn.prototype.set=I7;function Vm(s,o){var l=Le(s),p=!l&&ms(s),v=!l&&!p&&Ai(s),D=!l&&!p&&!v&&po(s),R=l||p||v||D,M=R?Uf(s.length,NC):[],z=M.length;for(var te in s)(o||dt.call(s,te))&&!(R&&(te=="length"||v&&(te=="offset"||te=="parent")||D&&(te=="buffer"||te=="byteLength"||te=="byteOffset")||Xn(te,z)))&&M.push(te);return M}function Gm(s){var o=s.length;return o?s[ed(0,o-1)]:t}function D7(s,o){return Dl(jr(s),fs(o,0,s.length))}function S7(s){return Dl(jr(s))}function Hf(s,o,l){(l!==t&&!wn(s[o],l)||l===t&&!(o in s))&&Zn(s,o,l)}function va(s,o,l){var p=s[o];(!(dt.call(s,o)&&wn(p,l))||l===t&&!(o in s))&&Zn(s,o,l)}function fl(s,o){for(var l=s.length;l--;)if(wn(s[l][0],o))return l;return-1}function O7(s,o,l,p){return Si(s,function(v,D,R){o(p,v,l(v),R)}),p}function Ym(s,o){return s&&Rn(o,cr(o),s)}function C7(s,o){return s&&Rn(o,Br(o),s)}function Zn(s,o,l){o=="__proto__"&&ol?ol(s,o,{configurable:!0,enumerable:!0,value:l,writable:!0}):s[o]=l}function Wf(s,o){for(var l=-1,p=o.length,v=G(p),D=s==null;++l<p;)v[l]=D?t:Dd(s,o[l]);return v}function fs(s,o,l){return s===s&&(l!==t&&(s=s<=l?s:l),o!==t&&(s=s>=o?s:o)),s}function ln(s,o,l,p,v,D){var R,M=o&w,z=o&y,te=o&_;if(l&&(R=v?l(s,p,v,D):l(s)),R!==t)return R;if(!Nt(s))return s;var re=Le(s);if(re){if(R=m$(s),!M)return jr(s,R)}else{var oe=mr(s),fe=oe==le||oe==pe;if(Ai(s))return wv(s,M);if(oe==ke||oe==de||fe&&!v){if(R=z||fe?{}:jv(s),!M)return z?s$(s,C7(R,s)):i$(s,Ym(R,s))}else{if(!mt[oe])return v?s:{};R=v$(s,oe,M)}}D||(D=new yn);var ye=D.get(s);if(ye)return ye;D.set(s,R),dy(s)?s.forEach(function(De){R.add(ln(De,o,l,De,s,D))}):hy(s)&&s.forEach(function(De,Qe){R.set(Qe,ln(De,o,l,Qe,s,D))});var Ie=te?z?hd:ud:z?Br:cr,We=re?t:Ie(s);return on(We||s,function(De,Qe){We&&(Qe=De,De=s[Qe]),va(R,Qe,ln(De,o,l,Qe,s,D))}),R}function $7(s){var o=cr(s);return function(l){return Zm(l,s,o)}}function Zm(s,o,l){var p=l.length;if(s==null)return!p;for(s=bt(s);p--;){var v=l[p],D=o[v],R=s[v];if(R===t&&!(v in s)||!D(R))return!1}return!0}function Jm(s,o,l){if(typeof s!="function")throw new an(c);return Ia(function(){s.apply(t,l)},o)}function ya(s,o,l,p){var v=-1,D=Yc,R=!0,M=s.length,z=[],te=o.length;if(!M)return z;l&&(o=Pt(o,Yr(l))),p?(D=Pf,R=!1):o.length>=i&&(D=ha,R=!1,o=new hs(o));e:for(;++v<M;){var re=s[v],oe=l==null?re:l(re);if(re=p||re!==0?re:0,R&&oe===oe){for(var fe=te;fe--;)if(o[fe]===oe)continue e;z.push(re)}else D(o,oe,p)||z.push(re)}return z}var Si=Iv(Tn),Qm=Iv(Vf,!0);function A7(s,o){var l=!0;return Si(s,function(p,v,D){return l=!!o(p,v,D),l}),l}function dl(s,o,l){for(var p=-1,v=s.length;++p<v;){var D=s[p],R=o(D);if(R!=null&&(M===t?R===R&&!Jr(R):l(R,M)))var M=R,z=D}return z}function P7(s,o,l,p){var v=s.length;for(l=qe(l),l<0&&(l=-l>v?0:v+l),p=p===t||p>v?v:qe(p),p<0&&(p+=v),p=l>p?0:gy(p);l<p;)s[l++]=o;return s}function Xm(s,o){var l=[];return Si(s,function(p,v,D){o(p,v,D)&&l.push(p)}),l}function fr(s,o,l,p,v){var D=-1,R=s.length;for(l||(l=w$),v||(v=[]);++D<R;){var M=s[D];o>0&&l(M)?o>1?fr(M,o-1,l,p,v):xi(v,M):p||(v[v.length]=M)}return v}var Kf=Dv(),ev=Dv(!0);function Tn(s,o){return s&&Kf(s,o,cr)}function Vf(s,o){return s&&ev(s,o,cr)}function pl(s,o){return Ei(o,function(l){return ei(s[l])})}function ds(s,o){o=Ci(o,s);for(var l=0,p=o.length;s!=null&&l<p;)s=s[Nn(o[l++])];return l&&l==p?s:t}function tv(s,o,l){var p=o(s);return Le(s)?p:xi(p,l(s))}function Cr(s){return s==null?s===t?He:Ze:ls&&ls in bt(s)?d$(s):S$(s)}function Gf(s,o){return s>o}function T7(s,o){return s!=null&&dt.call(s,o)}function R7(s,o){return s!=null&&o in bt(s)}function N7(s,o,l){return s>=gr(o,l)&&s<nr(o,l)}function Yf(s,o,l){for(var p=l?Pf:Yc,v=s[0].length,D=s.length,R=D,M=G(D),z=1/0,te=[];R--;){var re=s[R];R&&o&&(re=Pt(re,Yr(o))),z=gr(re.length,z),M[R]=!l&&(o||v>=120&&re.length>=120)?new hs(R&&re):t}re=s[0];var oe=-1,fe=M[0];e:for(;++oe<v&&te.length<z;){var ye=re[oe],Ie=o?o(ye):ye;if(ye=l||ye!==0?ye:0,!(fe?ha(fe,Ie):p(te,Ie,l))){for(R=D;--R;){var We=M[R];if(!(We?ha(We,Ie):p(s[R],Ie,l)))continue e}fe&&fe.push(Ie),te.push(ye)}}return te}function L7(s,o,l,p){return Tn(s,function(v,D,R){o(p,l(v),D,R)}),p}function wa(s,o,l){o=Ci(o,s),s=qv(s,o);var p=s==null?s:s[Nn(hn(o))];return p==null?t:ar(p,s,l)}function rv(s){return qt(s)&&Cr(s)==de}function M7(s){return qt(s)&&Cr(s)==Se}function U7(s){return qt(s)&&Cr(s)==B}function ba(s,o,l,p,v){return s===o?!0:s==null||o==null||!qt(s)&&!qt(o)?s!==s&&o!==o:j7(s,o,l,p,ba,v)}function j7(s,o,l,p,v,D){var R=Le(s),M=Le(o),z=R?be:mr(s),te=M?be:mr(o);z=z==de?ke:z,te=te==de?ke:te;var re=z==ke,oe=te==ke,fe=z==te;if(fe&&Ai(s)){if(!Ai(o))return!1;R=!0,re=!1}if(fe&&!re)return D||(D=new yn),R||po(s)?Lv(s,o,l,p,v,D):h$(s,o,z,l,p,v,D);if(!(l&S)){var ye=re&&dt.call(s,"__wrapped__"),Ie=oe&&dt.call(o,"__wrapped__");if(ye||Ie){var We=ye?s.value():s,De=Ie?o.value():o;return D||(D=new yn),v(We,De,l,p,D)}}return fe?(D||(D=new yn),f$(s,o,l,p,v,D)):!1}function F7(s){return qt(s)&&mr(s)==Oe}function Zf(s,o,l,p){var v=l.length,D=v,R=!p;if(s==null)return!D;for(s=bt(s);v--;){var M=l[v];if(R&&M[2]?M[1]!==s[M[0]]:!(M[0]in s))return!1}for(;++v<D;){M=l[v];var z=M[0],te=s[z],re=M[1];if(R&&M[2]){if(te===t&&!(z in s))return!1}else{var oe=new yn;if(p)var fe=p(te,re,z,s,o,oe);if(!(fe===t?ba(re,te,S|P,p,oe):fe))return!1}}return!0}function nv(s){if(!Nt(s)||_$(s))return!1;var o=ei(s)?FC:gf;return o.test(gs(s))}function B7(s){return qt(s)&&Cr(s)==ze}function k7(s){return qt(s)&&mr(s)==Ce}function q7(s){return qt(s)&&Pl(s.length)&&!!vt[Cr(s)]}function iv(s){return typeof s=="function"?s:s==null?kr:typeof s=="object"?Le(s)?av(s[0],s[1]):ov(s):Sy(s)}function Jf(s){if(!xa(s))return WC(s);var o=[];for(var l in bt(s))dt.call(s,l)&&l!="constructor"&&o.push(l);return o}function z7(s){if(!Nt(s))return D$(s);var o=xa(s),l=[];for(var p in s)p=="constructor"&&(o||!dt.call(s,p))||l.push(p);return l}function Qf(s,o){return s<o}function sv(s,o){var l=-1,p=Fr(s)?G(s.length):[];return Si(s,function(v,D,R){p[++l]=o(v,D,R)}),p}function ov(s){var o=dd(s);return o.length==1&&o[0][2]?Bv(o[0][0],o[0][1]):function(l){return l===s||Zf(l,s,o)}}function av(s,o){return gd(s)&&Fv(o)?Bv(Nn(s),o):function(l){var p=Dd(l,s);return p===t&&p===o?Sd(l,s):ba(o,p,S|P)}}function gl(s,o,l,p,v){s!==o&&Kf(o,function(D,R){if(v||(v=new yn),Nt(D))H7(s,o,R,l,gl,p,v);else{var M=p?p(vd(s,R),D,R+"",s,o,v):t;M===t&&(M=D),Hf(s,R,M)}},Br)}function H7(s,o,l,p,v,D,R){var M=vd(s,l),z=vd(o,l),te=R.get(z);if(te){Hf(s,l,te);return}var re=D?D(M,z,l+"",s,o,R):t,oe=re===t;if(oe){var fe=Le(z),ye=!fe&&Ai(z),Ie=!fe&&!ye&&po(z);re=z,fe||ye||Ie?Le(M)?re=M:Kt(M)?re=jr(M):ye?(oe=!1,re=wv(z,!0)):Ie?(oe=!1,re=bv(z,!0)):re=[]:Da(z)||ms(z)?(re=M,ms(M)?re=my(M):(!Nt(M)||ei(M))&&(re=jv(z))):oe=!1}oe&&(R.set(z,re),v(re,z,p,D,R),R.delete(z)),Hf(s,l,re)}function cv(s,o){var l=s.length;if(l)return o+=o<0?l:0,Xn(o,l)?s[o]:t}function lv(s,o,l){o.length?o=Pt(o,function(D){return Le(D)?function(R){return ds(R,D.length===1?D[0]:D)}:D}):o=[kr];var p=-1;o=Pt(o,Yr(_e()));var v=sv(s,function(D,R,M){var z=Pt(o,function(te){return te(D)});return{criteria:z,index:++p,value:D}});return vC(v,function(D,R){return n$(D,R,l)})}function W7(s,o){return uv(s,o,function(l,p){return Sd(s,p)})}function uv(s,o,l){for(var p=-1,v=o.length,D={};++p<v;){var R=o[p],M=ds(s,R);l(M,R)&&_a(D,Ci(R,s),M)}return D}function K7(s){return function(o){return ds(o,s)}}function Xf(s,o,l,p){var v=p?mC:ro,D=-1,R=o.length,M=s;for(s===o&&(o=jr(o)),l&&(M=Pt(s,Yr(l)));++D<R;)for(var z=0,te=o[D],re=l?l(te):te;(z=v(M,re,z,p))>-1;)M!==s&&sl.call(M,z,1),sl.call(s,z,1);return s}function hv(s,o){for(var l=s?o.length:0,p=l-1;l--;){var v=o[l];if(l==p||v!==D){var D=v;Xn(v)?sl.call(s,v,1):nd(s,v)}}return s}function ed(s,o){return s+cl(Wm()*(o-s+1))}function V7(s,o,l,p){for(var v=-1,D=nr(al((o-s)/(l||1)),0),R=G(D);D--;)R[p?D:++v]=s,s+=l;return R}function td(s,o){var l="";if(!s||o<1||o>Y)return l;do o%2&&(l+=s),o=cl(o/2),o&&(s+=s);while(o);return l}function Ge(s,o){return yd(kv(s,o,kr),s+"")}function G7(s){return Gm(go(s))}function Y7(s,o){var l=go(s);return Dl(l,fs(o,0,l.length))}function _a(s,o,l,p){if(!Nt(s))return s;o=Ci(o,s);for(var v=-1,D=o.length,R=D-1,M=s;M!=null&&++v<D;){var z=Nn(o[v]),te=l;if(z==="__proto__"||z==="constructor"||z==="prototype")return s;if(v!=R){var re=M[z];te=p?p(re,z,M):t,te===t&&(te=Nt(re)?re:Xn(o[v+1])?[]:{})}va(M,z,te),M=M[z]}return s}var fv=ll?function(s,o){return ll.set(s,o),s}:kr,Z7=ol?function(s,o){return ol(s,"toString",{configurable:!0,enumerable:!1,value:Cd(o),writable:!0})}:kr;function J7(s){return Dl(go(s))}function un(s,o,l){var p=-1,v=s.length;o<0&&(o=-o>v?0:v+o),l=l>v?v:l,l<0&&(l+=v),v=o>l?0:l-o>>>0,o>>>=0;for(var D=G(v);++p<v;)D[p]=s[p+o];return D}function Q7(s,o){var l;return Si(s,function(p,v,D){return l=o(p,v,D),!l}),!!l}function ml(s,o,l){var p=0,v=s==null?p:s.length;if(typeof o=="number"&&o===o&&v<=ae){for(;p<v;){var D=p+v>>>1,R=s[D];R!==null&&!Jr(R)&&(l?R<=o:R<o)?p=D+1:v=D}return v}return rd(s,o,kr,l)}function rd(s,o,l,p){var v=0,D=s==null?0:s.length;if(D===0)return 0;o=l(o);for(var R=o!==o,M=o===null,z=Jr(o),te=o===t;v<D;){var re=cl((v+D)/2),oe=l(s[re]),fe=oe!==t,ye=oe===null,Ie=oe===oe,We=Jr(oe);if(R)var De=p||Ie;else te?De=Ie&&(p||fe):M?De=Ie&&fe&&(p||!ye):z?De=Ie&&fe&&!ye&&(p||!We):ye||We?De=!1:De=p?oe<=o:oe<o;De?v=re+1:D=re}return gr(D,Ee)}function dv(s,o){for(var l=-1,p=s.length,v=0,D=[];++l<p;){var R=s[l],M=o?o(R):R;if(!l||!wn(M,z)){var z=M;D[v++]=R===0?0:R}}return D}function pv(s){return typeof s=="number"?s:Jr(s)?Q:+s}function Zr(s){if(typeof s=="string")return s;if(Le(s))return Pt(s,Zr)+"";if(Jr(s))return Km?Km.call(s):"";var o=s+"";return o=="0"&&1/s==-ee?"-0":o}function Oi(s,o,l){var p=-1,v=Yc,D=s.length,R=!0,M=[],z=M;if(l)R=!1,v=Pf;else if(D>=i){var te=o?null:l$(s);if(te)return Jc(te);R=!1,v=ha,z=new hs}else z=o?[]:M;e:for(;++p<D;){var re=s[p],oe=o?o(re):re;if(re=l||re!==0?re:0,R&&oe===oe){for(var fe=z.length;fe--;)if(z[fe]===oe)continue e;o&&z.push(oe),M.push(re)}else v(z,oe,l)||(z!==M&&z.push(oe),M.push(re))}return M}function nd(s,o){return o=Ci(o,s),s=qv(s,o),s==null||delete s[Nn(hn(o))]}function gv(s,o,l,p){return _a(s,o,l(ds(s,o)),p)}function vl(s,o,l,p){for(var v=s.length,D=p?v:-1;(p?D--:++D<v)&&o(s[D],D,s););return l?un(s,p?0:D,p?D+1:v):un(s,p?D+1:0,p?v:D)}function mv(s,o){var l=s;return l instanceof tt&&(l=l.value()),Tf(o,function(p,v){return v.func.apply(v.thisArg,xi([p],v.args))},l)}function id(s,o,l){var p=s.length;if(p<2)return p?Oi(s[0]):[];for(var v=-1,D=G(p);++v<p;)for(var R=s[v],M=-1;++M<p;)M!=v&&(D[v]=ya(D[v]||R,s[M],o,l));return Oi(fr(D,1),o,l)}function vv(s,o,l){for(var p=-1,v=s.length,D=o.length,R={};++p<v;){var M=p<D?o[p]:t;l(R,s[p],M)}return R}function sd(s){return Kt(s)?s:[]}function od(s){return typeof s=="function"?s:kr}function Ci(s,o){return Le(s)?s:gd(s,o)?[s]:Kv(ft(s))}var X7=Ge;function $i(s,o,l){var p=s.length;return l=l===t?p:l,!o&&l>=p?s:un(s,o,l)}var yv=BC||function(s){return it.clearTimeout(s)};function wv(s,o){if(o)return s.slice();var l=s.length,p=Bm?Bm(l):new s.constructor(l);return s.copy(p),p}function ad(s){var o=new s.constructor(s.byteLength);return new nl(o).set(new nl(s)),o}function e$(s,o){var l=o?ad(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.byteLength)}function t$(s){var o=new s.constructor(s.source,nn.exec(s));return o.lastIndex=s.lastIndex,o}function r$(s){return ma?bt(ma.call(s)):{}}function bv(s,o){var l=o?ad(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.length)}function _v(s,o){if(s!==o){var l=s!==t,p=s===null,v=s===s,D=Jr(s),R=o!==t,M=o===null,z=o===o,te=Jr(o);if(!M&&!te&&!D&&s>o||D&&R&&z&&!M&&!te||p&&R&&z||!l&&z||!v)return 1;if(!p&&!D&&!te&&s<o||te&&l&&v&&!p&&!D||M&&l&&v||!R&&v||!z)return-1}return 0}function n$(s,o,l){for(var p=-1,v=s.criteria,D=o.criteria,R=v.length,M=l.length;++p<R;){var z=_v(v[p],D[p]);if(z){if(p>=M)return z;var te=l[p];return z*(te=="desc"?-1:1)}}return s.index-o.index}function Ev(s,o,l,p){for(var v=-1,D=s.length,R=l.length,M=-1,z=o.length,te=nr(D-R,0),re=G(z+te),oe=!p;++M<z;)re[M]=o[M];for(;++v<R;)(oe||v<D)&&(re[l[v]]=s[v]);for(;te--;)re[M++]=s[v++];return re}function xv(s,o,l,p){for(var v=-1,D=s.length,R=-1,M=l.length,z=-1,te=o.length,re=nr(D-M,0),oe=G(re+te),fe=!p;++v<re;)oe[v]=s[v];for(var ye=v;++z<te;)oe[ye+z]=o[z];for(;++R<M;)(fe||v<D)&&(oe[ye+l[R]]=s[v++]);return oe}function jr(s,o){var l=-1,p=s.length;for(o||(o=G(p));++l<p;)o[l]=s[l];return o}function Rn(s,o,l,p){var v=!l;l||(l={});for(var D=-1,R=o.length;++D<R;){var M=o[D],z=p?p(l[M],s[M],M,l,s):t;z===t&&(z=s[M]),v?Zn(l,M,z):va(l,M,z)}return l}function i$(s,o){return Rn(s,pd(s),o)}function s$(s,o){return Rn(s,Mv(s),o)}function yl(s,o){return function(l,p){var v=Le(l)?uC:O7,D=o?o():{};return v(l,s,_e(p,2),D)}}function uo(s){return Ge(function(o,l){var p=-1,v=l.length,D=v>1?l[v-1]:t,R=v>2?l[2]:t;for(D=s.length>3&&typeof D=="function"?(v--,D):t,R&&$r(l[0],l[1],R)&&(D=v<3?t:D,v=1),o=bt(o);++p<v;){var M=l[p];M&&s(o,M,p,D)}return o})}function Iv(s,o){return function(l,p){if(l==null)return l;if(!Fr(l))return s(l,p);for(var v=l.length,D=o?v:-1,R=bt(l);(o?D--:++D<v)&&p(R[D],D,R)!==!1;);return l}}function Dv(s){return function(o,l,p){for(var v=-1,D=bt(o),R=p(o),M=R.length;M--;){var z=R[s?M:++v];if(l(D[z],z,D)===!1)break}return o}}function o$(s,o,l){var p=o&j,v=Ea(s);function D(){var R=this&&this!==it&&this instanceof D?v:s;return R.apply(p?l:this,arguments)}return D}function Sv(s){return function(o){o=ft(o);var l=no(o)?vn(o):t,p=l?l[0]:o.charAt(0),v=l?$i(l,1).join(""):o.slice(1);return p[s]()+v}}function ho(s){return function(o){return Tf(Iy(xy(o).replace(la,"")),s,"")}}function Ea(s){return function(){var o=arguments;switch(o.length){case 0:return new s;case 1:return new s(o[0]);case 2:return new s(o[0],o[1]);case 3:return new s(o[0],o[1],o[2]);case 4:return new s(o[0],o[1],o[2],o[3]);case 5:return new s(o[0],o[1],o[2],o[3],o[4]);case 6:return new s(o[0],o[1],o[2],o[3],o[4],o[5]);case 7:return new s(o[0],o[1],o[2],o[3],o[4],o[5],o[6])}var l=lo(s.prototype),p=s.apply(l,o);return Nt(p)?p:l}}function a$(s,o,l){var p=Ea(s);function v(){for(var D=arguments.length,R=G(D),M=D,z=fo(v);M--;)R[M]=arguments[M];var te=D<3&&R[0]!==z&&R[D-1]!==z?[]:Ii(R,z);if(D-=te.length,D<l)return Pv(s,o,wl,v.placeholder,t,R,te,t,t,l-D);var re=this&&this!==it&&this instanceof v?p:s;return ar(re,this,R)}return v}function Ov(s){return function(o,l,p){var v=bt(o);if(!Fr(o)){var D=_e(l,3);o=cr(o),l=function(M){return D(v[M],M,v)}}var R=s(o,l,p);return R>-1?v[D?o[R]:R]:t}}function Cv(s){return Qn(function(o){var l=o.length,p=l,v=cn.prototype.thru;for(s&&o.reverse();p--;){var D=o[p];if(typeof D!="function")throw new an(c);if(v&&!R&&xl(D)=="wrapper")var R=new cn([],!0)}for(p=R?p:l;++p<l;){D=o[p];var M=xl(D),z=M=="wrapper"?fd(D):t;z&&md(z[0])&&z[1]==(d|T|$|b)&&!z[4].length&&z[9]==1?R=R[xl(z[0])].apply(R,z[3]):R=D.length==1&&md(D)?R[M]():R.thru(D)}return function(){var te=arguments,re=te[0];if(R&&te.length==1&&Le(re))return R.plant(re).value();for(var oe=0,fe=l?o[oe].apply(this,te):re;++oe<l;)fe=o[oe].call(this,fe);return fe}})}function wl(s,o,l,p,v,D,R,M,z,te){var re=o&d,oe=o&j,fe=o&U,ye=o&(T|O),Ie=o&H,We=fe?t:Ea(s);function De(){for(var Qe=arguments.length,st=G(Qe),Qr=Qe;Qr--;)st[Qr]=arguments[Qr];if(ye)var Ar=fo(De),Xr=wC(st,Ar);if(p&&(st=Ev(st,p,v,ye)),D&&(st=xv(st,D,R,ye)),Qe-=Xr,ye&&Qe<te){var Vt=Ii(st,Ar);return Pv(s,o,wl,De.placeholder,l,st,Vt,M,z,te-Qe)}var bn=oe?l:this,ri=fe?bn[s]:s;return Qe=st.length,M?st=O$(st,M):Ie&&Qe>1&&st.reverse(),re&&z<Qe&&(st.length=z),this&&this!==it&&this instanceof De&&(ri=We||Ea(ri)),ri.apply(bn,st)}return De}function $v(s,o){return function(l,p){return L7(l,s,o(p),{})}}function bl(s,o){return function(l,p){var v;if(l===t&&p===t)return o;if(l!==t&&(v=l),p!==t){if(v===t)return p;typeof l=="string"||typeof p=="string"?(l=Zr(l),p=Zr(p)):(l=pv(l),p=pv(p)),v=s(l,p)}return v}}function cd(s){return Qn(function(o){return o=Pt(o,Yr(_e())),Ge(function(l){var p=this;return s(o,function(v){return ar(v,p,l)})})})}function _l(s,o){o=o===t?" ":Zr(o);var l=o.length;if(l<2)return l?td(o,s):o;var p=td(o,al(s/io(o)));return no(o)?$i(vn(p),0,s).join(""):p.slice(0,s)}function c$(s,o,l,p){var v=o&j,D=Ea(s);function R(){for(var M=-1,z=arguments.length,te=-1,re=p.length,oe=G(re+z),fe=this&&this!==it&&this instanceof R?D:s;++te<re;)oe[te]=p[te];for(;z--;)oe[te++]=arguments[++M];return ar(fe,v?l:this,oe)}return R}function Av(s){return function(o,l,p){return p&&typeof p!="number"&&$r(o,l,p)&&(l=p=t),o=ti(o),l===t?(l=o,o=0):l=ti(l),p=p===t?o<l?1:-1:ti(p),V7(o,l,p,s)}}function El(s){return function(o,l){return typeof o=="string"&&typeof l=="string"||(o=fn(o),l=fn(l)),s(o,l)}}function Pv(s,o,l,p,v,D,R,M,z,te){var re=o&T,oe=re?R:t,fe=re?t:R,ye=re?D:t,Ie=re?t:D;o|=re?$:x,o&=~(re?x:$),o&A||(o&=~(j|U));var We=[s,o,v,ye,oe,Ie,fe,M,z,te],De=l.apply(t,We);return md(s)&&zv(De,We),De.placeholder=p,Hv(De,s,o)}function ld(s){var o=rr[s];return function(l,p){if(l=fn(l),p=p==null?0:gr(qe(p),292),p&&Hm(l)){var v=(ft(l)+"e").split("e"),D=o(v[0]+"e"+(+v[1]+p));return v=(ft(D)+"e").split("e"),+(v[0]+"e"+(+v[1]-p))}return o(l)}}var l$=ao&&1/Jc(new ao([,-0]))[1]==ee?function(s){return new ao(s)}:Pd;function Tv(s){return function(o){var l=mr(o);return l==Oe?Ff(o):l==Ce?SC(o):yC(o,s(o))}}function Jn(s,o,l,p,v,D,R,M){var z=o&U;if(!z&&typeof s!="function")throw new an(c);var te=p?p.length:0;if(te||(o&=~($|x),p=v=t),R=R===t?R:nr(qe(R),0),M=M===t?M:qe(M),te-=v?v.length:0,o&x){var re=p,oe=v;p=v=t}var fe=z?t:fd(s),ye=[s,o,l,p,v,re,oe,D,R,M];if(fe&&I$(ye,fe),s=ye[0],o=ye[1],l=ye[2],p=ye[3],v=ye[4],M=ye[9]=ye[9]===t?z?0:s.length:nr(ye[9]-te,0),!M&&o&(T|O)&&(o&=~(T|O)),!o||o==j)var Ie=o$(s,o,l);else o==T||o==O?Ie=a$(s,o,M):(o==$||o==(j|$))&&!v.length?Ie=c$(s,o,l,p):Ie=wl.apply(t,ye);var We=fe?fv:zv;return Hv(We(Ie,ye),s,o)}function Rv(s,o,l,p){return s===t||wn(s,oo[l])&&!dt.call(p,l)?o:s}function Nv(s,o,l,p,v,D){return Nt(s)&&Nt(o)&&(D.set(o,s),gl(s,o,t,Nv,D),D.delete(o)),s}function u$(s){return Da(s)?t:s}function Lv(s,o,l,p,v,D){var R=l&S,M=s.length,z=o.length;if(M!=z&&!(R&&z>M))return!1;var te=D.get(s),re=D.get(o);if(te&&re)return te==o&&re==s;var oe=-1,fe=!0,ye=l&P?new hs:t;for(D.set(s,o),D.set(o,s);++oe<M;){var Ie=s[oe],We=o[oe];if(p)var De=R?p(We,Ie,oe,o,s,D):p(Ie,We,oe,s,o,D);if(De!==t){if(De)continue;fe=!1;break}if(ye){if(!Rf(o,function(Qe,st){if(!ha(ye,st)&&(Ie===Qe||v(Ie,Qe,l,p,D)))return ye.push(st)})){fe=!1;break}}else if(!(Ie===We||v(Ie,We,l,p,D))){fe=!1;break}}return D.delete(s),D.delete(o),fe}function h$(s,o,l,p,v,D,R){switch(l){case Te:if(s.byteLength!=o.byteLength||s.byteOffset!=o.byteOffset)return!1;s=s.buffer,o=o.buffer;case Se:return!(s.byteLength!=o.byteLength||!D(new nl(s),new nl(o)));case W:case B:case Ke:return wn(+s,+o);case L:return s.name==o.name&&s.message==o.message;case ze:case Ue:return s==o+"";case Oe:var M=Ff;case Ce:var z=p&S;if(M||(M=Jc),s.size!=o.size&&!z)return!1;var te=R.get(s);if(te)return te==o;p|=P,R.set(s,o);var re=Lv(M(s),M(o),p,v,D,R);return R.delete(s),re;case je:if(ma)return ma.call(s)==ma.call(o)}return!1}function f$(s,o,l,p,v,D){var R=l&S,M=ud(s),z=M.length,te=ud(o),re=te.length;if(z!=re&&!R)return!1;for(var oe=z;oe--;){var fe=M[oe];if(!(R?fe in o:dt.call(o,fe)))return!1}var ye=D.get(s),Ie=D.get(o);if(ye&&Ie)return ye==o&&Ie==s;var We=!0;D.set(s,o),D.set(o,s);for(var De=R;++oe<z;){fe=M[oe];var Qe=s[fe],st=o[fe];if(p)var Qr=R?p(st,Qe,fe,o,s,D):p(Qe,st,fe,s,o,D);if(!(Qr===t?Qe===st||v(Qe,st,l,p,D):Qr)){We=!1;break}De||(De=fe=="constructor")}if(We&&!De){var Ar=s.constructor,Xr=o.constructor;Ar!=Xr&&"constructor"in s&&"constructor"in o&&!(typeof Ar=="function"&&Ar instanceof Ar&&typeof Xr=="function"&&Xr instanceof Xr)&&(We=!1)}return D.delete(s),D.delete(o),We}function Qn(s){return yd(kv(s,t,Zv),s+"")}function ud(s){return tv(s,cr,pd)}function hd(s){return tv(s,Br,Mv)}var fd=ll?function(s){return ll.get(s)}:Pd;function xl(s){for(var o=s.name+"",l=co[o],p=dt.call(co,o)?l.length:0;p--;){var v=l[p],D=v.func;if(D==null||D==s)return v.name}return o}function fo(s){var o=dt.call(E,"placeholder")?E:s;return o.placeholder}function _e(){var s=E.iteratee||$d;return s=s===$d?iv:s,arguments.length?s(arguments[0],arguments[1]):s}function Il(s,o){var l=s.__data__;return b$(o)?l[typeof o=="string"?"string":"hash"]:l.map}function dd(s){for(var o=cr(s),l=o.length;l--;){var p=o[l],v=s[p];o[l]=[p,v,Fv(v)]}return o}function ps(s,o){var l=xC(s,o);return nv(l)?l:t}function d$(s){var o=dt.call(s,ls),l=s[ls];try{s[ls]=t;var p=!0}catch{}var v=tl.call(s);return p&&(o?s[ls]=l:delete s[ls]),v}var pd=kf?function(s){return s==null?[]:(s=bt(s),Ei(kf(s),function(o){return qm.call(s,o)}))}:Td,Mv=kf?function(s){for(var o=[];s;)xi(o,pd(s)),s=il(s);return o}:Td,mr=Cr;(qf&&mr(new qf(new ArrayBuffer(1)))!=Te||da&&mr(new da)!=Oe||zf&&mr(zf.resolve())!=Ot||ao&&mr(new ao)!=Ce||pa&&mr(new pa)!=Ae)&&(mr=function(s){var o=Cr(s),l=o==ke?s.constructor:t,p=l?gs(l):"";if(p)switch(p){case YC:return Te;case ZC:return Oe;case JC:return Ot;case QC:return Ce;case XC:return Ae}return o});function p$(s,o,l){for(var p=-1,v=l.length;++p<v;){var D=l[p],R=D.size;switch(D.type){case"drop":s+=R;break;case"dropRight":o-=R;break;case"take":o=gr(o,s+R);break;case"takeRight":s=nr(s,o-R);break}}return{start:s,end:o}}function g$(s){var o=s.match(Et);return o?o[1].split(Jt):[]}function Uv(s,o,l){o=Ci(o,s);for(var p=-1,v=o.length,D=!1;++p<v;){var R=Nn(o[p]);if(!(D=s!=null&&l(s,R)))break;s=s[R]}return D||++p!=v?D:(v=s==null?0:s.length,!!v&&Pl(v)&&Xn(R,v)&&(Le(s)||ms(s)))}function m$(s){var o=s.length,l=new s.constructor(o);return o&&typeof s[0]=="string"&&dt.call(s,"index")&&(l.index=s.index,l.input=s.input),l}function jv(s){return typeof s.constructor=="function"&&!xa(s)?lo(il(s)):{}}function v$(s,o,l){var p=s.constructor;switch(o){case Se:return ad(s);case W:case B:return new p(+s);case Te:return e$(s,l);case Ve:case $e:case Je:case et:case at:case ct:case nt:case Dr:case Mr:return bv(s,l);case Oe:return new p;case Ke:case Ue:return new p(s);case ze:return t$(s);case Ce:return new p;case je:return r$(s)}}function y$(s,o){var l=o.length;if(!l)return s;var p=l-1;return o[p]=(l>1?"& ":"")+o[p],o=o.join(l>2?", ":" "),s.replace(kt,`{
67
- /* [wrapped with `+o+`] */
68
- `)}function w$(s){return Le(s)||ms(s)||!!(zm&&s&&s[zm])}function Xn(s,o){var l=typeof s;return o=o??Y,!!o&&(l=="number"||l!="symbol"&&vf.test(s))&&s>-1&&s%1==0&&s<o}function $r(s,o,l){if(!Nt(l))return!1;var p=typeof o;return(p=="number"?Fr(l)&&Xn(o,l.length):p=="string"&&o in l)?wn(l[o],s):!1}function gd(s,o){if(Le(s))return!1;var l=typeof s;return l=="number"||l=="symbol"||l=="boolean"||s==null||Jr(s)?!0:Gt.test(s)||!At.test(s)||o!=null&&s in bt(o)}function b$(s){var o=typeof s;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?s!=="__proto__":s===null}function md(s){var o=xl(s),l=E[o];if(typeof l!="function"||!(o in tt.prototype))return!1;if(s===l)return!0;var p=fd(l);return!!p&&s===p[0]}function _$(s){return!!Fm&&Fm in s}var E$=Xc?ei:Rd;function xa(s){var o=s&&s.constructor,l=typeof o=="function"&&o.prototype||oo;return s===l}function Fv(s){return s===s&&!Nt(s)}function Bv(s,o){return function(l){return l==null?!1:l[s]===o&&(o!==t||s in bt(l))}}function x$(s){var o=$l(s,function(p){return l.size===h&&l.clear(),p}),l=o.cache;return o}function I$(s,o){var l=s[1],p=o[1],v=l|p,D=v<(j|U|d),R=p==d&&l==T||p==d&&l==b&&s[7].length<=o[8]||p==(d|b)&&o[7].length<=o[8]&&l==T;if(!(D||R))return s;p&j&&(s[2]=o[2],v|=l&j?0:A);var M=o[3];if(M){var z=s[3];s[3]=z?Ev(z,M,o[4]):M,s[4]=z?Ii(s[3],m):o[4]}return M=o[5],M&&(z=s[5],s[5]=z?xv(z,M,o[6]):M,s[6]=z?Ii(s[5],m):o[6]),M=o[7],M&&(s[7]=M),p&d&&(s[8]=s[8]==null?o[8]:gr(s[8],o[8])),s[9]==null&&(s[9]=o[9]),s[0]=o[0],s[1]=v,s}function D$(s){var o=[];if(s!=null)for(var l in bt(s))o.push(l);return o}function S$(s){return tl.call(s)}function kv(s,o,l){return o=nr(o===t?s.length-1:o,0),function(){for(var p=arguments,v=-1,D=nr(p.length-o,0),R=G(D);++v<D;)R[v]=p[o+v];v=-1;for(var M=G(o+1);++v<o;)M[v]=p[v];return M[o]=l(R),ar(s,this,M)}}function qv(s,o){return o.length<2?s:ds(s,un(o,0,-1))}function O$(s,o){for(var l=s.length,p=gr(o.length,l),v=jr(s);p--;){var D=o[p];s[p]=Xn(D,l)?v[D]:t}return s}function vd(s,o){if(!(o==="constructor"&&typeof s[o]=="function")&&o!="__proto__")return s[o]}var zv=Wv(fv),Ia=qC||function(s,o){return it.setTimeout(s,o)},yd=Wv(Z7);function Hv(s,o,l){var p=o+"";return yd(s,y$(p,C$(g$(p),l)))}function Wv(s){var o=0,l=0;return function(){var p=KC(),v=ce-(p-l);if(l=p,v>0){if(++o>=se)return arguments[0]}else o=0;return s.apply(t,arguments)}}function Dl(s,o){var l=-1,p=s.length,v=p-1;for(o=o===t?p:o;++l<o;){var D=ed(l,v),R=s[D];s[D]=s[l],s[l]=R}return s.length=o,s}var Kv=x$(function(s){var o=[];return s.charCodeAt(0)===46&&o.push(""),s.replace(Yt,function(l,p,v,D){o.push(v?D.replace(hf,"$1"):p||l)}),o});function Nn(s){if(typeof s=="string"||Jr(s))return s;var o=s+"";return o=="0"&&1/s==-ee?"-0":o}function gs(s){if(s!=null){try{return el.call(s)}catch{}try{return s+""}catch{}}return""}function C$(s,o){return on(xe,function(l){var p="_."+l[0];o&l[1]&&!Yc(s,p)&&s.push(p)}),s.sort()}function Vv(s){if(s instanceof tt)return s.clone();var o=new cn(s.__wrapped__,s.__chain__);return o.__actions__=jr(s.__actions__),o.__index__=s.__index__,o.__values__=s.__values__,o}function $$(s,o,l){(l?$r(s,o,l):o===t)?o=1:o=nr(qe(o),0);var p=s==null?0:s.length;if(!p||o<1)return[];for(var v=0,D=0,R=G(al(p/o));v<p;)R[D++]=un(s,v,v+=o);return R}function A$(s){for(var o=-1,l=s==null?0:s.length,p=0,v=[];++o<l;){var D=s[o];D&&(v[p++]=D)}return v}function P$(){var s=arguments.length;if(!s)return[];for(var o=G(s-1),l=arguments[0],p=s;p--;)o[p-1]=arguments[p];return xi(Le(l)?jr(l):[l],fr(o,1))}var T$=Ge(function(s,o){return Kt(s)?ya(s,fr(o,1,Kt,!0)):[]}),R$=Ge(function(s,o){var l=hn(o);return Kt(l)&&(l=t),Kt(s)?ya(s,fr(o,1,Kt,!0),_e(l,2)):[]}),N$=Ge(function(s,o){var l=hn(o);return Kt(l)&&(l=t),Kt(s)?ya(s,fr(o,1,Kt,!0),t,l):[]});function L$(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:qe(o),un(s,o<0?0:o,p)):[]}function M$(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:qe(o),o=p-o,un(s,0,o<0?0:o)):[]}function U$(s,o){return s&&s.length?vl(s,_e(o,3),!0,!0):[]}function j$(s,o){return s&&s.length?vl(s,_e(o,3),!0):[]}function F$(s,o,l,p){var v=s==null?0:s.length;return v?(l&&typeof l!="number"&&$r(s,o,l)&&(l=0,p=v),P7(s,o,l,p)):[]}function Gv(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=l==null?0:qe(l);return v<0&&(v=nr(p+v,0)),Zc(s,_e(o,3),v)}function Yv(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=p-1;return l!==t&&(v=qe(l),v=l<0?nr(p+v,0):gr(v,p-1)),Zc(s,_e(o,3),v,!0)}function Zv(s){var o=s==null?0:s.length;return o?fr(s,1):[]}function B$(s){var o=s==null?0:s.length;return o?fr(s,ee):[]}function k$(s,o){var l=s==null?0:s.length;return l?(o=o===t?1:qe(o),fr(s,o)):[]}function q$(s){for(var o=-1,l=s==null?0:s.length,p={};++o<l;){var v=s[o];p[v[0]]=v[1]}return p}function Jv(s){return s&&s.length?s[0]:t}function z$(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=l==null?0:qe(l);return v<0&&(v=nr(p+v,0)),ro(s,o,v)}function H$(s){var o=s==null?0:s.length;return o?un(s,0,-1):[]}var W$=Ge(function(s){var o=Pt(s,sd);return o.length&&o[0]===s[0]?Yf(o):[]}),K$=Ge(function(s){var o=hn(s),l=Pt(s,sd);return o===hn(l)?o=t:l.pop(),l.length&&l[0]===s[0]?Yf(l,_e(o,2)):[]}),V$=Ge(function(s){var o=hn(s),l=Pt(s,sd);return o=typeof o=="function"?o:t,o&&l.pop(),l.length&&l[0]===s[0]?Yf(l,t,o):[]});function G$(s,o){return s==null?"":HC.call(s,o)}function hn(s){var o=s==null?0:s.length;return o?s[o-1]:t}function Y$(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=p;return l!==t&&(v=qe(l),v=v<0?nr(p+v,0):gr(v,p-1)),o===o?CC(s,o,v):Zc(s,Pm,v,!0)}function Z$(s,o){return s&&s.length?cv(s,qe(o)):t}var J$=Ge(Qv);function Qv(s,o){return s&&s.length&&o&&o.length?Xf(s,o):s}function Q$(s,o,l){return s&&s.length&&o&&o.length?Xf(s,o,_e(l,2)):s}function X$(s,o,l){return s&&s.length&&o&&o.length?Xf(s,o,t,l):s}var eA=Qn(function(s,o){var l=s==null?0:s.length,p=Wf(s,o);return hv(s,Pt(o,function(v){return Xn(v,l)?+v:v}).sort(_v)),p});function tA(s,o){var l=[];if(!(s&&s.length))return l;var p=-1,v=[],D=s.length;for(o=_e(o,3);++p<D;){var R=s[p];o(R,p,s)&&(l.push(R),v.push(p))}return hv(s,v),l}function wd(s){return s==null?s:GC.call(s)}function rA(s,o,l){var p=s==null?0:s.length;return p?(l&&typeof l!="number"&&$r(s,o,l)?(o=0,l=p):(o=o==null?0:qe(o),l=l===t?p:qe(l)),un(s,o,l)):[]}function nA(s,o){return ml(s,o)}function iA(s,o,l){return rd(s,o,_e(l,2))}function sA(s,o){var l=s==null?0:s.length;if(l){var p=ml(s,o);if(p<l&&wn(s[p],o))return p}return-1}function oA(s,o){return ml(s,o,!0)}function aA(s,o,l){return rd(s,o,_e(l,2),!0)}function cA(s,o){var l=s==null?0:s.length;if(l){var p=ml(s,o,!0)-1;if(wn(s[p],o))return p}return-1}function lA(s){return s&&s.length?dv(s):[]}function uA(s,o){return s&&s.length?dv(s,_e(o,2)):[]}function hA(s){var o=s==null?0:s.length;return o?un(s,1,o):[]}function fA(s,o,l){return s&&s.length?(o=l||o===t?1:qe(o),un(s,0,o<0?0:o)):[]}function dA(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:qe(o),o=p-o,un(s,o<0?0:o,p)):[]}function pA(s,o){return s&&s.length?vl(s,_e(o,3),!1,!0):[]}function gA(s,o){return s&&s.length?vl(s,_e(o,3)):[]}var mA=Ge(function(s){return Oi(fr(s,1,Kt,!0))}),vA=Ge(function(s){var o=hn(s);return Kt(o)&&(o=t),Oi(fr(s,1,Kt,!0),_e(o,2))}),yA=Ge(function(s){var o=hn(s);return o=typeof o=="function"?o:t,Oi(fr(s,1,Kt,!0),t,o)});function wA(s){return s&&s.length?Oi(s):[]}function bA(s,o){return s&&s.length?Oi(s,_e(o,2)):[]}function _A(s,o){return o=typeof o=="function"?o:t,s&&s.length?Oi(s,t,o):[]}function bd(s){if(!(s&&s.length))return[];var o=0;return s=Ei(s,function(l){if(Kt(l))return o=nr(l.length,o),!0}),Uf(o,function(l){return Pt(s,Nf(l))})}function Xv(s,o){if(!(s&&s.length))return[];var l=bd(s);return o==null?l:Pt(l,function(p){return ar(o,t,p)})}var EA=Ge(function(s,o){return Kt(s)?ya(s,o):[]}),xA=Ge(function(s){return id(Ei(s,Kt))}),IA=Ge(function(s){var o=hn(s);return Kt(o)&&(o=t),id(Ei(s,Kt),_e(o,2))}),DA=Ge(function(s){var o=hn(s);return o=typeof o=="function"?o:t,id(Ei(s,Kt),t,o)}),SA=Ge(bd);function OA(s,o){return vv(s||[],o||[],va)}function CA(s,o){return vv(s||[],o||[],_a)}var $A=Ge(function(s){var o=s.length,l=o>1?s[o-1]:t;return l=typeof l=="function"?(s.pop(),l):t,Xv(s,l)});function ey(s){var o=E(s);return o.__chain__=!0,o}function AA(s,o){return o(s),s}function Sl(s,o){return o(s)}var PA=Qn(function(s){var o=s.length,l=o?s[0]:0,p=this.__wrapped__,v=function(D){return Wf(D,s)};return o>1||this.__actions__.length||!(p instanceof tt)||!Xn(l)?this.thru(v):(p=p.slice(l,+l+(o?1:0)),p.__actions__.push({func:Sl,args:[v],thisArg:t}),new cn(p,this.__chain__).thru(function(D){return o&&!D.length&&D.push(t),D}))});function TA(){return ey(this)}function RA(){return new cn(this.value(),this.__chain__)}function NA(){this.__values__===t&&(this.__values__=py(this.value()));var s=this.__index__>=this.__values__.length,o=s?t:this.__values__[this.__index__++];return{done:s,value:o}}function LA(){return this}function MA(s){for(var o,l=this;l instanceof hl;){var p=Vv(l);p.__index__=0,p.__values__=t,o?v.__wrapped__=p:o=p;var v=p;l=l.__wrapped__}return v.__wrapped__=s,o}function UA(){var s=this.__wrapped__;if(s instanceof tt){var o=s;return this.__actions__.length&&(o=new tt(this)),o=o.reverse(),o.__actions__.push({func:Sl,args:[wd],thisArg:t}),new cn(o,this.__chain__)}return this.thru(wd)}function jA(){return mv(this.__wrapped__,this.__actions__)}var FA=yl(function(s,o,l){dt.call(s,l)?++s[l]:Zn(s,l,1)});function BA(s,o,l){var p=Le(s)?$m:A7;return l&&$r(s,o,l)&&(o=t),p(s,_e(o,3))}function kA(s,o){var l=Le(s)?Ei:Xm;return l(s,_e(o,3))}var qA=Ov(Gv),zA=Ov(Yv);function HA(s,o){return fr(Ol(s,o),1)}function WA(s,o){return fr(Ol(s,o),ee)}function KA(s,o,l){return l=l===t?1:qe(l),fr(Ol(s,o),l)}function ty(s,o){var l=Le(s)?on:Si;return l(s,_e(o,3))}function ry(s,o){var l=Le(s)?hC:Qm;return l(s,_e(o,3))}var VA=yl(function(s,o,l){dt.call(s,l)?s[l].push(o):Zn(s,l,[o])});function GA(s,o,l,p){s=Fr(s)?s:go(s),l=l&&!p?qe(l):0;var v=s.length;return l<0&&(l=nr(v+l,0)),Tl(s)?l<=v&&s.indexOf(o,l)>-1:!!v&&ro(s,o,l)>-1}var YA=Ge(function(s,o,l){var p=-1,v=typeof o=="function",D=Fr(s)?G(s.length):[];return Si(s,function(R){D[++p]=v?ar(o,R,l):wa(R,o,l)}),D}),ZA=yl(function(s,o,l){Zn(s,l,o)});function Ol(s,o){var l=Le(s)?Pt:sv;return l(s,_e(o,3))}function JA(s,o,l,p){return s==null?[]:(Le(o)||(o=o==null?[]:[o]),l=p?t:l,Le(l)||(l=l==null?[]:[l]),lv(s,o,l))}var QA=yl(function(s,o,l){s[l?0:1].push(o)},function(){return[[],[]]});function XA(s,o,l){var p=Le(s)?Tf:Rm,v=arguments.length<3;return p(s,_e(o,4),l,v,Si)}function eP(s,o,l){var p=Le(s)?fC:Rm,v=arguments.length<3;return p(s,_e(o,4),l,v,Qm)}function tP(s,o){var l=Le(s)?Ei:Xm;return l(s,Al(_e(o,3)))}function rP(s){var o=Le(s)?Gm:G7;return o(s)}function nP(s,o,l){(l?$r(s,o,l):o===t)?o=1:o=qe(o);var p=Le(s)?D7:Y7;return p(s,o)}function iP(s){var o=Le(s)?S7:J7;return o(s)}function sP(s){if(s==null)return 0;if(Fr(s))return Tl(s)?io(s):s.length;var o=mr(s);return o==Oe||o==Ce?s.size:Jf(s).length}function oP(s,o,l){var p=Le(s)?Rf:Q7;return l&&$r(s,o,l)&&(o=t),p(s,_e(o,3))}var aP=Ge(function(s,o){if(s==null)return[];var l=o.length;return l>1&&$r(s,o[0],o[1])?o=[]:l>2&&$r(o[0],o[1],o[2])&&(o=[o[0]]),lv(s,fr(o,1),[])}),Cl=kC||function(){return it.Date.now()};function cP(s,o){if(typeof o!="function")throw new an(c);return s=qe(s),function(){if(--s<1)return o.apply(this,arguments)}}function ny(s,o,l){return o=l?t:o,o=s&&o==null?s.length:o,Jn(s,d,t,t,t,t,o)}function iy(s,o){var l;if(typeof o!="function")throw new an(c);return s=qe(s),function(){return--s>0&&(l=o.apply(this,arguments)),s<=1&&(o=t),l}}var _d=Ge(function(s,o,l){var p=j;if(l.length){var v=Ii(l,fo(_d));p|=$}return Jn(s,p,o,l,v)}),sy=Ge(function(s,o,l){var p=j|U;if(l.length){var v=Ii(l,fo(sy));p|=$}return Jn(o,p,s,l,v)});function oy(s,o,l){o=l?t:o;var p=Jn(s,T,t,t,t,t,t,o);return p.placeholder=oy.placeholder,p}function ay(s,o,l){o=l?t:o;var p=Jn(s,O,t,t,t,t,t,o);return p.placeholder=ay.placeholder,p}function cy(s,o,l){var p,v,D,R,M,z,te=0,re=!1,oe=!1,fe=!0;if(typeof s!="function")throw new an(c);o=fn(o)||0,Nt(l)&&(re=!!l.leading,oe="maxWait"in l,D=oe?nr(fn(l.maxWait)||0,o):D,fe="trailing"in l?!!l.trailing:fe);function ye(Vt){var bn=p,ri=v;return p=v=t,te=Vt,R=s.apply(ri,bn),R}function Ie(Vt){return te=Vt,M=Ia(Qe,o),re?ye(Vt):R}function We(Vt){var bn=Vt-z,ri=Vt-te,Oy=o-bn;return oe?gr(Oy,D-ri):Oy}function De(Vt){var bn=Vt-z,ri=Vt-te;return z===t||bn>=o||bn<0||oe&&ri>=D}function Qe(){var Vt=Cl();if(De(Vt))return st(Vt);M=Ia(Qe,We(Vt))}function st(Vt){return M=t,fe&&p?ye(Vt):(p=v=t,R)}function Qr(){M!==t&&yv(M),te=0,p=z=v=M=t}function Ar(){return M===t?R:st(Cl())}function Xr(){var Vt=Cl(),bn=De(Vt);if(p=arguments,v=this,z=Vt,bn){if(M===t)return Ie(z);if(oe)return yv(M),M=Ia(Qe,o),ye(z)}return M===t&&(M=Ia(Qe,o)),R}return Xr.cancel=Qr,Xr.flush=Ar,Xr}var lP=Ge(function(s,o){return Jm(s,1,o)}),uP=Ge(function(s,o,l){return Jm(s,fn(o)||0,l)});function hP(s){return Jn(s,H)}function $l(s,o){if(typeof s!="function"||o!=null&&typeof o!="function")throw new an(c);var l=function(){var p=arguments,v=o?o.apply(this,p):p[0],D=l.cache;if(D.has(v))return D.get(v);var R=s.apply(this,p);return l.cache=D.set(v,R)||D,R};return l.cache=new($l.Cache||Yn),l}$l.Cache=Yn;function Al(s){if(typeof s!="function")throw new an(c);return function(){var o=arguments;switch(o.length){case 0:return!s.call(this);case 1:return!s.call(this,o[0]);case 2:return!s.call(this,o[0],o[1]);case 3:return!s.call(this,o[0],o[1],o[2])}return!s.apply(this,o)}}function fP(s){return iy(2,s)}var dP=X7(function(s,o){o=o.length==1&&Le(o[0])?Pt(o[0],Yr(_e())):Pt(fr(o,1),Yr(_e()));var l=o.length;return Ge(function(p){for(var v=-1,D=gr(p.length,l);++v<D;)p[v]=o[v].call(this,p[v]);return ar(s,this,p)})}),Ed=Ge(function(s,o){var l=Ii(o,fo(Ed));return Jn(s,$,t,o,l)}),ly=Ge(function(s,o){var l=Ii(o,fo(ly));return Jn(s,x,t,o,l)}),pP=Qn(function(s,o){return Jn(s,b,t,t,t,o)});function gP(s,o){if(typeof s!="function")throw new an(c);return o=o===t?o:qe(o),Ge(s,o)}function mP(s,o){if(typeof s!="function")throw new an(c);return o=o==null?0:nr(qe(o),0),Ge(function(l){var p=l[o],v=$i(l,0,o);return p&&xi(v,p),ar(s,this,v)})}function vP(s,o,l){var p=!0,v=!0;if(typeof s!="function")throw new an(c);return Nt(l)&&(p="leading"in l?!!l.leading:p,v="trailing"in l?!!l.trailing:v),cy(s,o,{leading:p,maxWait:o,trailing:v})}function yP(s){return ny(s,1)}function wP(s,o){return Ed(od(o),s)}function bP(){if(!arguments.length)return[];var s=arguments[0];return Le(s)?s:[s]}function _P(s){return ln(s,_)}function EP(s,o){return o=typeof o=="function"?o:t,ln(s,_,o)}function xP(s){return ln(s,w|_)}function IP(s,o){return o=typeof o=="function"?o:t,ln(s,w|_,o)}function DP(s,o){return o==null||Zm(s,o,cr(o))}function wn(s,o){return s===o||s!==s&&o!==o}var SP=El(Gf),OP=El(function(s,o){return s>=o}),ms=rv(function(){return arguments}())?rv:function(s){return qt(s)&&dt.call(s,"callee")&&!qm.call(s,"callee")},Le=G.isArray,CP=Or?Yr(Or):M7;function Fr(s){return s!=null&&Pl(s.length)&&!ei(s)}function Kt(s){return qt(s)&&Fr(s)}function $P(s){return s===!0||s===!1||qt(s)&&Cr(s)==W}var Ai=zC||Rd,AP=mn?Yr(mn):U7;function PP(s){return qt(s)&&s.nodeType===1&&!Da(s)}function TP(s){if(s==null)return!0;if(Fr(s)&&(Le(s)||typeof s=="string"||typeof s.splice=="function"||Ai(s)||po(s)||ms(s)))return!s.length;var o=mr(s);if(o==Oe||o==Ce)return!s.size;if(xa(s))return!Jf(s).length;for(var l in s)if(dt.call(s,l))return!1;return!0}function RP(s,o){return ba(s,o)}function NP(s,o,l){l=typeof l=="function"?l:t;var p=l?l(s,o):t;return p===t?ba(s,o,t,l):!!p}function xd(s){if(!qt(s))return!1;var o=Cr(s);return o==L||o==g||typeof s.message=="string"&&typeof s.name=="string"&&!Da(s)}function LP(s){return typeof s=="number"&&Hm(s)}function ei(s){if(!Nt(s))return!1;var o=Cr(s);return o==le||o==pe||o==K||o==Ct}function uy(s){return typeof s=="number"&&s==qe(s)}function Pl(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=Y}function Nt(s){var o=typeof s;return s!=null&&(o=="object"||o=="function")}function qt(s){return s!=null&&typeof s=="object"}var hy=sn?Yr(sn):F7;function MP(s,o){return s===o||Zf(s,o,dd(o))}function UP(s,o,l){return l=typeof l=="function"?l:t,Zf(s,o,dd(o),l)}function jP(s){return fy(s)&&s!=+s}function FP(s){if(E$(s))throw new Re(a);return nv(s)}function BP(s){return s===null}function kP(s){return s==null}function fy(s){return typeof s=="number"||qt(s)&&Cr(s)==Ke}function Da(s){if(!qt(s)||Cr(s)!=ke)return!1;var o=il(s);if(o===null)return!0;var l=dt.call(o,"constructor")&&o.constructor;return typeof l=="function"&&l instanceof l&&el.call(l)==UC}var Id=Pn?Yr(Pn):B7;function qP(s){return uy(s)&&s>=-Y&&s<=Y}var dy=ua?Yr(ua):k7;function Tl(s){return typeof s=="string"||!Le(s)&&qt(s)&&Cr(s)==Ue}function Jr(s){return typeof s=="symbol"||qt(s)&&Cr(s)==je}var po=cs?Yr(cs):q7;function zP(s){return s===t}function HP(s){return qt(s)&&mr(s)==Ae}function WP(s){return qt(s)&&Cr(s)==Fe}var KP=El(Qf),VP=El(function(s,o){return s<=o});function py(s){if(!s)return[];if(Fr(s))return Tl(s)?vn(s):jr(s);if(fa&&s[fa])return DC(s[fa]());var o=mr(s),l=o==Oe?Ff:o==Ce?Jc:go;return l(s)}function ti(s){if(!s)return s===0?s:0;if(s=fn(s),s===ee||s===-ee){var o=s<0?-1:1;return o*Z}return s===s?s:0}function qe(s){var o=ti(s),l=o%1;return o===o?l?o-l:o:0}function gy(s){return s?fs(qe(s),0,ie):0}function fn(s){if(typeof s=="number")return s;if(Jr(s))return Q;if(Nt(s)){var o=typeof s.valueOf=="function"?s.valueOf():s;s=Nt(o)?o+"":o}if(typeof s!="string")return s===0?s:+s;s=Nm(s);var l=pf.test(s);return l||mf.test(s)?Ne(s.slice(2),l?2:8):df.test(s)?Q:+s}function my(s){return Rn(s,Br(s))}function GP(s){return s?fs(qe(s),-Y,Y):s===0?s:0}function ft(s){return s==null?"":Zr(s)}var YP=uo(function(s,o){if(xa(o)||Fr(o)){Rn(o,cr(o),s);return}for(var l in o)dt.call(o,l)&&va(s,l,o[l])}),vy=uo(function(s,o){Rn(o,Br(o),s)}),Rl=uo(function(s,o,l,p){Rn(o,Br(o),s,p)}),ZP=uo(function(s,o,l,p){Rn(o,cr(o),s,p)}),JP=Qn(Wf);function QP(s,o){var l=lo(s);return o==null?l:Ym(l,o)}var XP=Ge(function(s,o){s=bt(s);var l=-1,p=o.length,v=p>2?o[2]:t;for(v&&$r(o[0],o[1],v)&&(p=1);++l<p;)for(var D=o[l],R=Br(D),M=-1,z=R.length;++M<z;){var te=R[M],re=s[te];(re===t||wn(re,oo[te])&&!dt.call(s,te))&&(s[te]=D[te])}return s}),e9=Ge(function(s){return s.push(t,Nv),ar(yy,t,s)});function t9(s,o){return Am(s,_e(o,3),Tn)}function r9(s,o){return Am(s,_e(o,3),Vf)}function n9(s,o){return s==null?s:Kf(s,_e(o,3),Br)}function i9(s,o){return s==null?s:ev(s,_e(o,3),Br)}function s9(s,o){return s&&Tn(s,_e(o,3))}function o9(s,o){return s&&Vf(s,_e(o,3))}function a9(s){return s==null?[]:pl(s,cr(s))}function c9(s){return s==null?[]:pl(s,Br(s))}function Dd(s,o,l){var p=s==null?t:ds(s,o);return p===t?l:p}function l9(s,o){return s!=null&&Uv(s,o,T7)}function Sd(s,o){return s!=null&&Uv(s,o,R7)}var u9=$v(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=tl.call(o)),s[o]=l},Cd(kr)),h9=$v(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=tl.call(o)),dt.call(s,o)?s[o].push(l):s[o]=[l]},_e),f9=Ge(wa);function cr(s){return Fr(s)?Vm(s):Jf(s)}function Br(s){return Fr(s)?Vm(s,!0):z7(s)}function d9(s,o){var l={};return o=_e(o,3),Tn(s,function(p,v,D){Zn(l,o(p,v,D),p)}),l}function p9(s,o){var l={};return o=_e(o,3),Tn(s,function(p,v,D){Zn(l,v,o(p,v,D))}),l}var g9=uo(function(s,o,l){gl(s,o,l)}),yy=uo(function(s,o,l,p){gl(s,o,l,p)}),m9=Qn(function(s,o){var l={};if(s==null)return l;var p=!1;o=Pt(o,function(D){return D=Ci(D,s),p||(p=D.length>1),D}),Rn(s,hd(s),l),p&&(l=ln(l,w|y|_,u$));for(var v=o.length;v--;)nd(l,o[v]);return l});function v9(s,o){return wy(s,Al(_e(o)))}var y9=Qn(function(s,o){return s==null?{}:W7(s,o)});function wy(s,o){if(s==null)return{};var l=Pt(hd(s),function(p){return[p]});return o=_e(o),uv(s,l,function(p,v){return o(p,v[0])})}function w9(s,o,l){o=Ci(o,s);var p=-1,v=o.length;for(v||(v=1,s=t);++p<v;){var D=s==null?t:s[Nn(o[p])];D===t&&(p=v,D=l),s=ei(D)?D.call(s):D}return s}function b9(s,o,l){return s==null?s:_a(s,o,l)}function _9(s,o,l,p){return p=typeof p=="function"?p:t,s==null?s:_a(s,o,l,p)}var by=Tv(cr),_y=Tv(Br);function E9(s,o,l){var p=Le(s),v=p||Ai(s)||po(s);if(o=_e(o,4),l==null){var D=s&&s.constructor;v?l=p?new D:[]:Nt(s)?l=ei(D)?lo(il(s)):{}:l={}}return(v?on:Tn)(s,function(R,M,z){return o(l,R,M,z)}),l}function x9(s,o){return s==null?!0:nd(s,o)}function I9(s,o,l){return s==null?s:gv(s,o,od(l))}function D9(s,o,l,p){return p=typeof p=="function"?p:t,s==null?s:gv(s,o,od(l),p)}function go(s){return s==null?[]:jf(s,cr(s))}function S9(s){return s==null?[]:jf(s,Br(s))}function O9(s,o,l){return l===t&&(l=o,o=t),l!==t&&(l=fn(l),l=l===l?l:0),o!==t&&(o=fn(o),o=o===o?o:0),fs(fn(s),o,l)}function C9(s,o,l){return o=ti(o),l===t?(l=o,o=0):l=ti(l),s=fn(s),N7(s,o,l)}function $9(s,o,l){if(l&&typeof l!="boolean"&&$r(s,o,l)&&(o=l=t),l===t&&(typeof o=="boolean"?(l=o,o=t):typeof s=="boolean"&&(l=s,s=t)),s===t&&o===t?(s=0,o=1):(s=ti(s),o===t?(o=s,s=0):o=ti(o)),s>o){var p=s;s=o,o=p}if(l||s%1||o%1){var v=Wm();return gr(s+v*(o-s+yt("1e-"+((v+"").length-1))),o)}return ed(s,o)}var A9=ho(function(s,o,l){return o=o.toLowerCase(),s+(l?Ey(o):o)});function Ey(s){return Od(ft(s).toLowerCase())}function xy(s){return s=ft(s),s&&s.replace(Kn,bC).replace($f,"")}function P9(s,o,l){s=ft(s),o=Zr(o);var p=s.length;l=l===t?p:fs(qe(l),0,p);var v=l;return l-=o.length,l>=0&&s.slice(l,v)==o}function T9(s){return s=ft(s),s&&$t.test(s)?s.replace(ns,_C):s}function R9(s){return s=ft(s),s&&Zt.test(s)?s.replace(Ft,"\\$&"):s}var N9=ho(function(s,o,l){return s+(l?"-":"")+o.toLowerCase()}),L9=ho(function(s,o,l){return s+(l?" ":"")+o.toLowerCase()}),M9=Sv("toLowerCase");function U9(s,o,l){s=ft(s),o=qe(o);var p=o?io(s):0;if(!o||p>=o)return s;var v=(o-p)/2;return _l(cl(v),l)+s+_l(al(v),l)}function j9(s,o,l){s=ft(s),o=qe(o);var p=o?io(s):0;return o&&p<o?s+_l(o-p,l):s}function F9(s,o,l){s=ft(s),o=qe(o);var p=o?io(s):0;return o&&p<o?_l(o-p,l)+s:s}function B9(s,o,l){return l||o==null?o=0:o&&(o=+o),VC(ft(s).replace(Bt,""),o||0)}function k9(s,o,l){return(l?$r(s,o,l):o===t)?o=1:o=qe(o),td(ft(s),o)}function q9(){var s=arguments,o=ft(s[0]);return s.length<3?o:o.replace(s[1],s[2])}var z9=ho(function(s,o,l){return s+(l?"_":"")+o.toLowerCase()});function H9(s,o,l){return l&&typeof l!="number"&&$r(s,o,l)&&(o=l=t),l=l===t?ie:l>>>0,l?(s=ft(s),s&&(typeof o=="string"||o!=null&&!Id(o))&&(o=Zr(o),!o&&no(s))?$i(vn(s),0,l):s.split(o,l)):[]}var W9=ho(function(s,o,l){return s+(l?" ":"")+Od(o)});function K9(s,o,l){return s=ft(s),l=l==null?0:fs(qe(l),0,s.length),o=Zr(o),s.slice(l,l+o.length)==o}function V9(s,o,l){var p=E.templateSettings;l&&$r(s,o,l)&&(o=t),s=ft(s),o=Rl({},o,p,Rv);var v=Rl({},o.imports,p.imports,Rv),D=cr(v),R=jf(v,D),M,z,te=0,re=o.interpolate||Ys,oe="__p += '",fe=Bf((o.escape||Ys).source+"|"+re.source+"|"+(re===Rt?ff:Ys).source+"|"+(o.evaluate||Ys).source+"|$","g"),ye="//# sourceURL="+(dt.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Af+"]")+`
69
- `;s.replace(fe,function(De,Qe,st,Qr,Ar,Xr){return st||(st=Qr),oe+=s.slice(te,Xr).replace(yf,EC),Qe&&(M=!0,oe+=`' +
70
- __e(`+Qe+`) +
71
- '`),Ar&&(z=!0,oe+=`';
72
- `+Ar+`;
73
- __p += '`),st&&(oe+=`' +
74
- ((__t = (`+st+`)) == null ? '' : __t) +
75
- '`),te=Xr+De.length,De}),oe+=`';
76
- `;var Ie=dt.call(o,"variable")&&o.variable;if(!Ie)oe=`with (obj) {
77
- `+oe+`
76
+ */(function(t,e){(function(){var r,n="4.17.21",i=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,m="__lodash_placeholder__",_=1,E=2,A=4,I=1,R=2,W=1,Y=2,F=4,z=8,$=16,j=32,P=64,g=128,C=256,Z=512,J=30,te="...",ae=800,p=16,d=1,b=2,D=3,M=1/0,N=9007199254740991,U=17976931348623157e292,O=0/0,v=4294967295,L=v-1,oe=v>>>1,de=[["ary",g],["bind",W],["bindKey",Y],["curry",z],["curryRight",$],["flip",Z],["partial",j],["partialRight",P],["rearg",C]],x="[object Arguments]",ne="[object Array]",q="[object AsyncFunction]",H="[object Boolean]",V="[object Date]",y="[object DOMException]",k="[object Error]",ie="[object Function]",fe="[object GeneratorFunction]",ue="[object Map]",Oe="[object Number]",Me="[object Null]",Ie="[object Object]",Pt="[object Promise]",ze="[object Proxy]",Ce="[object RegExp]",Fe="[object Set]",Ee="[object String]",Ae="[object Symbol]",Ge="[object Undefined]",we="[object WeakMap]",xe="[object WeakSet]",Be="[object ArrayBuffer]",be="[object DataView]",Pe="[object Float32Array]",je="[object Float64Array]",Te="[object Int8Array]",$e="[object Int16Array]",lt="[object Int32Array]",Re="[object Uint8Array]",Ne="[object Uint8ClampedArray]",nr="[object Uint16Array]",dt="[object Uint32Array]",Et=/\b__p \+= '';/g,ir=/\b(__p \+=) '' \+/g,St=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ot=/&(?:amp|lt|gt|quot|#39);/g,Vr=/[&<>"']/g,Ye=RegExp(Ot.source),He=RegExp(Vr.source),Rt=/<%-([\s\S]+?)%>/g,Je=/<%([\s\S]+?)%>/g,Ve=/<%=([\s\S]+?)%>/g,Mt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Xe=/^\w*$/,et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lt=/[\\^$.*+?()[\]{}|]/g,tt=RegExp(Lt.source),Qe=/^\s+/,Ft=/\s/,Ze=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ke=/\{\n\/\* \[wrapped with (.+)\] \*/,Ht=/,? & /,rt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,jt=/[()=,{}\[\]\/\s]/,ri=/\\(\\)?/g,kt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,vt=/\w*$/,Bn=/^[-+]0x[0-9a-f]+$/i,Un=/^0b[01]+$/i,Fn=/^\[object .+?Constructor\]$/,jn=/^0o[0-7]+$/i,kn=/^(?:0|[1-9]\d*)$/,xr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ii=/($^)/,mo=/['\n\r\u2028\u2029\\]/g,Di="\\ud800-\\udfff",vo="\\u0300-\\u036f",yo="\\ufe20-\\ufe2f",Ci="\\u20d0-\\u20ff",Is=vo+yo+Ci,Ds="\\u2700-\\u27bf",Gr="a-z\\xdf-\\xf6\\xf8-\\xff",wo="\\xac\\xb1\\xd7\\xf7",bo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",_o="\\u2000-\\u206f",Eo=" \\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",Tu="A-Z\\xc0-\\xd6\\xd8-\\xde",$u="\\ufe0e\\ufe0f",Ao=wo+bo+_o+Eo,qc="['\u2019]",xo="["+Di+"]",zc="["+Ao+"]",So="["+Is+"]",Nu="\\d+",Ld="["+Ds+"]",Ru="["+Gr+"]",Lu="[^"+Di+Ao+Nu+Ds+Gr+Tu+"]",xa="\\ud83c[\\udffb-\\udfff]",Bd="(?:"+So+"|"+xa+")",Bu="[^"+Di+"]",Sa="(?:\\ud83c[\\udde6-\\uddff]){2}",Cs="[\\ud800-\\udbff][\\udc00-\\udfff]",_n="["+Tu+"]",Uu="\\u200d",Fu="(?:"+Ru+"|"+Lu+")",Oi="(?:"+_n+"|"+Lu+")",ju="(?:"+qc+"(?:d|ll|m|re|s|t|ve))?",ku="(?:"+qc+"(?:D|LL|M|RE|S|T|VE))?",qu=Bd+"?",zu="["+$u+"]?",Ud="(?:"+Uu+"(?:"+[Bu,Sa,Cs].join("|")+")"+zu+qu+")*",Vi="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Hu="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ku=zu+qu+Ud,Ia="(?:"+[Ld,Sa,Cs].join("|")+")"+Ku,Fd="(?:"+[Bu+So+"?",So,Sa,Cs,xo].join("|")+")",Hc=RegExp(qc,"g"),jd=RegExp(So,"g"),Da=RegExp(xa+"(?="+xa+")|"+Fd+Ku,"g"),Wu=RegExp([_n+"?"+Ru+"+"+ju+"(?="+[zc,_n,"$"].join("|")+")",Oi+"+"+ku+"(?="+[zc,_n+Fu,"$"].join("|")+")",_n+"?"+Fu+"+"+ju,_n+"+"+ku,Hu,Vi,Nu,Ia].join("|"),"g"),Vu=RegExp("["+Uu+Di+Is+$u+"]"),Io=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Gu=["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"],kd=-1,Wt={};Wt[Pe]=Wt[je]=Wt[Te]=Wt[$e]=Wt[lt]=Wt[Re]=Wt[Ne]=Wt[nr]=Wt[dt]=!0,Wt[x]=Wt[ne]=Wt[Be]=Wt[H]=Wt[be]=Wt[V]=Wt[k]=Wt[ie]=Wt[ue]=Wt[Oe]=Wt[Ie]=Wt[Ce]=Wt[Fe]=Wt[Ee]=Wt[we]=!1;var Kt={};Kt[x]=Kt[ne]=Kt[Be]=Kt[be]=Kt[H]=Kt[V]=Kt[Pe]=Kt[je]=Kt[Te]=Kt[$e]=Kt[lt]=Kt[ue]=Kt[Oe]=Kt[Ie]=Kt[Ce]=Kt[Fe]=Kt[Ee]=Kt[Ae]=Kt[Re]=Kt[Ne]=Kt[nr]=Kt[dt]=!0,Kt[k]=Kt[ie]=Kt[we]=!1;var K={\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"},X={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},pe={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Se={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Vt=parseFloat,ot=parseInt,Zt=typeof Ec=="object"&&Ec&&Ec.Object===Object&&Ec,gr=typeof self=="object"&&self&&self.Object===Object&&self,It=Zt||gr||Function("return this")(),Gt=e&&!e.nodeType&&e,fr=Gt&&!0&&t&&!t.nodeType&&t,an=fr&&fr.exports===Gt,mr=an&&Zt.process,Xt=function(){try{var ee=fr&&fr.require&&fr.require("util").types;return ee||mr&&mr.binding&&mr.binding("util")}catch{}}(),Yr=Xt&&Xt.isArrayBuffer,ni=Xt&&Xt.isDate,qn=Xt&&Xt.isMap,Pi=Xt&&Xt.isRegExp,Kc=Xt&&Xt.isSet,Do=Xt&&Xt.isTypedArray;function Sr(ee,ce,se){switch(se.length){case 0:return ee.call(ce);case 1:return ee.call(ce,se[0]);case 2:return ee.call(ce,se[0],se[1]);case 3:return ee.call(ce,se[0],se[1],se[2])}return ee.apply(ce,se)}function s$(ee,ce,se,De){for(var it=-1,$t=ee==null?0:ee.length;++it<$t;){var yr=ee[it];ce(De,yr,se(yr),ee)}return De}function zn(ee,ce){for(var se=-1,De=ee==null?0:ee.length;++se<De&&ce(ee[se],se,ee)!==!1;);return ee}function o$(ee,ce){for(var se=ee==null?0:ee.length;se--&&ce(ee[se],se,ee)!==!1;);return ee}function o2(ee,ce){for(var se=-1,De=ee==null?0:ee.length;++se<De;)if(!ce(ee[se],se,ee))return!1;return!0}function Os(ee,ce){for(var se=-1,De=ee==null?0:ee.length,it=0,$t=[];++se<De;){var yr=ee[se];ce(yr,se,ee)&&($t[it++]=yr)}return $t}function Yu(ee,ce){var se=ee==null?0:ee.length;return!!se&&Ca(ee,ce,0)>-1}function qd(ee,ce,se){for(var De=-1,it=ee==null?0:ee.length;++De<it;)if(se(ce,ee[De]))return!0;return!1}function tr(ee,ce){for(var se=-1,De=ee==null?0:ee.length,it=Array(De);++se<De;)it[se]=ce(ee[se],se,ee);return it}function Ps(ee,ce){for(var se=-1,De=ce.length,it=ee.length;++se<De;)ee[it+se]=ce[se];return ee}function zd(ee,ce,se,De){var it=-1,$t=ee==null?0:ee.length;for(De&&$t&&(se=ee[++it]);++it<$t;)se=ce(se,ee[it],it,ee);return se}function a$(ee,ce,se,De){var it=ee==null?0:ee.length;for(De&&it&&(se=ee[--it]);it--;)se=ce(se,ee[it],it,ee);return se}function Hd(ee,ce){for(var se=-1,De=ee==null?0:ee.length;++se<De;)if(ce(ee[se],se,ee))return!0;return!1}var c$=Kd("length");function l$(ee){return ee.split("")}function u$(ee){return ee.match(rt)||[]}function a2(ee,ce,se){var De;return se(ee,function(it,$t,yr){if(ce(it,$t,yr))return De=$t,!1}),De}function Ju(ee,ce,se,De){for(var it=ee.length,$t=se+(De?1:-1);De?$t--:++$t<it;)if(ce(ee[$t],$t,ee))return $t;return-1}function Ca(ee,ce,se){return ce===ce?E$(ee,ce,se):Ju(ee,c2,se)}function h$(ee,ce,se,De){for(var it=se-1,$t=ee.length;++it<$t;)if(De(ee[it],ce))return it;return-1}function c2(ee){return ee!==ee}function l2(ee,ce){var se=ee==null?0:ee.length;return se?Vd(ee,ce)/se:O}function Kd(ee){return function(ce){return ce==null?r:ce[ee]}}function Wd(ee){return function(ce){return ee==null?r:ee[ce]}}function u2(ee,ce,se,De,it){return it(ee,function($t,yr,Yt){se=De?(De=!1,$t):ce(se,$t,yr,Yt)}),se}function f$(ee,ce){var se=ee.length;for(ee.sort(ce);se--;)ee[se]=ee[se].value;return ee}function Vd(ee,ce){for(var se,De=-1,it=ee.length;++De<it;){var $t=ce(ee[De]);$t!==r&&(se=se===r?$t:se+$t)}return se}function Gd(ee,ce){for(var se=-1,De=Array(ee);++se<ee;)De[se]=ce(se);return De}function d$(ee,ce){return tr(ce,function(se){return[se,ee[se]]})}function h2(ee){return ee&&ee.slice(0,g2(ee)+1).replace(Qe,"")}function En(ee){return function(ce){return ee(ce)}}function Yd(ee,ce){return tr(ce,function(se){return ee[se]})}function Wc(ee,ce){return ee.has(ce)}function f2(ee,ce){for(var se=-1,De=ee.length;++se<De&&Ca(ce,ee[se],0)>-1;);return se}function d2(ee,ce){for(var se=ee.length;se--&&Ca(ce,ee[se],0)>-1;);return se}function p$(ee,ce){for(var se=ee.length,De=0;se--;)ee[se]===ce&&++De;return De}var g$=Wd(K),m$=Wd(X);function v$(ee){return"\\"+Se[ee]}function y$(ee,ce){return ee==null?r:ee[ce]}function Oa(ee){return Vu.test(ee)}function w$(ee){return Io.test(ee)}function b$(ee){for(var ce,se=[];!(ce=ee.next()).done;)se.push(ce.value);return se}function Jd(ee){var ce=-1,se=Array(ee.size);return ee.forEach(function(De,it){se[++ce]=[it,De]}),se}function p2(ee,ce){return function(se){return ee(ce(se))}}function Ms(ee,ce){for(var se=-1,De=ee.length,it=0,$t=[];++se<De;){var yr=ee[se];(yr===ce||yr===m)&&(ee[se]=m,$t[it++]=se)}return $t}function Qu(ee){var ce=-1,se=Array(ee.size);return ee.forEach(function(De){se[++ce]=De}),se}function _$(ee){var ce=-1,se=Array(ee.size);return ee.forEach(function(De){se[++ce]=[De,De]}),se}function E$(ee,ce,se){for(var De=se-1,it=ee.length;++De<it;)if(ee[De]===ce)return De;return-1}function A$(ee,ce,se){for(var De=se+1;De--;)if(ee[De]===ce)return De;return De}function Pa(ee){return Oa(ee)?S$(ee):c$(ee)}function ii(ee){return Oa(ee)?I$(ee):l$(ee)}function g2(ee){for(var ce=ee.length;ce--&&Ft.test(ee.charAt(ce)););return ce}var x$=Wd(pe);function S$(ee){for(var ce=Da.lastIndex=0;Da.test(ee);)++ce;return ce}function I$(ee){return ee.match(Da)||[]}function D$(ee){return ee.match(Wu)||[]}var C$=function ee(ce){ce=ce==null?It:Ma.defaults(It.Object(),ce,Ma.pick(It,Gu));var se=ce.Array,De=ce.Date,it=ce.Error,$t=ce.Function,yr=ce.Math,Yt=ce.Object,Qd=ce.RegExp,O$=ce.String,Hn=ce.TypeError,Zu=se.prototype,P$=$t.prototype,Ta=Yt.prototype,Xu=ce["__core-js_shared__"],eh=P$.toString,qt=Ta.hasOwnProperty,M$=0,m2=function(){var o=/[^.]+$/.exec(Xu&&Xu.keys&&Xu.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),th=Ta.toString,T$=eh.call(Yt),$$=It._,N$=Qd("^"+eh.call(qt).replace(Lt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rh=an?ce.Buffer:r,Ts=ce.Symbol,nh=ce.Uint8Array,v2=rh?rh.allocUnsafe:r,ih=p2(Yt.getPrototypeOf,Yt),y2=Yt.create,w2=Ta.propertyIsEnumerable,sh=Zu.splice,b2=Ts?Ts.isConcatSpreadable:r,Vc=Ts?Ts.iterator:r,Co=Ts?Ts.toStringTag:r,oh=function(){try{var o=$o(Yt,"defineProperty");return o({},"",{}),o}catch{}}(),R$=ce.clearTimeout!==It.clearTimeout&&ce.clearTimeout,L$=De&&De.now!==It.Date.now&&De.now,B$=ce.setTimeout!==It.setTimeout&&ce.setTimeout,ah=yr.ceil,ch=yr.floor,Zd=Yt.getOwnPropertySymbols,U$=rh?rh.isBuffer:r,_2=ce.isFinite,F$=Zu.join,j$=p2(Yt.keys,Yt),wr=yr.max,Br=yr.min,k$=De.now,q$=ce.parseInt,E2=yr.random,z$=Zu.reverse,Xd=$o(ce,"DataView"),Gc=$o(ce,"Map"),ep=$o(ce,"Promise"),$a=$o(ce,"Set"),Yc=$o(ce,"WeakMap"),Jc=$o(Yt,"create"),lh=Yc&&new Yc,Na={},H$=No(Xd),K$=No(Gc),W$=No(ep),V$=No($a),G$=No(Yc),uh=Ts?Ts.prototype:r,Qc=uh?uh.valueOf:r,A2=uh?uh.toString:r;function T(o){if(cr(o)&&!at(o)&&!(o instanceof At)){if(o instanceof Kn)return o;if(qt.call(o,"__wrapped__"))return xb(o)}return new Kn(o)}var Ra=function(){function o(){}return function(a){if(!sr(a))return{};if(y2)return y2(a);o.prototype=a;var u=new o;return o.prototype=r,u}}();function hh(){}function Kn(o,a){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!a,this.__index__=0,this.__values__=r}T.templateSettings={escape:Rt,evaluate:Je,interpolate:Ve,variable:"",imports:{_:T}},T.prototype=hh.prototype,T.prototype.constructor=T,Kn.prototype=Ra(hh.prototype),Kn.prototype.constructor=Kn;function At(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=v,this.__views__=[]}function Y$(){var o=new At(this.__wrapped__);return o.__actions__=cn(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=cn(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=cn(this.__views__),o}function J$(){if(this.__filtered__){var o=new At(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function Q$(){var o=this.__wrapped__.value(),a=this.__dir__,u=at(o),w=a<0,S=u?o.length:0,B=lR(0,S,this.__views__),G=B.start,Q=B.end,re=Q-G,le=w?Q:G-1,he=this.__iteratees__,ge=he.length,ye=0,Le=Br(re,this.__takeCount__);if(!u||!w&&S==re&&Le==re)return V2(o,this.__actions__);var Ke=[];e:for(;re--&&ye<Le;){le+=a;for(var pt=-1,We=o[le];++pt<ge;){var yt=he[pt],Dt=yt.iteratee,Sn=yt.type,Zr=Dt(We);if(Sn==b)We=Zr;else if(!Zr){if(Sn==d)continue e;break e}}Ke[ye++]=We}return Ke}At.prototype=Ra(hh.prototype),At.prototype.constructor=At;function Oo(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a<u;){var w=o[a];this.set(w[0],w[1])}}function Z$(){this.__data__=Jc?Jc(null):{},this.size=0}function X$(o){var a=this.has(o)&&delete this.__data__[o];return this.size-=a?1:0,a}function eN(o){var a=this.__data__;if(Jc){var u=a[o];return u===f?r:u}return qt.call(a,o)?a[o]:r}function tN(o){var a=this.__data__;return Jc?a[o]!==r:qt.call(a,o)}function rN(o,a){var u=this.__data__;return this.size+=this.has(o)?0:1,u[o]=Jc&&a===r?f:a,this}Oo.prototype.clear=Z$,Oo.prototype.delete=X$,Oo.prototype.get=eN,Oo.prototype.has=tN,Oo.prototype.set=rN;function Gi(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a<u;){var w=o[a];this.set(w[0],w[1])}}function nN(){this.__data__=[],this.size=0}function iN(o){var a=this.__data__,u=fh(a,o);if(u<0)return!1;var w=a.length-1;return u==w?a.pop():sh.call(a,u,1),--this.size,!0}function sN(o){var a=this.__data__,u=fh(a,o);return u<0?r:a[u][1]}function oN(o){return fh(this.__data__,o)>-1}function aN(o,a){var u=this.__data__,w=fh(u,o);return w<0?(++this.size,u.push([o,a])):u[w][1]=a,this}Gi.prototype.clear=nN,Gi.prototype.delete=iN,Gi.prototype.get=sN,Gi.prototype.has=oN,Gi.prototype.set=aN;function Yi(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a<u;){var w=o[a];this.set(w[0],w[1])}}function cN(){this.size=0,this.__data__={hash:new Oo,map:new(Gc||Gi),string:new Oo}}function lN(o){var a=xh(this,o).delete(o);return this.size-=a?1:0,a}function uN(o){return xh(this,o).get(o)}function hN(o){return xh(this,o).has(o)}function fN(o,a){var u=xh(this,o),w=u.size;return u.set(o,a),this.size+=u.size==w?0:1,this}Yi.prototype.clear=cN,Yi.prototype.delete=lN,Yi.prototype.get=uN,Yi.prototype.has=hN,Yi.prototype.set=fN;function Po(o){var a=-1,u=o==null?0:o.length;for(this.__data__=new Yi;++a<u;)this.add(o[a])}function dN(o){return this.__data__.set(o,f),this}function pN(o){return this.__data__.has(o)}Po.prototype.add=Po.prototype.push=dN,Po.prototype.has=pN;function si(o){var a=this.__data__=new Gi(o);this.size=a.size}function gN(){this.__data__=new Gi,this.size=0}function mN(o){var a=this.__data__,u=a.delete(o);return this.size=a.size,u}function vN(o){return this.__data__.get(o)}function yN(o){return this.__data__.has(o)}function wN(o,a){var u=this.__data__;if(u instanceof Gi){var w=u.__data__;if(!Gc||w.length<i-1)return w.push([o,a]),this.size=++u.size,this;u=this.__data__=new Yi(w)}return u.set(o,a),this.size=u.size,this}si.prototype.clear=gN,si.prototype.delete=mN,si.prototype.get=vN,si.prototype.has=yN,si.prototype.set=wN;function x2(o,a){var u=at(o),w=!u&&Ro(o),S=!u&&!w&&Bs(o),B=!u&&!w&&!S&&Fa(o),G=u||w||S||B,Q=G?Gd(o.length,O$):[],re=Q.length;for(var le in o)(a||qt.call(o,le))&&!(G&&(le=="length"||S&&(le=="offset"||le=="parent")||B&&(le=="buffer"||le=="byteLength"||le=="byteOffset")||Xi(le,re)))&&Q.push(le);return Q}function S2(o){var a=o.length;return a?o[hp(0,a-1)]:r}function bN(o,a){return Sh(cn(o),Mo(a,0,o.length))}function _N(o){return Sh(cn(o))}function tp(o,a,u){(u!==r&&!oi(o[a],u)||u===r&&!(a in o))&&Ji(o,a,u)}function Zc(o,a,u){var w=o[a];(!(qt.call(o,a)&&oi(w,u))||u===r&&!(a in o))&&Ji(o,a,u)}function fh(o,a){for(var u=o.length;u--;)if(oi(o[u][0],a))return u;return-1}function EN(o,a,u,w){return $s(o,function(S,B,G){a(w,S,u(S),G)}),w}function I2(o,a){return o&&Ti(a,Ir(a),o)}function AN(o,a){return o&&Ti(a,un(a),o)}function Ji(o,a,u){a=="__proto__"&&oh?oh(o,a,{configurable:!0,enumerable:!0,value:u,writable:!0}):o[a]=u}function rp(o,a){for(var u=-1,w=a.length,S=se(w),B=o==null;++u<w;)S[u]=B?r:Lp(o,a[u]);return S}function Mo(o,a,u){return o===o&&(u!==r&&(o=o<=u?o:u),a!==r&&(o=o>=a?o:a)),o}function Wn(o,a,u,w,S,B){var G,Q=a&_,re=a&E,le=a&A;if(u&&(G=S?u(o,w,S,B):u(o)),G!==r)return G;if(!sr(o))return o;var he=at(o);if(he){if(G=hR(o),!Q)return cn(o,G)}else{var ge=Ur(o),ye=ge==ie||ge==fe;if(Bs(o))return J2(o,Q);if(ge==Ie||ge==x||ye&&!S){if(G=re||ye?{}:gb(o),!Q)return re?eR(o,AN(G,o)):XN(o,I2(G,o))}else{if(!Kt[ge])return S?o:{};G=fR(o,ge,Q)}}B||(B=new si);var Le=B.get(o);if(Le)return Le;B.set(o,G),Hb(o)?o.forEach(function(We){G.add(Wn(We,a,u,We,o,B))}):qb(o)&&o.forEach(function(We,yt){G.set(yt,Wn(We,a,u,yt,o,B))});var Ke=le?re?Ep:_p:re?un:Ir,pt=he?r:Ke(o);return zn(pt||o,function(We,yt){pt&&(yt=We,We=o[yt]),Zc(G,yt,Wn(We,a,u,yt,o,B))}),G}function xN(o){var a=Ir(o);return function(u){return D2(u,o,a)}}function D2(o,a,u){var w=u.length;if(o==null)return!w;for(o=Yt(o);w--;){var S=u[w],B=a[S],G=o[S];if(G===r&&!(S in o)||!B(G))return!1}return!0}function C2(o,a,u){if(typeof o!="function")throw new Hn(c);return sl(function(){o.apply(r,u)},a)}function Xc(o,a,u,w){var S=-1,B=Yu,G=!0,Q=o.length,re=[],le=a.length;if(!Q)return re;u&&(a=tr(a,En(u))),w?(B=qd,G=!1):a.length>=i&&(B=Wc,G=!1,a=new Po(a));e:for(;++S<Q;){var he=o[S],ge=u==null?he:u(he);if(he=w||he!==0?he:0,G&&ge===ge){for(var ye=le;ye--;)if(a[ye]===ge)continue e;re.push(he)}else B(a,ge,w)||re.push(he)}return re}var $s=tb(Mi),O2=tb(ip,!0);function SN(o,a){var u=!0;return $s(o,function(w,S,B){return u=!!a(w,S,B),u}),u}function dh(o,a,u){for(var w=-1,S=o.length;++w<S;){var B=o[w],G=a(B);if(G!=null&&(Q===r?G===G&&!xn(G):u(G,Q)))var Q=G,re=B}return re}function IN(o,a,u,w){var S=o.length;for(u=ft(u),u<0&&(u=-u>S?0:S+u),w=w===r||w>S?S:ft(w),w<0&&(w+=S),w=u>w?0:Wb(w);u<w;)o[u++]=a;return o}function P2(o,a){var u=[];return $s(o,function(w,S,B){a(w,S,B)&&u.push(w)}),u}function Tr(o,a,u,w,S){var B=-1,G=o.length;for(u||(u=pR),S||(S=[]);++B<G;){var Q=o[B];a>0&&u(Q)?a>1?Tr(Q,a-1,u,w,S):Ps(S,Q):w||(S[S.length]=Q)}return S}var np=rb(),M2=rb(!0);function Mi(o,a){return o&&np(o,a,Ir)}function ip(o,a){return o&&M2(o,a,Ir)}function ph(o,a){return Os(a,function(u){return es(o[u])})}function To(o,a){a=Rs(a,o);for(var u=0,w=a.length;o!=null&&u<w;)o=o[$i(a[u++])];return u&&u==w?o:r}function T2(o,a,u){var w=a(o);return at(o)?w:Ps(w,u(o))}function Jr(o){return o==null?o===r?Ge:Me:Co&&Co in Yt(o)?cR(o):_R(o)}function sp(o,a){return o>a}function DN(o,a){return o!=null&&qt.call(o,a)}function CN(o,a){return o!=null&&a in Yt(o)}function ON(o,a,u){return o>=Br(a,u)&&o<wr(a,u)}function op(o,a,u){for(var w=u?qd:Yu,S=o[0].length,B=o.length,G=B,Q=se(B),re=1/0,le=[];G--;){var he=o[G];G&&a&&(he=tr(he,En(a))),re=Br(he.length,re),Q[G]=!u&&(a||S>=120&&he.length>=120)?new Po(G&&he):r}he=o[0];var ge=-1,ye=Q[0];e:for(;++ge<S&&le.length<re;){var Le=he[ge],Ke=a?a(Le):Le;if(Le=u||Le!==0?Le:0,!(ye?Wc(ye,Ke):w(le,Ke,u))){for(G=B;--G;){var pt=Q[G];if(!(pt?Wc(pt,Ke):w(o[G],Ke,u)))continue e}ye&&ye.push(Ke),le.push(Le)}}return le}function PN(o,a,u,w){return Mi(o,function(S,B,G){a(w,u(S),B,G)}),w}function el(o,a,u){a=Rs(a,o),o=wb(o,a);var w=o==null?o:o[$i(Gn(a))];return w==null?r:Sr(w,o,u)}function $2(o){return cr(o)&&Jr(o)==x}function MN(o){return cr(o)&&Jr(o)==Be}function TN(o){return cr(o)&&Jr(o)==V}function tl(o,a,u,w,S){return o===a?!0:o==null||a==null||!cr(o)&&!cr(a)?o!==o&&a!==a:$N(o,a,u,w,tl,S)}function $N(o,a,u,w,S,B){var G=at(o),Q=at(a),re=G?ne:Ur(o),le=Q?ne:Ur(a);re=re==x?Ie:re,le=le==x?Ie:le;var he=re==Ie,ge=le==Ie,ye=re==le;if(ye&&Bs(o)){if(!Bs(a))return!1;G=!0,he=!1}if(ye&&!he)return B||(B=new si),G||Fa(o)?fb(o,a,u,w,S,B):oR(o,a,re,u,w,S,B);if(!(u&I)){var Le=he&&qt.call(o,"__wrapped__"),Ke=ge&&qt.call(a,"__wrapped__");if(Le||Ke){var pt=Le?o.value():o,We=Ke?a.value():a;return B||(B=new si),S(pt,We,u,w,B)}}return ye?(B||(B=new si),aR(o,a,u,w,S,B)):!1}function NN(o){return cr(o)&&Ur(o)==ue}function ap(o,a,u,w){var S=u.length,B=S,G=!w;if(o==null)return!B;for(o=Yt(o);S--;){var Q=u[S];if(G&&Q[2]?Q[1]!==o[Q[0]]:!(Q[0]in o))return!1}for(;++S<B;){Q=u[S];var re=Q[0],le=o[re],he=Q[1];if(G&&Q[2]){if(le===r&&!(re in o))return!1}else{var ge=new si;if(w)var ye=w(le,he,re,o,a,ge);if(!(ye===r?tl(he,le,I|R,w,ge):ye))return!1}}return!0}function N2(o){if(!sr(o)||mR(o))return!1;var a=es(o)?N$:Fn;return a.test(No(o))}function RN(o){return cr(o)&&Jr(o)==Ce}function LN(o){return cr(o)&&Ur(o)==Fe}function BN(o){return cr(o)&&Mh(o.length)&&!!Wt[Jr(o)]}function R2(o){return typeof o=="function"?o:o==null?hn:typeof o=="object"?at(o)?U2(o[0],o[1]):B2(o):n3(o)}function cp(o){if(!il(o))return j$(o);var a=[];for(var u in Yt(o))qt.call(o,u)&&u!="constructor"&&a.push(u);return a}function UN(o){if(!sr(o))return bR(o);var a=il(o),u=[];for(var w in o)w=="constructor"&&(a||!qt.call(o,w))||u.push(w);return u}function lp(o,a){return o<a}function L2(o,a){var u=-1,w=ln(o)?se(o.length):[];return $s(o,function(S,B,G){w[++u]=a(S,B,G)}),w}function B2(o){var a=xp(o);return a.length==1&&a[0][2]?vb(a[0][0],a[0][1]):function(u){return u===o||ap(u,o,a)}}function U2(o,a){return Ip(o)&&mb(a)?vb($i(o),a):function(u){var w=Lp(u,o);return w===r&&w===a?Bp(u,o):tl(a,w,I|R)}}function gh(o,a,u,w,S){o!==a&&np(a,function(B,G){if(S||(S=new si),sr(B))FN(o,a,G,u,gh,w,S);else{var Q=w?w(Cp(o,G),B,G+"",o,a,S):r;Q===r&&(Q=B),tp(o,G,Q)}},un)}function FN(o,a,u,w,S,B,G){var Q=Cp(o,u),re=Cp(a,u),le=G.get(re);if(le){tp(o,u,le);return}var he=B?B(Q,re,u+"",o,a,G):r,ge=he===r;if(ge){var ye=at(re),Le=!ye&&Bs(re),Ke=!ye&&!Le&&Fa(re);he=re,ye||Le||Ke?at(Q)?he=Q:dr(Q)?he=cn(Q):Le?(ge=!1,he=J2(re,!0)):Ke?(ge=!1,he=Q2(re,!0)):he=[]:ol(re)||Ro(re)?(he=Q,Ro(Q)?he=Vb(Q):(!sr(Q)||es(Q))&&(he=gb(re))):ge=!1}ge&&(G.set(re,he),S(he,re,w,B,G),G.delete(re)),tp(o,u,he)}function F2(o,a){var u=o.length;if(u)return a+=a<0?u:0,Xi(a,u)?o[a]:r}function j2(o,a,u){a.length?a=tr(a,function(B){return at(B)?function(G){return To(G,B.length===1?B[0]:B)}:B}):a=[hn];var w=-1;a=tr(a,En(qe()));var S=L2(o,function(B,G,Q){var re=tr(a,function(le){return le(B)});return{criteria:re,index:++w,value:B}});return f$(S,function(B,G){return ZN(B,G,u)})}function jN(o,a){return k2(o,a,function(u,w){return Bp(o,w)})}function k2(o,a,u){for(var w=-1,S=a.length,B={};++w<S;){var G=a[w],Q=To(o,G);u(Q,G)&&rl(B,Rs(G,o),Q)}return B}function kN(o){return function(a){return To(a,o)}}function up(o,a,u,w){var S=w?h$:Ca,B=-1,G=a.length,Q=o;for(o===a&&(a=cn(a)),u&&(Q=tr(o,En(u)));++B<G;)for(var re=0,le=a[B],he=u?u(le):le;(re=S(Q,he,re,w))>-1;)Q!==o&&sh.call(Q,re,1),sh.call(o,re,1);return o}function q2(o,a){for(var u=o?a.length:0,w=u-1;u--;){var S=a[u];if(u==w||S!==B){var B=S;Xi(S)?sh.call(o,S,1):pp(o,S)}}return o}function hp(o,a){return o+ch(E2()*(a-o+1))}function qN(o,a,u,w){for(var S=-1,B=wr(ah((a-o)/(u||1)),0),G=se(B);B--;)G[w?B:++S]=o,o+=u;return G}function fp(o,a){var u="";if(!o||a<1||a>N)return u;do a%2&&(u+=o),a=ch(a/2),a&&(o+=o);while(a);return u}function gt(o,a){return Op(yb(o,a,hn),o+"")}function zN(o){return S2(ja(o))}function HN(o,a){var u=ja(o);return Sh(u,Mo(a,0,u.length))}function rl(o,a,u,w){if(!sr(o))return o;a=Rs(a,o);for(var S=-1,B=a.length,G=B-1,Q=o;Q!=null&&++S<B;){var re=$i(a[S]),le=u;if(re==="__proto__"||re==="constructor"||re==="prototype")return o;if(S!=G){var he=Q[re];le=w?w(he,re,Q):r,le===r&&(le=sr(he)?he:Xi(a[S+1])?[]:{})}Zc(Q,re,le),Q=Q[re]}return o}var z2=lh?function(o,a){return lh.set(o,a),o}:hn,KN=oh?function(o,a){return oh(o,"toString",{configurable:!0,enumerable:!1,value:Fp(a),writable:!0})}:hn;function WN(o){return Sh(ja(o))}function Vn(o,a,u){var w=-1,S=o.length;a<0&&(a=-a>S?0:S+a),u=u>S?S:u,u<0&&(u+=S),S=a>u?0:u-a>>>0,a>>>=0;for(var B=se(S);++w<S;)B[w]=o[w+a];return B}function VN(o,a){var u;return $s(o,function(w,S,B){return u=a(w,S,B),!u}),!!u}function mh(o,a,u){var w=0,S=o==null?w:o.length;if(typeof a=="number"&&a===a&&S<=oe){for(;w<S;){var B=w+S>>>1,G=o[B];G!==null&&!xn(G)&&(u?G<=a:G<a)?w=B+1:S=B}return S}return dp(o,a,hn,u)}function dp(o,a,u,w){var S=0,B=o==null?0:o.length;if(B===0)return 0;a=u(a);for(var G=a!==a,Q=a===null,re=xn(a),le=a===r;S<B;){var he=ch((S+B)/2),ge=u(o[he]),ye=ge!==r,Le=ge===null,Ke=ge===ge,pt=xn(ge);if(G)var We=w||Ke;else le?We=Ke&&(w||ye):Q?We=Ke&&ye&&(w||!Le):re?We=Ke&&ye&&!Le&&(w||!pt):Le||pt?We=!1:We=w?ge<=a:ge<a;We?S=he+1:B=he}return Br(B,L)}function H2(o,a){for(var u=-1,w=o.length,S=0,B=[];++u<w;){var G=o[u],Q=a?a(G):G;if(!u||!oi(Q,re)){var re=Q;B[S++]=G===0?0:G}}return B}function K2(o){return typeof o=="number"?o:xn(o)?O:+o}function An(o){if(typeof o=="string")return o;if(at(o))return tr(o,An)+"";if(xn(o))return A2?A2.call(o):"";var a=o+"";return a=="0"&&1/o==-M?"-0":a}function Ns(o,a,u){var w=-1,S=Yu,B=o.length,G=!0,Q=[],re=Q;if(u)G=!1,S=qd;else if(B>=i){var le=a?null:iR(o);if(le)return Qu(le);G=!1,S=Wc,re=new Po}else re=a?[]:Q;e:for(;++w<B;){var he=o[w],ge=a?a(he):he;if(he=u||he!==0?he:0,G&&ge===ge){for(var ye=re.length;ye--;)if(re[ye]===ge)continue e;a&&re.push(ge),Q.push(he)}else S(re,ge,u)||(re!==Q&&re.push(ge),Q.push(he))}return Q}function pp(o,a){return a=Rs(a,o),o=wb(o,a),o==null||delete o[$i(Gn(a))]}function W2(o,a,u,w){return rl(o,a,u(To(o,a)),w)}function vh(o,a,u,w){for(var S=o.length,B=w?S:-1;(w?B--:++B<S)&&a(o[B],B,o););return u?Vn(o,w?0:B,w?B+1:S):Vn(o,w?B+1:0,w?S:B)}function V2(o,a){var u=o;return u instanceof At&&(u=u.value()),zd(a,function(w,S){return S.func.apply(S.thisArg,Ps([w],S.args))},u)}function gp(o,a,u){var w=o.length;if(w<2)return w?Ns(o[0]):[];for(var S=-1,B=se(w);++S<w;)for(var G=o[S],Q=-1;++Q<w;)Q!=S&&(B[S]=Xc(B[S]||G,o[Q],a,u));return Ns(Tr(B,1),a,u)}function G2(o,a,u){for(var w=-1,S=o.length,B=a.length,G={};++w<S;){var Q=w<B?a[w]:r;u(G,o[w],Q)}return G}function mp(o){return dr(o)?o:[]}function vp(o){return typeof o=="function"?o:hn}function Rs(o,a){return at(o)?o:Ip(o,a)?[o]:Ab(Bt(o))}var GN=gt;function Ls(o,a,u){var w=o.length;return u=u===r?w:u,!a&&u>=w?o:Vn(o,a,u)}var Y2=R$||function(o){return It.clearTimeout(o)};function J2(o,a){if(a)return o.slice();var u=o.length,w=v2?v2(u):new o.constructor(u);return o.copy(w),w}function yp(o){var a=new o.constructor(o.byteLength);return new nh(a).set(new nh(o)),a}function YN(o,a){var u=a?yp(o.buffer):o.buffer;return new o.constructor(u,o.byteOffset,o.byteLength)}function JN(o){var a=new o.constructor(o.source,vt.exec(o));return a.lastIndex=o.lastIndex,a}function QN(o){return Qc?Yt(Qc.call(o)):{}}function Q2(o,a){var u=a?yp(o.buffer):o.buffer;return new o.constructor(u,o.byteOffset,o.length)}function Z2(o,a){if(o!==a){var u=o!==r,w=o===null,S=o===o,B=xn(o),G=a!==r,Q=a===null,re=a===a,le=xn(a);if(!Q&&!le&&!B&&o>a||B&&G&&re&&!Q&&!le||w&&G&&re||!u&&re||!S)return 1;if(!w&&!B&&!le&&o<a||le&&u&&S&&!w&&!B||Q&&u&&S||!G&&S||!re)return-1}return 0}function ZN(o,a,u){for(var w=-1,S=o.criteria,B=a.criteria,G=S.length,Q=u.length;++w<G;){var re=Z2(S[w],B[w]);if(re){if(w>=Q)return re;var le=u[w];return re*(le=="desc"?-1:1)}}return o.index-a.index}function X2(o,a,u,w){for(var S=-1,B=o.length,G=u.length,Q=-1,re=a.length,le=wr(B-G,0),he=se(re+le),ge=!w;++Q<re;)he[Q]=a[Q];for(;++S<G;)(ge||S<B)&&(he[u[S]]=o[S]);for(;le--;)he[Q++]=o[S++];return he}function eb(o,a,u,w){for(var S=-1,B=o.length,G=-1,Q=u.length,re=-1,le=a.length,he=wr(B-Q,0),ge=se(he+le),ye=!w;++S<he;)ge[S]=o[S];for(var Le=S;++re<le;)ge[Le+re]=a[re];for(;++G<Q;)(ye||S<B)&&(ge[Le+u[G]]=o[S++]);return ge}function cn(o,a){var u=-1,w=o.length;for(a||(a=se(w));++u<w;)a[u]=o[u];return a}function Ti(o,a,u,w){var S=!u;u||(u={});for(var B=-1,G=a.length;++B<G;){var Q=a[B],re=w?w(u[Q],o[Q],Q,u,o):r;re===r&&(re=o[Q]),S?Ji(u,Q,re):Zc(u,Q,re)}return u}function XN(o,a){return Ti(o,Sp(o),a)}function eR(o,a){return Ti(o,db(o),a)}function yh(o,a){return function(u,w){var S=at(u)?s$:EN,B=a?a():{};return S(u,o,qe(w,2),B)}}function La(o){return gt(function(a,u){var w=-1,S=u.length,B=S>1?u[S-1]:r,G=S>2?u[2]:r;for(B=o.length>3&&typeof B=="function"?(S--,B):r,G&&Qr(u[0],u[1],G)&&(B=S<3?r:B,S=1),a=Yt(a);++w<S;){var Q=u[w];Q&&o(a,Q,w,B)}return a})}function tb(o,a){return function(u,w){if(u==null)return u;if(!ln(u))return o(u,w);for(var S=u.length,B=a?S:-1,G=Yt(u);(a?B--:++B<S)&&w(G[B],B,G)!==!1;);return u}}function rb(o){return function(a,u,w){for(var S=-1,B=Yt(a),G=w(a),Q=G.length;Q--;){var re=G[o?Q:++S];if(u(B[re],re,B)===!1)break}return a}}function tR(o,a,u){var w=a&W,S=nl(o);function B(){var G=this&&this!==It&&this instanceof B?S:o;return G.apply(w?u:this,arguments)}return B}function nb(o){return function(a){a=Bt(a);var u=Oa(a)?ii(a):r,w=u?u[0]:a.charAt(0),S=u?Ls(u,1).join(""):a.slice(1);return w[o]()+S}}function Ba(o){return function(a){return zd(t3(e3(a).replace(Hc,"")),o,"")}}function nl(o){return function(){var a=arguments;switch(a.length){case 0:return new o;case 1:return new o(a[0]);case 2:return new o(a[0],a[1]);case 3:return new o(a[0],a[1],a[2]);case 4:return new o(a[0],a[1],a[2],a[3]);case 5:return new o(a[0],a[1],a[2],a[3],a[4]);case 6:return new o(a[0],a[1],a[2],a[3],a[4],a[5]);case 7:return new o(a[0],a[1],a[2],a[3],a[4],a[5],a[6])}var u=Ra(o.prototype),w=o.apply(u,a);return sr(w)?w:u}}function rR(o,a,u){var w=nl(o);function S(){for(var B=arguments.length,G=se(B),Q=B,re=Ua(S);Q--;)G[Q]=arguments[Q];var le=B<3&&G[0]!==re&&G[B-1]!==re?[]:Ms(G,re);if(B-=le.length,B<u)return cb(o,a,wh,S.placeholder,r,G,le,r,r,u-B);var he=this&&this!==It&&this instanceof S?w:o;return Sr(he,this,G)}return S}function ib(o){return function(a,u,w){var S=Yt(a);if(!ln(a)){var B=qe(u,3);a=Ir(a),u=function(Q){return B(S[Q],Q,S)}}var G=o(a,u,w);return G>-1?S[B?a[G]:G]:r}}function sb(o){return Zi(function(a){var u=a.length,w=u,S=Kn.prototype.thru;for(o&&a.reverse();w--;){var B=a[w];if(typeof B!="function")throw new Hn(c);if(S&&!G&&Ah(B)=="wrapper")var G=new Kn([],!0)}for(w=G?w:u;++w<u;){B=a[w];var Q=Ah(B),re=Q=="wrapper"?Ap(B):r;re&&Dp(re[0])&&re[1]==(g|z|j|C)&&!re[4].length&&re[9]==1?G=G[Ah(re[0])].apply(G,re[3]):G=B.length==1&&Dp(B)?G[Q]():G.thru(B)}return function(){var le=arguments,he=le[0];if(G&&le.length==1&&at(he))return G.plant(he).value();for(var ge=0,ye=u?a[ge].apply(this,le):he;++ge<u;)ye=a[ge].call(this,ye);return ye}})}function wh(o,a,u,w,S,B,G,Q,re,le){var he=a&g,ge=a&W,ye=a&Y,Le=a&(z|$),Ke=a&Z,pt=ye?r:nl(o);function We(){for(var yt=arguments.length,Dt=se(yt),Sn=yt;Sn--;)Dt[Sn]=arguments[Sn];if(Le)var Zr=Ua(We),In=p$(Dt,Zr);if(w&&(Dt=X2(Dt,w,S,Le)),B&&(Dt=eb(Dt,B,G,Le)),yt-=In,Le&&yt<le){var pr=Ms(Dt,Zr);return cb(o,a,wh,We.placeholder,u,Dt,pr,Q,re,le-yt)}var ai=ge?u:this,rs=ye?ai[o]:o;return yt=Dt.length,Q?Dt=ER(Dt,Q):Ke&&yt>1&&Dt.reverse(),he&&re<yt&&(Dt.length=re),this&&this!==It&&this instanceof We&&(rs=pt||nl(rs)),rs.apply(ai,Dt)}return We}function ob(o,a){return function(u,w){return PN(u,o,a(w),{})}}function bh(o,a){return function(u,w){var S;if(u===r&&w===r)return a;if(u!==r&&(S=u),w!==r){if(S===r)return w;typeof u=="string"||typeof w=="string"?(u=An(u),w=An(w)):(u=K2(u),w=K2(w)),S=o(u,w)}return S}}function wp(o){return Zi(function(a){return a=tr(a,En(qe())),gt(function(u){var w=this;return o(a,function(S){return Sr(S,w,u)})})})}function _h(o,a){a=a===r?" ":An(a);var u=a.length;if(u<2)return u?fp(a,o):a;var w=fp(a,ah(o/Pa(a)));return Oa(a)?Ls(ii(w),0,o).join(""):w.slice(0,o)}function nR(o,a,u,w){var S=a&W,B=nl(o);function G(){for(var Q=-1,re=arguments.length,le=-1,he=w.length,ge=se(he+re),ye=this&&this!==It&&this instanceof G?B:o;++le<he;)ge[le]=w[le];for(;re--;)ge[le++]=arguments[++Q];return Sr(ye,S?u:this,ge)}return G}function ab(o){return function(a,u,w){return w&&typeof w!="number"&&Qr(a,u,w)&&(u=w=r),a=ts(a),u===r?(u=a,a=0):u=ts(u),w=w===r?a<u?1:-1:ts(w),qN(a,u,w,o)}}function Eh(o){return function(a,u){return typeof a=="string"&&typeof u=="string"||(a=Yn(a),u=Yn(u)),o(a,u)}}function cb(o,a,u,w,S,B,G,Q,re,le){var he=a&z,ge=he?G:r,ye=he?r:G,Le=he?B:r,Ke=he?r:B;a|=he?j:P,a&=~(he?P:j),a&F||(a&=~(W|Y));var pt=[o,a,S,Le,ge,Ke,ye,Q,re,le],We=u.apply(r,pt);return Dp(o)&&bb(We,pt),We.placeholder=w,_b(We,o,a)}function bp(o){var a=yr[o];return function(u,w){if(u=Yn(u),w=w==null?0:Br(ft(w),292),w&&_2(u)){var S=(Bt(u)+"e").split("e"),B=a(S[0]+"e"+(+S[1]+w));return S=(Bt(B)+"e").split("e"),+(S[0]+"e"+(+S[1]-w))}return a(u)}}var iR=$a&&1/Qu(new $a([,-0]))[1]==M?function(o){return new $a(o)}:qp;function lb(o){return function(a){var u=Ur(a);return u==ue?Jd(a):u==Fe?_$(a):d$(a,o(a))}}function Qi(o,a,u,w,S,B,G,Q){var re=a&Y;if(!re&&typeof o!="function")throw new Hn(c);var le=w?w.length:0;if(le||(a&=~(j|P),w=S=r),G=G===r?G:wr(ft(G),0),Q=Q===r?Q:ft(Q),le-=S?S.length:0,a&P){var he=w,ge=S;w=S=r}var ye=re?r:Ap(o),Le=[o,a,u,w,S,he,ge,B,G,Q];if(ye&&wR(Le,ye),o=Le[0],a=Le[1],u=Le[2],w=Le[3],S=Le[4],Q=Le[9]=Le[9]===r?re?0:o.length:wr(Le[9]-le,0),!Q&&a&(z|$)&&(a&=~(z|$)),!a||a==W)var Ke=tR(o,a,u);else a==z||a==$?Ke=rR(o,a,Q):(a==j||a==(W|j))&&!S.length?Ke=nR(o,a,u,w):Ke=wh.apply(r,Le);var pt=ye?z2:bb;return _b(pt(Ke,Le),o,a)}function ub(o,a,u,w){return o===r||oi(o,Ta[u])&&!qt.call(w,u)?a:o}function hb(o,a,u,w,S,B){return sr(o)&&sr(a)&&(B.set(a,o),gh(o,a,r,hb,B),B.delete(a)),o}function sR(o){return ol(o)?r:o}function fb(o,a,u,w,S,B){var G=u&I,Q=o.length,re=a.length;if(Q!=re&&!(G&&re>Q))return!1;var le=B.get(o),he=B.get(a);if(le&&he)return le==a&&he==o;var ge=-1,ye=!0,Le=u&R?new Po:r;for(B.set(o,a),B.set(a,o);++ge<Q;){var Ke=o[ge],pt=a[ge];if(w)var We=G?w(pt,Ke,ge,a,o,B):w(Ke,pt,ge,o,a,B);if(We!==r){if(We)continue;ye=!1;break}if(Le){if(!Hd(a,function(yt,Dt){if(!Wc(Le,Dt)&&(Ke===yt||S(Ke,yt,u,w,B)))return Le.push(Dt)})){ye=!1;break}}else if(!(Ke===pt||S(Ke,pt,u,w,B))){ye=!1;break}}return B.delete(o),B.delete(a),ye}function oR(o,a,u,w,S,B,G){switch(u){case be:if(o.byteLength!=a.byteLength||o.byteOffset!=a.byteOffset)return!1;o=o.buffer,a=a.buffer;case Be:return!(o.byteLength!=a.byteLength||!B(new nh(o),new nh(a)));case H:case V:case Oe:return oi(+o,+a);case k:return o.name==a.name&&o.message==a.message;case Ce:case Ee:return o==a+"";case ue:var Q=Jd;case Fe:var re=w&I;if(Q||(Q=Qu),o.size!=a.size&&!re)return!1;var le=G.get(o);if(le)return le==a;w|=R,G.set(o,a);var he=fb(Q(o),Q(a),w,S,B,G);return G.delete(o),he;case Ae:if(Qc)return Qc.call(o)==Qc.call(a)}return!1}function aR(o,a,u,w,S,B){var G=u&I,Q=_p(o),re=Q.length,le=_p(a),he=le.length;if(re!=he&&!G)return!1;for(var ge=re;ge--;){var ye=Q[ge];if(!(G?ye in a:qt.call(a,ye)))return!1}var Le=B.get(o),Ke=B.get(a);if(Le&&Ke)return Le==a&&Ke==o;var pt=!0;B.set(o,a),B.set(a,o);for(var We=G;++ge<re;){ye=Q[ge];var yt=o[ye],Dt=a[ye];if(w)var Sn=G?w(Dt,yt,ye,a,o,B):w(yt,Dt,ye,o,a,B);if(!(Sn===r?yt===Dt||S(yt,Dt,u,w,B):Sn)){pt=!1;break}We||(We=ye=="constructor")}if(pt&&!We){var Zr=o.constructor,In=a.constructor;Zr!=In&&"constructor"in o&&"constructor"in a&&!(typeof Zr=="function"&&Zr instanceof Zr&&typeof In=="function"&&In instanceof In)&&(pt=!1)}return B.delete(o),B.delete(a),pt}function Zi(o){return Op(yb(o,r,Db),o+"")}function _p(o){return T2(o,Ir,Sp)}function Ep(o){return T2(o,un,db)}var Ap=lh?function(o){return lh.get(o)}:qp;function Ah(o){for(var a=o.name+"",u=Na[a],w=qt.call(Na,a)?u.length:0;w--;){var S=u[w],B=S.func;if(B==null||B==o)return S.name}return a}function Ua(o){var a=qt.call(T,"placeholder")?T:o;return a.placeholder}function qe(){var o=T.iteratee||jp;return o=o===jp?R2:o,arguments.length?o(arguments[0],arguments[1]):o}function xh(o,a){var u=o.__data__;return gR(a)?u[typeof a=="string"?"string":"hash"]:u.map}function xp(o){for(var a=Ir(o),u=a.length;u--;){var w=a[u],S=o[w];a[u]=[w,S,mb(S)]}return a}function $o(o,a){var u=y$(o,a);return N2(u)?u:r}function cR(o){var a=qt.call(o,Co),u=o[Co];try{o[Co]=r;var w=!0}catch{}var S=th.call(o);return w&&(a?o[Co]=u:delete o[Co]),S}var Sp=Zd?function(o){return o==null?[]:(o=Yt(o),Os(Zd(o),function(a){return w2.call(o,a)}))}:zp,db=Zd?function(o){for(var a=[];o;)Ps(a,Sp(o)),o=ih(o);return a}:zp,Ur=Jr;(Xd&&Ur(new Xd(new ArrayBuffer(1)))!=be||Gc&&Ur(new Gc)!=ue||ep&&Ur(ep.resolve())!=Pt||$a&&Ur(new $a)!=Fe||Yc&&Ur(new Yc)!=we)&&(Ur=function(o){var a=Jr(o),u=a==Ie?o.constructor:r,w=u?No(u):"";if(w)switch(w){case H$:return be;case K$:return ue;case W$:return Pt;case V$:return Fe;case G$:return we}return a});function lR(o,a,u){for(var w=-1,S=u.length;++w<S;){var B=u[w],G=B.size;switch(B.type){case"drop":o+=G;break;case"dropRight":a-=G;break;case"take":a=Br(a,o+G);break;case"takeRight":o=wr(o,a-G);break}}return{start:o,end:a}}function uR(o){var a=o.match(ke);return a?a[1].split(Ht):[]}function pb(o,a,u){a=Rs(a,o);for(var w=-1,S=a.length,B=!1;++w<S;){var G=$i(a[w]);if(!(B=o!=null&&u(o,G)))break;o=o[G]}return B||++w!=S?B:(S=o==null?0:o.length,!!S&&Mh(S)&&Xi(G,S)&&(at(o)||Ro(o)))}function hR(o){var a=o.length,u=new o.constructor(a);return a&&typeof o[0]=="string"&&qt.call(o,"index")&&(u.index=o.index,u.input=o.input),u}function gb(o){return typeof o.constructor=="function"&&!il(o)?Ra(ih(o)):{}}function fR(o,a,u){var w=o.constructor;switch(a){case Be:return yp(o);case H:case V:return new w(+o);case be:return YN(o,u);case Pe:case je:case Te:case $e:case lt:case Re:case Ne:case nr:case dt:return Q2(o,u);case ue:return new w;case Oe:case Ee:return new w(o);case Ce:return JN(o);case Fe:return new w;case Ae:return QN(o)}}function dR(o,a){var u=a.length;if(!u)return o;var w=u-1;return a[w]=(u>1?"& ":"")+a[w],a=a.join(u>2?", ":" "),o.replace(Ze,`{
77
+ /* [wrapped with `+a+`] */
78
+ `)}function pR(o){return at(o)||Ro(o)||!!(b2&&o&&o[b2])}function Xi(o,a){var u=typeof o;return a=a??N,!!a&&(u=="number"||u!="symbol"&&kn.test(o))&&o>-1&&o%1==0&&o<a}function Qr(o,a,u){if(!sr(u))return!1;var w=typeof a;return(w=="number"?ln(u)&&Xi(a,u.length):w=="string"&&a in u)?oi(u[a],o):!1}function Ip(o,a){if(at(o))return!1;var u=typeof o;return u=="number"||u=="symbol"||u=="boolean"||o==null||xn(o)?!0:Xe.test(o)||!Mt.test(o)||a!=null&&o in Yt(a)}function gR(o){var a=typeof o;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?o!=="__proto__":o===null}function Dp(o){var a=Ah(o),u=T[a];if(typeof u!="function"||!(a in At.prototype))return!1;if(o===u)return!0;var w=Ap(u);return!!w&&o===w[0]}function mR(o){return!!m2&&m2 in o}var vR=Xu?es:Hp;function il(o){var a=o&&o.constructor,u=typeof a=="function"&&a.prototype||Ta;return o===u}function mb(o){return o===o&&!sr(o)}function vb(o,a){return function(u){return u==null?!1:u[o]===a&&(a!==r||o in Yt(u))}}function yR(o){var a=Oh(o,function(w){return u.size===h&&u.clear(),w}),u=a.cache;return a}function wR(o,a){var u=o[1],w=a[1],S=u|w,B=S<(W|Y|g),G=w==g&&u==z||w==g&&u==C&&o[7].length<=a[8]||w==(g|C)&&a[7].length<=a[8]&&u==z;if(!(B||G))return o;w&W&&(o[2]=a[2],S|=u&W?0:F);var Q=a[3];if(Q){var re=o[3];o[3]=re?X2(re,Q,a[4]):Q,o[4]=re?Ms(o[3],m):a[4]}return Q=a[5],Q&&(re=o[5],o[5]=re?eb(re,Q,a[6]):Q,o[6]=re?Ms(o[5],m):a[6]),Q=a[7],Q&&(o[7]=Q),w&g&&(o[8]=o[8]==null?a[8]:Br(o[8],a[8])),o[9]==null&&(o[9]=a[9]),o[0]=a[0],o[1]=S,o}function bR(o){var a=[];if(o!=null)for(var u in Yt(o))a.push(u);return a}function _R(o){return th.call(o)}function yb(o,a,u){return a=wr(a===r?o.length-1:a,0),function(){for(var w=arguments,S=-1,B=wr(w.length-a,0),G=se(B);++S<B;)G[S]=w[a+S];S=-1;for(var Q=se(a+1);++S<a;)Q[S]=w[S];return Q[a]=u(G),Sr(o,this,Q)}}function wb(o,a){return a.length<2?o:To(o,Vn(a,0,-1))}function ER(o,a){for(var u=o.length,w=Br(a.length,u),S=cn(o);w--;){var B=a[w];o[w]=Xi(B,u)?S[B]:r}return o}function Cp(o,a){if(!(a==="constructor"&&typeof o[a]=="function")&&a!="__proto__")return o[a]}var bb=Eb(z2),sl=B$||function(o,a){return It.setTimeout(o,a)},Op=Eb(KN);function _b(o,a,u){var w=a+"";return Op(o,dR(w,AR(uR(w),u)))}function Eb(o){var a=0,u=0;return function(){var w=k$(),S=p-(w-u);if(u=w,S>0){if(++a>=ae)return arguments[0]}else a=0;return o.apply(r,arguments)}}function Sh(o,a){var u=-1,w=o.length,S=w-1;for(a=a===r?w:a;++u<a;){var B=hp(u,S),G=o[B];o[B]=o[u],o[u]=G}return o.length=a,o}var Ab=yR(function(o){var a=[];return o.charCodeAt(0)===46&&a.push(""),o.replace(et,function(u,w,S,B){a.push(S?B.replace(ri,"$1"):w||u)}),a});function $i(o){if(typeof o=="string"||xn(o))return o;var a=o+"";return a=="0"&&1/o==-M?"-0":a}function No(o){if(o!=null){try{return eh.call(o)}catch{}try{return o+""}catch{}}return""}function AR(o,a){return zn(de,function(u){var w="_."+u[0];a&u[1]&&!Yu(o,w)&&o.push(w)}),o.sort()}function xb(o){if(o instanceof At)return o.clone();var a=new Kn(o.__wrapped__,o.__chain__);return a.__actions__=cn(o.__actions__),a.__index__=o.__index__,a.__values__=o.__values__,a}function xR(o,a,u){(u?Qr(o,a,u):a===r)?a=1:a=wr(ft(a),0);var w=o==null?0:o.length;if(!w||a<1)return[];for(var S=0,B=0,G=se(ah(w/a));S<w;)G[B++]=Vn(o,S,S+=a);return G}function SR(o){for(var a=-1,u=o==null?0:o.length,w=0,S=[];++a<u;){var B=o[a];B&&(S[w++]=B)}return S}function IR(){var o=arguments.length;if(!o)return[];for(var a=se(o-1),u=arguments[0],w=o;w--;)a[w-1]=arguments[w];return Ps(at(u)?cn(u):[u],Tr(a,1))}var DR=gt(function(o,a){return dr(o)?Xc(o,Tr(a,1,dr,!0)):[]}),CR=gt(function(o,a){var u=Gn(a);return dr(u)&&(u=r),dr(o)?Xc(o,Tr(a,1,dr,!0),qe(u,2)):[]}),OR=gt(function(o,a){var u=Gn(a);return dr(u)&&(u=r),dr(o)?Xc(o,Tr(a,1,dr,!0),r,u):[]});function PR(o,a,u){var w=o==null?0:o.length;return w?(a=u||a===r?1:ft(a),Vn(o,a<0?0:a,w)):[]}function MR(o,a,u){var w=o==null?0:o.length;return w?(a=u||a===r?1:ft(a),a=w-a,Vn(o,0,a<0?0:a)):[]}function TR(o,a){return o&&o.length?vh(o,qe(a,3),!0,!0):[]}function $R(o,a){return o&&o.length?vh(o,qe(a,3),!0):[]}function NR(o,a,u,w){var S=o==null?0:o.length;return S?(u&&typeof u!="number"&&Qr(o,a,u)&&(u=0,w=S),IN(o,a,u,w)):[]}function Sb(o,a,u){var w=o==null?0:o.length;if(!w)return-1;var S=u==null?0:ft(u);return S<0&&(S=wr(w+S,0)),Ju(o,qe(a,3),S)}function Ib(o,a,u){var w=o==null?0:o.length;if(!w)return-1;var S=w-1;return u!==r&&(S=ft(u),S=u<0?wr(w+S,0):Br(S,w-1)),Ju(o,qe(a,3),S,!0)}function Db(o){var a=o==null?0:o.length;return a?Tr(o,1):[]}function RR(o){var a=o==null?0:o.length;return a?Tr(o,M):[]}function LR(o,a){var u=o==null?0:o.length;return u?(a=a===r?1:ft(a),Tr(o,a)):[]}function BR(o){for(var a=-1,u=o==null?0:o.length,w={};++a<u;){var S=o[a];w[S[0]]=S[1]}return w}function Cb(o){return o&&o.length?o[0]:r}function UR(o,a,u){var w=o==null?0:o.length;if(!w)return-1;var S=u==null?0:ft(u);return S<0&&(S=wr(w+S,0)),Ca(o,a,S)}function FR(o){var a=o==null?0:o.length;return a?Vn(o,0,-1):[]}var jR=gt(function(o){var a=tr(o,mp);return a.length&&a[0]===o[0]?op(a):[]}),kR=gt(function(o){var a=Gn(o),u=tr(o,mp);return a===Gn(u)?a=r:u.pop(),u.length&&u[0]===o[0]?op(u,qe(a,2)):[]}),qR=gt(function(o){var a=Gn(o),u=tr(o,mp);return a=typeof a=="function"?a:r,a&&u.pop(),u.length&&u[0]===o[0]?op(u,r,a):[]});function zR(o,a){return o==null?"":F$.call(o,a)}function Gn(o){var a=o==null?0:o.length;return a?o[a-1]:r}function HR(o,a,u){var w=o==null?0:o.length;if(!w)return-1;var S=w;return u!==r&&(S=ft(u),S=S<0?wr(w+S,0):Br(S,w-1)),a===a?A$(o,a,S):Ju(o,c2,S,!0)}function KR(o,a){return o&&o.length?F2(o,ft(a)):r}var WR=gt(Ob);function Ob(o,a){return o&&o.length&&a&&a.length?up(o,a):o}function VR(o,a,u){return o&&o.length&&a&&a.length?up(o,a,qe(u,2)):o}function GR(o,a,u){return o&&o.length&&a&&a.length?up(o,a,r,u):o}var YR=Zi(function(o,a){var u=o==null?0:o.length,w=rp(o,a);return q2(o,tr(a,function(S){return Xi(S,u)?+S:S}).sort(Z2)),w});function JR(o,a){var u=[];if(!(o&&o.length))return u;var w=-1,S=[],B=o.length;for(a=qe(a,3);++w<B;){var G=o[w];a(G,w,o)&&(u.push(G),S.push(w))}return q2(o,S),u}function Pp(o){return o==null?o:z$.call(o)}function QR(o,a,u){var w=o==null?0:o.length;return w?(u&&typeof u!="number"&&Qr(o,a,u)?(a=0,u=w):(a=a==null?0:ft(a),u=u===r?w:ft(u)),Vn(o,a,u)):[]}function ZR(o,a){return mh(o,a)}function XR(o,a,u){return dp(o,a,qe(u,2))}function eL(o,a){var u=o==null?0:o.length;if(u){var w=mh(o,a);if(w<u&&oi(o[w],a))return w}return-1}function tL(o,a){return mh(o,a,!0)}function rL(o,a,u){return dp(o,a,qe(u,2),!0)}function nL(o,a){var u=o==null?0:o.length;if(u){var w=mh(o,a,!0)-1;if(oi(o[w],a))return w}return-1}function iL(o){return o&&o.length?H2(o):[]}function sL(o,a){return o&&o.length?H2(o,qe(a,2)):[]}function oL(o){var a=o==null?0:o.length;return a?Vn(o,1,a):[]}function aL(o,a,u){return o&&o.length?(a=u||a===r?1:ft(a),Vn(o,0,a<0?0:a)):[]}function cL(o,a,u){var w=o==null?0:o.length;return w?(a=u||a===r?1:ft(a),a=w-a,Vn(o,a<0?0:a,w)):[]}function lL(o,a){return o&&o.length?vh(o,qe(a,3),!1,!0):[]}function uL(o,a){return o&&o.length?vh(o,qe(a,3)):[]}var hL=gt(function(o){return Ns(Tr(o,1,dr,!0))}),fL=gt(function(o){var a=Gn(o);return dr(a)&&(a=r),Ns(Tr(o,1,dr,!0),qe(a,2))}),dL=gt(function(o){var a=Gn(o);return a=typeof a=="function"?a:r,Ns(Tr(o,1,dr,!0),r,a)});function pL(o){return o&&o.length?Ns(o):[]}function gL(o,a){return o&&o.length?Ns(o,qe(a,2)):[]}function mL(o,a){return a=typeof a=="function"?a:r,o&&o.length?Ns(o,r,a):[]}function Mp(o){if(!(o&&o.length))return[];var a=0;return o=Os(o,function(u){if(dr(u))return a=wr(u.length,a),!0}),Gd(a,function(u){return tr(o,Kd(u))})}function Pb(o,a){if(!(o&&o.length))return[];var u=Mp(o);return a==null?u:tr(u,function(w){return Sr(a,r,w)})}var vL=gt(function(o,a){return dr(o)?Xc(o,a):[]}),yL=gt(function(o){return gp(Os(o,dr))}),wL=gt(function(o){var a=Gn(o);return dr(a)&&(a=r),gp(Os(o,dr),qe(a,2))}),bL=gt(function(o){var a=Gn(o);return a=typeof a=="function"?a:r,gp(Os(o,dr),r,a)}),_L=gt(Mp);function EL(o,a){return G2(o||[],a||[],Zc)}function AL(o,a){return G2(o||[],a||[],rl)}var xL=gt(function(o){var a=o.length,u=a>1?o[a-1]:r;return u=typeof u=="function"?(o.pop(),u):r,Pb(o,u)});function Mb(o){var a=T(o);return a.__chain__=!0,a}function SL(o,a){return a(o),o}function Ih(o,a){return a(o)}var IL=Zi(function(o){var a=o.length,u=a?o[0]:0,w=this.__wrapped__,S=function(B){return rp(B,o)};return a>1||this.__actions__.length||!(w instanceof At)||!Xi(u)?this.thru(S):(w=w.slice(u,+u+(a?1:0)),w.__actions__.push({func:Ih,args:[S],thisArg:r}),new Kn(w,this.__chain__).thru(function(B){return a&&!B.length&&B.push(r),B}))});function DL(){return Mb(this)}function CL(){return new Kn(this.value(),this.__chain__)}function OL(){this.__values__===r&&(this.__values__=Kb(this.value()));var o=this.__index__>=this.__values__.length,a=o?r:this.__values__[this.__index__++];return{done:o,value:a}}function PL(){return this}function ML(o){for(var a,u=this;u instanceof hh;){var w=xb(u);w.__index__=0,w.__values__=r,a?S.__wrapped__=w:a=w;var S=w;u=u.__wrapped__}return S.__wrapped__=o,a}function TL(){var o=this.__wrapped__;if(o instanceof At){var a=o;return this.__actions__.length&&(a=new At(this)),a=a.reverse(),a.__actions__.push({func:Ih,args:[Pp],thisArg:r}),new Kn(a,this.__chain__)}return this.thru(Pp)}function $L(){return V2(this.__wrapped__,this.__actions__)}var NL=yh(function(o,a,u){qt.call(o,u)?++o[u]:Ji(o,u,1)});function RL(o,a,u){var w=at(o)?o2:SN;return u&&Qr(o,a,u)&&(a=r),w(o,qe(a,3))}function LL(o,a){var u=at(o)?Os:P2;return u(o,qe(a,3))}var BL=ib(Sb),UL=ib(Ib);function FL(o,a){return Tr(Dh(o,a),1)}function jL(o,a){return Tr(Dh(o,a),M)}function kL(o,a,u){return u=u===r?1:ft(u),Tr(Dh(o,a),u)}function Tb(o,a){var u=at(o)?zn:$s;return u(o,qe(a,3))}function $b(o,a){var u=at(o)?o$:O2;return u(o,qe(a,3))}var qL=yh(function(o,a,u){qt.call(o,u)?o[u].push(a):Ji(o,u,[a])});function zL(o,a,u,w){o=ln(o)?o:ja(o),u=u&&!w?ft(u):0;var S=o.length;return u<0&&(u=wr(S+u,0)),Th(o)?u<=S&&o.indexOf(a,u)>-1:!!S&&Ca(o,a,u)>-1}var HL=gt(function(o,a,u){var w=-1,S=typeof a=="function",B=ln(o)?se(o.length):[];return $s(o,function(G){B[++w]=S?Sr(a,G,u):el(G,a,u)}),B}),KL=yh(function(o,a,u){Ji(o,u,a)});function Dh(o,a){var u=at(o)?tr:L2;return u(o,qe(a,3))}function WL(o,a,u,w){return o==null?[]:(at(a)||(a=a==null?[]:[a]),u=w?r:u,at(u)||(u=u==null?[]:[u]),j2(o,a,u))}var VL=yh(function(o,a,u){o[u?0:1].push(a)},function(){return[[],[]]});function GL(o,a,u){var w=at(o)?zd:u2,S=arguments.length<3;return w(o,qe(a,4),u,S,$s)}function YL(o,a,u){var w=at(o)?a$:u2,S=arguments.length<3;return w(o,qe(a,4),u,S,O2)}function JL(o,a){var u=at(o)?Os:P2;return u(o,Ph(qe(a,3)))}function QL(o){var a=at(o)?S2:zN;return a(o)}function ZL(o,a,u){(u?Qr(o,a,u):a===r)?a=1:a=ft(a);var w=at(o)?bN:HN;return w(o,a)}function XL(o){var a=at(o)?_N:WN;return a(o)}function eB(o){if(o==null)return 0;if(ln(o))return Th(o)?Pa(o):o.length;var a=Ur(o);return a==ue||a==Fe?o.size:cp(o).length}function tB(o,a,u){var w=at(o)?Hd:VN;return u&&Qr(o,a,u)&&(a=r),w(o,qe(a,3))}var rB=gt(function(o,a){if(o==null)return[];var u=a.length;return u>1&&Qr(o,a[0],a[1])?a=[]:u>2&&Qr(a[0],a[1],a[2])&&(a=[a[0]]),j2(o,Tr(a,1),[])}),Ch=L$||function(){return It.Date.now()};function nB(o,a){if(typeof a!="function")throw new Hn(c);return o=ft(o),function(){if(--o<1)return a.apply(this,arguments)}}function Nb(o,a,u){return a=u?r:a,a=o&&a==null?o.length:a,Qi(o,g,r,r,r,r,a)}function Rb(o,a){var u;if(typeof a!="function")throw new Hn(c);return o=ft(o),function(){return--o>0&&(u=a.apply(this,arguments)),o<=1&&(a=r),u}}var Tp=gt(function(o,a,u){var w=W;if(u.length){var S=Ms(u,Ua(Tp));w|=j}return Qi(o,w,a,u,S)}),Lb=gt(function(o,a,u){var w=W|Y;if(u.length){var S=Ms(u,Ua(Lb));w|=j}return Qi(a,w,o,u,S)});function Bb(o,a,u){a=u?r:a;var w=Qi(o,z,r,r,r,r,r,a);return w.placeholder=Bb.placeholder,w}function Ub(o,a,u){a=u?r:a;var w=Qi(o,$,r,r,r,r,r,a);return w.placeholder=Ub.placeholder,w}function Fb(o,a,u){var w,S,B,G,Q,re,le=0,he=!1,ge=!1,ye=!0;if(typeof o!="function")throw new Hn(c);a=Yn(a)||0,sr(u)&&(he=!!u.leading,ge="maxWait"in u,B=ge?wr(Yn(u.maxWait)||0,a):B,ye="trailing"in u?!!u.trailing:ye);function Le(pr){var ai=w,rs=S;return w=S=r,le=pr,G=o.apply(rs,ai),G}function Ke(pr){return le=pr,Q=sl(yt,a),he?Le(pr):G}function pt(pr){var ai=pr-re,rs=pr-le,i3=a-ai;return ge?Br(i3,B-rs):i3}function We(pr){var ai=pr-re,rs=pr-le;return re===r||ai>=a||ai<0||ge&&rs>=B}function yt(){var pr=Ch();if(We(pr))return Dt(pr);Q=sl(yt,pt(pr))}function Dt(pr){return Q=r,ye&&w?Le(pr):(w=S=r,G)}function Sn(){Q!==r&&Y2(Q),le=0,w=re=S=Q=r}function Zr(){return Q===r?G:Dt(Ch())}function In(){var pr=Ch(),ai=We(pr);if(w=arguments,S=this,re=pr,ai){if(Q===r)return Ke(re);if(ge)return Y2(Q),Q=sl(yt,a),Le(re)}return Q===r&&(Q=sl(yt,a)),G}return In.cancel=Sn,In.flush=Zr,In}var iB=gt(function(o,a){return C2(o,1,a)}),sB=gt(function(o,a,u){return C2(o,Yn(a)||0,u)});function oB(o){return Qi(o,Z)}function Oh(o,a){if(typeof o!="function"||a!=null&&typeof a!="function")throw new Hn(c);var u=function(){var w=arguments,S=a?a.apply(this,w):w[0],B=u.cache;if(B.has(S))return B.get(S);var G=o.apply(this,w);return u.cache=B.set(S,G)||B,G};return u.cache=new(Oh.Cache||Yi),u}Oh.Cache=Yi;function Ph(o){if(typeof o!="function")throw new Hn(c);return function(){var a=arguments;switch(a.length){case 0:return!o.call(this);case 1:return!o.call(this,a[0]);case 2:return!o.call(this,a[0],a[1]);case 3:return!o.call(this,a[0],a[1],a[2])}return!o.apply(this,a)}}function aB(o){return Rb(2,o)}var cB=GN(function(o,a){a=a.length==1&&at(a[0])?tr(a[0],En(qe())):tr(Tr(a,1),En(qe()));var u=a.length;return gt(function(w){for(var S=-1,B=Br(w.length,u);++S<B;)w[S]=a[S].call(this,w[S]);return Sr(o,this,w)})}),$p=gt(function(o,a){var u=Ms(a,Ua($p));return Qi(o,j,r,a,u)}),jb=gt(function(o,a){var u=Ms(a,Ua(jb));return Qi(o,P,r,a,u)}),lB=Zi(function(o,a){return Qi(o,C,r,r,r,a)});function uB(o,a){if(typeof o!="function")throw new Hn(c);return a=a===r?a:ft(a),gt(o,a)}function hB(o,a){if(typeof o!="function")throw new Hn(c);return a=a==null?0:wr(ft(a),0),gt(function(u){var w=u[a],S=Ls(u,0,a);return w&&Ps(S,w),Sr(o,this,S)})}function fB(o,a,u){var w=!0,S=!0;if(typeof o!="function")throw new Hn(c);return sr(u)&&(w="leading"in u?!!u.leading:w,S="trailing"in u?!!u.trailing:S),Fb(o,a,{leading:w,maxWait:a,trailing:S})}function dB(o){return Nb(o,1)}function pB(o,a){return $p(vp(a),o)}function gB(){if(!arguments.length)return[];var o=arguments[0];return at(o)?o:[o]}function mB(o){return Wn(o,A)}function vB(o,a){return a=typeof a=="function"?a:r,Wn(o,A,a)}function yB(o){return Wn(o,_|A)}function wB(o,a){return a=typeof a=="function"?a:r,Wn(o,_|A,a)}function bB(o,a){return a==null||D2(o,a,Ir(a))}function oi(o,a){return o===a||o!==o&&a!==a}var _B=Eh(sp),EB=Eh(function(o,a){return o>=a}),Ro=$2(function(){return arguments}())?$2:function(o){return cr(o)&&qt.call(o,"callee")&&!w2.call(o,"callee")},at=se.isArray,AB=Yr?En(Yr):MN;function ln(o){return o!=null&&Mh(o.length)&&!es(o)}function dr(o){return cr(o)&&ln(o)}function xB(o){return o===!0||o===!1||cr(o)&&Jr(o)==H}var Bs=U$||Hp,SB=ni?En(ni):TN;function IB(o){return cr(o)&&o.nodeType===1&&!ol(o)}function DB(o){if(o==null)return!0;if(ln(o)&&(at(o)||typeof o=="string"||typeof o.splice=="function"||Bs(o)||Fa(o)||Ro(o)))return!o.length;var a=Ur(o);if(a==ue||a==Fe)return!o.size;if(il(o))return!cp(o).length;for(var u in o)if(qt.call(o,u))return!1;return!0}function CB(o,a){return tl(o,a)}function OB(o,a,u){u=typeof u=="function"?u:r;var w=u?u(o,a):r;return w===r?tl(o,a,r,u):!!w}function Np(o){if(!cr(o))return!1;var a=Jr(o);return a==k||a==y||typeof o.message=="string"&&typeof o.name=="string"&&!ol(o)}function PB(o){return typeof o=="number"&&_2(o)}function es(o){if(!sr(o))return!1;var a=Jr(o);return a==ie||a==fe||a==q||a==ze}function kb(o){return typeof o=="number"&&o==ft(o)}function Mh(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=N}function sr(o){var a=typeof o;return o!=null&&(a=="object"||a=="function")}function cr(o){return o!=null&&typeof o=="object"}var qb=qn?En(qn):NN;function MB(o,a){return o===a||ap(o,a,xp(a))}function TB(o,a,u){return u=typeof u=="function"?u:r,ap(o,a,xp(a),u)}function $B(o){return zb(o)&&o!=+o}function NB(o){if(vR(o))throw new it(s);return N2(o)}function RB(o){return o===null}function LB(o){return o==null}function zb(o){return typeof o=="number"||cr(o)&&Jr(o)==Oe}function ol(o){if(!cr(o)||Jr(o)!=Ie)return!1;var a=ih(o);if(a===null)return!0;var u=qt.call(a,"constructor")&&a.constructor;return typeof u=="function"&&u instanceof u&&eh.call(u)==T$}var Rp=Pi?En(Pi):RN;function BB(o){return kb(o)&&o>=-N&&o<=N}var Hb=Kc?En(Kc):LN;function Th(o){return typeof o=="string"||!at(o)&&cr(o)&&Jr(o)==Ee}function xn(o){return typeof o=="symbol"||cr(o)&&Jr(o)==Ae}var Fa=Do?En(Do):BN;function UB(o){return o===r}function FB(o){return cr(o)&&Ur(o)==we}function jB(o){return cr(o)&&Jr(o)==xe}var kB=Eh(lp),qB=Eh(function(o,a){return o<=a});function Kb(o){if(!o)return[];if(ln(o))return Th(o)?ii(o):cn(o);if(Vc&&o[Vc])return b$(o[Vc]());var a=Ur(o),u=a==ue?Jd:a==Fe?Qu:ja;return u(o)}function ts(o){if(!o)return o===0?o:0;if(o=Yn(o),o===M||o===-M){var a=o<0?-1:1;return a*U}return o===o?o:0}function ft(o){var a=ts(o),u=a%1;return a===a?u?a-u:a:0}function Wb(o){return o?Mo(ft(o),0,v):0}function Yn(o){if(typeof o=="number")return o;if(xn(o))return O;if(sr(o)){var a=typeof o.valueOf=="function"?o.valueOf():o;o=sr(a)?a+"":a}if(typeof o!="string")return o===0?o:+o;o=h2(o);var u=Un.test(o);return u||jn.test(o)?ot(o.slice(2),u?2:8):Bn.test(o)?O:+o}function Vb(o){return Ti(o,un(o))}function zB(o){return o?Mo(ft(o),-N,N):o===0?o:0}function Bt(o){return o==null?"":An(o)}var HB=La(function(o,a){if(il(a)||ln(a)){Ti(a,Ir(a),o);return}for(var u in a)qt.call(a,u)&&Zc(o,u,a[u])}),Gb=La(function(o,a){Ti(a,un(a),o)}),$h=La(function(o,a,u,w){Ti(a,un(a),o,w)}),KB=La(function(o,a,u,w){Ti(a,Ir(a),o,w)}),WB=Zi(rp);function VB(o,a){var u=Ra(o);return a==null?u:I2(u,a)}var GB=gt(function(o,a){o=Yt(o);var u=-1,w=a.length,S=w>2?a[2]:r;for(S&&Qr(a[0],a[1],S)&&(w=1);++u<w;)for(var B=a[u],G=un(B),Q=-1,re=G.length;++Q<re;){var le=G[Q],he=o[le];(he===r||oi(he,Ta[le])&&!qt.call(o,le))&&(o[le]=B[le])}return o}),YB=gt(function(o){return o.push(r,hb),Sr(Yb,r,o)});function JB(o,a){return a2(o,qe(a,3),Mi)}function QB(o,a){return a2(o,qe(a,3),ip)}function ZB(o,a){return o==null?o:np(o,qe(a,3),un)}function XB(o,a){return o==null?o:M2(o,qe(a,3),un)}function eU(o,a){return o&&Mi(o,qe(a,3))}function tU(o,a){return o&&ip(o,qe(a,3))}function rU(o){return o==null?[]:ph(o,Ir(o))}function nU(o){return o==null?[]:ph(o,un(o))}function Lp(o,a,u){var w=o==null?r:To(o,a);return w===r?u:w}function iU(o,a){return o!=null&&pb(o,a,DN)}function Bp(o,a){return o!=null&&pb(o,a,CN)}var sU=ob(function(o,a,u){a!=null&&typeof a.toString!="function"&&(a=th.call(a)),o[a]=u},Fp(hn)),oU=ob(function(o,a,u){a!=null&&typeof a.toString!="function"&&(a=th.call(a)),qt.call(o,a)?o[a].push(u):o[a]=[u]},qe),aU=gt(el);function Ir(o){return ln(o)?x2(o):cp(o)}function un(o){return ln(o)?x2(o,!0):UN(o)}function cU(o,a){var u={};return a=qe(a,3),Mi(o,function(w,S,B){Ji(u,a(w,S,B),w)}),u}function lU(o,a){var u={};return a=qe(a,3),Mi(o,function(w,S,B){Ji(u,S,a(w,S,B))}),u}var uU=La(function(o,a,u){gh(o,a,u)}),Yb=La(function(o,a,u,w){gh(o,a,u,w)}),hU=Zi(function(o,a){var u={};if(o==null)return u;var w=!1;a=tr(a,function(B){return B=Rs(B,o),w||(w=B.length>1),B}),Ti(o,Ep(o),u),w&&(u=Wn(u,_|E|A,sR));for(var S=a.length;S--;)pp(u,a[S]);return u});function fU(o,a){return Jb(o,Ph(qe(a)))}var dU=Zi(function(o,a){return o==null?{}:jN(o,a)});function Jb(o,a){if(o==null)return{};var u=tr(Ep(o),function(w){return[w]});return a=qe(a),k2(o,u,function(w,S){return a(w,S[0])})}function pU(o,a,u){a=Rs(a,o);var w=-1,S=a.length;for(S||(S=1,o=r);++w<S;){var B=o==null?r:o[$i(a[w])];B===r&&(w=S,B=u),o=es(B)?B.call(o):B}return o}function gU(o,a,u){return o==null?o:rl(o,a,u)}function mU(o,a,u,w){return w=typeof w=="function"?w:r,o==null?o:rl(o,a,u,w)}var Qb=lb(Ir),Zb=lb(un);function vU(o,a,u){var w=at(o),S=w||Bs(o)||Fa(o);if(a=qe(a,4),u==null){var B=o&&o.constructor;S?u=w?new B:[]:sr(o)?u=es(B)?Ra(ih(o)):{}:u={}}return(S?zn:Mi)(o,function(G,Q,re){return a(u,G,Q,re)}),u}function yU(o,a){return o==null?!0:pp(o,a)}function wU(o,a,u){return o==null?o:W2(o,a,vp(u))}function bU(o,a,u,w){return w=typeof w=="function"?w:r,o==null?o:W2(o,a,vp(u),w)}function ja(o){return o==null?[]:Yd(o,Ir(o))}function _U(o){return o==null?[]:Yd(o,un(o))}function EU(o,a,u){return u===r&&(u=a,a=r),u!==r&&(u=Yn(u),u=u===u?u:0),a!==r&&(a=Yn(a),a=a===a?a:0),Mo(Yn(o),a,u)}function AU(o,a,u){return a=ts(a),u===r?(u=a,a=0):u=ts(u),o=Yn(o),ON(o,a,u)}function xU(o,a,u){if(u&&typeof u!="boolean"&&Qr(o,a,u)&&(a=u=r),u===r&&(typeof a=="boolean"?(u=a,a=r):typeof o=="boolean"&&(u=o,o=r)),o===r&&a===r?(o=0,a=1):(o=ts(o),a===r?(a=o,o=0):a=ts(a)),o>a){var w=o;o=a,a=w}if(u||o%1||a%1){var S=E2();return Br(o+S*(a-o+Vt("1e-"+((S+"").length-1))),a)}return hp(o,a)}var SU=Ba(function(o,a,u){return a=a.toLowerCase(),o+(u?Xb(a):a)});function Xb(o){return Up(Bt(o).toLowerCase())}function e3(o){return o=Bt(o),o&&o.replace(xr,g$).replace(jd,"")}function IU(o,a,u){o=Bt(o),a=An(a);var w=o.length;u=u===r?w:Mo(ft(u),0,w);var S=u;return u-=a.length,u>=0&&o.slice(u,S)==a}function DU(o){return o=Bt(o),o&&He.test(o)?o.replace(Vr,m$):o}function CU(o){return o=Bt(o),o&&tt.test(o)?o.replace(Lt,"\\$&"):o}var OU=Ba(function(o,a,u){return o+(u?"-":"")+a.toLowerCase()}),PU=Ba(function(o,a,u){return o+(u?" ":"")+a.toLowerCase()}),MU=nb("toLowerCase");function TU(o,a,u){o=Bt(o),a=ft(a);var w=a?Pa(o):0;if(!a||w>=a)return o;var S=(a-w)/2;return _h(ch(S),u)+o+_h(ah(S),u)}function $U(o,a,u){o=Bt(o),a=ft(a);var w=a?Pa(o):0;return a&&w<a?o+_h(a-w,u):o}function NU(o,a,u){o=Bt(o),a=ft(a);var w=a?Pa(o):0;return a&&w<a?_h(a-w,u)+o:o}function RU(o,a,u){return u||a==null?a=0:a&&(a=+a),q$(Bt(o).replace(Qe,""),a||0)}function LU(o,a,u){return(u?Qr(o,a,u):a===r)?a=1:a=ft(a),fp(Bt(o),a)}function BU(){var o=arguments,a=Bt(o[0]);return o.length<3?a:a.replace(o[1],o[2])}var UU=Ba(function(o,a,u){return o+(u?"_":"")+a.toLowerCase()});function FU(o,a,u){return u&&typeof u!="number"&&Qr(o,a,u)&&(a=u=r),u=u===r?v:u>>>0,u?(o=Bt(o),o&&(typeof a=="string"||a!=null&&!Rp(a))&&(a=An(a),!a&&Oa(o))?Ls(ii(o),0,u):o.split(a,u)):[]}var jU=Ba(function(o,a,u){return o+(u?" ":"")+Up(a)});function kU(o,a,u){return o=Bt(o),u=u==null?0:Mo(ft(u),0,o.length),a=An(a),o.slice(u,u+a.length)==a}function qU(o,a,u){var w=T.templateSettings;u&&Qr(o,a,u)&&(a=r),o=Bt(o),a=$h({},a,w,ub);var S=$h({},a.imports,w.imports,ub),B=Ir(S),G=Yd(S,B),Q,re,le=0,he=a.interpolate||Ii,ge="__p += '",ye=Qd((a.escape||Ii).source+"|"+he.source+"|"+(he===Ve?kt:Ii).source+"|"+(a.evaluate||Ii).source+"|$","g"),Le="//# sourceURL="+(qt.call(a,"sourceURL")?(a.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++kd+"]")+`
79
+ `;o.replace(ye,function(We,yt,Dt,Sn,Zr,In){return Dt||(Dt=Sn),ge+=o.slice(le,In).replace(mo,v$),yt&&(Q=!0,ge+=`' +
80
+ __e(`+yt+`) +
81
+ '`),Zr&&(re=!0,ge+=`';
82
+ `+Zr+`;
83
+ __p += '`),Dt&&(ge+=`' +
84
+ ((__t = (`+Dt+`)) == null ? '' : __t) +
85
+ '`),le=In+We.length,We}),ge+=`';
86
+ `;var Ke=qt.call(a,"variable")&&a.variable;if(!Ke)ge=`with (obj) {
87
+ `+ge+`
78
88
  }
79
- `;else if(uf.test(Ie))throw new Re(u);oe=(z?oe.replace($n,""):oe).replace(Sr,"$1").replace(Wn,"$1;"),oe="function("+(Ie||"obj")+`) {
80
- `+(Ie?"":`obj || (obj = {});
81
- `)+"var __t, __p = ''"+(M?", __e = _.escape":"")+(z?`, __j = Array.prototype.join;
89
+ `;else if(jt.test(Ke))throw new it(l);ge=(re?ge.replace(Et,""):ge).replace(ir,"$1").replace(St,"$1;"),ge="function("+(Ke||"obj")+`) {
90
+ `+(Ke?"":`obj || (obj = {});
91
+ `)+"var __t, __p = ''"+(Q?", __e = _.escape":"")+(re?`, __j = Array.prototype.join;
82
92
  function print() { __p += __j.call(arguments, '') }
83
93
  `:`;
84
- `)+oe+`return __p
85
- }`;var We=Dy(function(){return ut(D,ye+"return "+oe).apply(t,R)});if(We.source=oe,xd(We))throw We;return We}function G9(s){return ft(s).toLowerCase()}function Y9(s){return ft(s).toUpperCase()}function Z9(s,o,l){if(s=ft(s),s&&(l||o===t))return Nm(s);if(!s||!(o=Zr(o)))return s;var p=vn(s),v=vn(o),D=Lm(p,v),R=Mm(p,v)+1;return $i(p,D,R).join("")}function J9(s,o,l){if(s=ft(s),s&&(l||o===t))return s.slice(0,jm(s)+1);if(!s||!(o=Zr(o)))return s;var p=vn(s),v=Mm(p,vn(o))+1;return $i(p,0,v).join("")}function Q9(s,o,l){if(s=ft(s),s&&(l||o===t))return s.replace(Bt,"");if(!s||!(o=Zr(o)))return s;var p=vn(s),v=Lm(p,vn(o));return $i(p,v).join("")}function X9(s,o){var l=F,p=V;if(Nt(o)){var v="separator"in o?o.separator:v;l="length"in o?qe(o.length):l,p="omission"in o?Zr(o.omission):p}s=ft(s);var D=s.length;if(no(s)){var R=vn(s);D=R.length}if(l>=D)return s;var M=l-io(p);if(M<1)return p;var z=R?$i(R,0,M).join(""):s.slice(0,M);if(v===t)return z+p;if(R&&(M+=z.length-M),Id(v)){if(s.slice(M).search(v)){var te,re=z;for(v.global||(v=Bf(v.source,ft(nn.exec(v))+"g")),v.lastIndex=0;te=v.exec(re);)var oe=te.index;z=z.slice(0,oe===t?M:oe)}}else if(s.indexOf(Zr(v),M)!=M){var fe=z.lastIndexOf(v);fe>-1&&(z=z.slice(0,fe))}return z+p}function eT(s){return s=ft(s),s&&Mt.test(s)?s.replace(bi,$C):s}var tT=ho(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),Od=Sv("toUpperCase");function Iy(s,o,l){return s=ft(s),o=l?t:o,o===t?IC(s)?TC(s):gC(s):s.match(o)||[]}var Dy=Ge(function(s,o){try{return ar(s,t,o)}catch(l){return xd(l)?l:new Re(l)}}),rT=Qn(function(s,o){return on(o,function(l){l=Nn(l),Zn(s,l,_d(s[l],s))}),s});function nT(s){var o=s==null?0:s.length,l=_e();return s=o?Pt(s,function(p){if(typeof p[1]!="function")throw new an(c);return[l(p[0]),p[1]]}):[],Ge(function(p){for(var v=-1;++v<o;){var D=s[v];if(ar(D[0],this,p))return ar(D[1],this,p)}})}function iT(s){return $7(ln(s,w))}function Cd(s){return function(){return s}}function sT(s,o){return s==null||s!==s?o:s}var oT=Cv(),aT=Cv(!0);function kr(s){return s}function $d(s){return iv(typeof s=="function"?s:ln(s,w))}function cT(s){return ov(ln(s,w))}function lT(s,o){return av(s,ln(o,w))}var uT=Ge(function(s,o){return function(l){return wa(l,s,o)}}),hT=Ge(function(s,o){return function(l){return wa(s,l,o)}});function Ad(s,o,l){var p=cr(o),v=pl(o,p);l==null&&!(Nt(o)&&(v.length||!p.length))&&(l=o,o=s,s=this,v=pl(o,cr(o)));var D=!(Nt(l)&&"chain"in l)||!!l.chain,R=ei(s);return on(v,function(M){var z=o[M];s[M]=z,R&&(s.prototype[M]=function(){var te=this.__chain__;if(D||te){var re=s(this.__wrapped__),oe=re.__actions__=jr(this.__actions__);return oe.push({func:z,args:arguments,thisArg:s}),re.__chain__=te,re}return z.apply(s,xi([this.value()],arguments))})}),s}function fT(){return it._===this&&(it._=jC),this}function Pd(){}function dT(s){return s=qe(s),Ge(function(o){return cv(o,s)})}var pT=cd(Pt),gT=cd($m),mT=cd(Rf);function Sy(s){return gd(s)?Nf(Nn(s)):K7(s)}function vT(s){return function(o){return s==null?t:ds(s,o)}}var yT=Av(),wT=Av(!0);function Td(){return[]}function Rd(){return!1}function bT(){return{}}function _T(){return""}function ET(){return!0}function xT(s,o){if(s=qe(s),s<1||s>Y)return[];var l=ie,p=gr(s,ie);o=_e(o),s-=ie;for(var v=Uf(p,o);++l<s;)o(l);return v}function IT(s){return Le(s)?Pt(s,Nn):Jr(s)?[s]:jr(Kv(ft(s)))}function DT(s){var o=++MC;return ft(s)+o}var ST=bl(function(s,o){return s+o},0),OT=ld("ceil"),CT=bl(function(s,o){return s/o},1),$T=ld("floor");function AT(s){return s&&s.length?dl(s,kr,Gf):t}function PT(s,o){return s&&s.length?dl(s,_e(o,2),Gf):t}function TT(s){return Tm(s,kr)}function RT(s,o){return Tm(s,_e(o,2))}function NT(s){return s&&s.length?dl(s,kr,Qf):t}function LT(s,o){return s&&s.length?dl(s,_e(o,2),Qf):t}var MT=bl(function(s,o){return s*o},1),UT=ld("round"),jT=bl(function(s,o){return s-o},0);function FT(s){return s&&s.length?Mf(s,kr):0}function BT(s,o){return s&&s.length?Mf(s,_e(o,2)):0}return E.after=cP,E.ary=ny,E.assign=YP,E.assignIn=vy,E.assignInWith=Rl,E.assignWith=ZP,E.at=JP,E.before=iy,E.bind=_d,E.bindAll=rT,E.bindKey=sy,E.castArray=bP,E.chain=ey,E.chunk=$$,E.compact=A$,E.concat=P$,E.cond=nT,E.conforms=iT,E.constant=Cd,E.countBy=FA,E.create=QP,E.curry=oy,E.curryRight=ay,E.debounce=cy,E.defaults=XP,E.defaultsDeep=e9,E.defer=lP,E.delay=uP,E.difference=T$,E.differenceBy=R$,E.differenceWith=N$,E.drop=L$,E.dropRight=M$,E.dropRightWhile=U$,E.dropWhile=j$,E.fill=F$,E.filter=kA,E.flatMap=HA,E.flatMapDeep=WA,E.flatMapDepth=KA,E.flatten=Zv,E.flattenDeep=B$,E.flattenDepth=k$,E.flip=hP,E.flow=oT,E.flowRight=aT,E.fromPairs=q$,E.functions=a9,E.functionsIn=c9,E.groupBy=VA,E.initial=H$,E.intersection=W$,E.intersectionBy=K$,E.intersectionWith=V$,E.invert=u9,E.invertBy=h9,E.invokeMap=YA,E.iteratee=$d,E.keyBy=ZA,E.keys=cr,E.keysIn=Br,E.map=Ol,E.mapKeys=d9,E.mapValues=p9,E.matches=cT,E.matchesProperty=lT,E.memoize=$l,E.merge=g9,E.mergeWith=yy,E.method=uT,E.methodOf=hT,E.mixin=Ad,E.negate=Al,E.nthArg=dT,E.omit=m9,E.omitBy=v9,E.once=fP,E.orderBy=JA,E.over=pT,E.overArgs=dP,E.overEvery=gT,E.overSome=mT,E.partial=Ed,E.partialRight=ly,E.partition=QA,E.pick=y9,E.pickBy=wy,E.property=Sy,E.propertyOf=vT,E.pull=J$,E.pullAll=Qv,E.pullAllBy=Q$,E.pullAllWith=X$,E.pullAt=eA,E.range=yT,E.rangeRight=wT,E.rearg=pP,E.reject=tP,E.remove=tA,E.rest=gP,E.reverse=wd,E.sampleSize=nP,E.set=b9,E.setWith=_9,E.shuffle=iP,E.slice=rA,E.sortBy=aP,E.sortedUniq=lA,E.sortedUniqBy=uA,E.split=H9,E.spread=mP,E.tail=hA,E.take=fA,E.takeRight=dA,E.takeRightWhile=pA,E.takeWhile=gA,E.tap=AA,E.throttle=vP,E.thru=Sl,E.toArray=py,E.toPairs=by,E.toPairsIn=_y,E.toPath=IT,E.toPlainObject=my,E.transform=E9,E.unary=yP,E.union=mA,E.unionBy=vA,E.unionWith=yA,E.uniq=wA,E.uniqBy=bA,E.uniqWith=_A,E.unset=x9,E.unzip=bd,E.unzipWith=Xv,E.update=I9,E.updateWith=D9,E.values=go,E.valuesIn=S9,E.without=EA,E.words=Iy,E.wrap=wP,E.xor=xA,E.xorBy=IA,E.xorWith=DA,E.zip=SA,E.zipObject=OA,E.zipObjectDeep=CA,E.zipWith=$A,E.entries=by,E.entriesIn=_y,E.extend=vy,E.extendWith=Rl,Ad(E,E),E.add=ST,E.attempt=Dy,E.camelCase=A9,E.capitalize=Ey,E.ceil=OT,E.clamp=O9,E.clone=_P,E.cloneDeep=xP,E.cloneDeepWith=IP,E.cloneWith=EP,E.conformsTo=DP,E.deburr=xy,E.defaultTo=sT,E.divide=CT,E.endsWith=P9,E.eq=wn,E.escape=T9,E.escapeRegExp=R9,E.every=BA,E.find=qA,E.findIndex=Gv,E.findKey=t9,E.findLast=zA,E.findLastIndex=Yv,E.findLastKey=r9,E.floor=$T,E.forEach=ty,E.forEachRight=ry,E.forIn=n9,E.forInRight=i9,E.forOwn=s9,E.forOwnRight=o9,E.get=Dd,E.gt=SP,E.gte=OP,E.has=l9,E.hasIn=Sd,E.head=Jv,E.identity=kr,E.includes=GA,E.indexOf=z$,E.inRange=C9,E.invoke=f9,E.isArguments=ms,E.isArray=Le,E.isArrayBuffer=CP,E.isArrayLike=Fr,E.isArrayLikeObject=Kt,E.isBoolean=$P,E.isBuffer=Ai,E.isDate=AP,E.isElement=PP,E.isEmpty=TP,E.isEqual=RP,E.isEqualWith=NP,E.isError=xd,E.isFinite=LP,E.isFunction=ei,E.isInteger=uy,E.isLength=Pl,E.isMap=hy,E.isMatch=MP,E.isMatchWith=UP,E.isNaN=jP,E.isNative=FP,E.isNil=kP,E.isNull=BP,E.isNumber=fy,E.isObject=Nt,E.isObjectLike=qt,E.isPlainObject=Da,E.isRegExp=Id,E.isSafeInteger=qP,E.isSet=dy,E.isString=Tl,E.isSymbol=Jr,E.isTypedArray=po,E.isUndefined=zP,E.isWeakMap=HP,E.isWeakSet=WP,E.join=G$,E.kebabCase=N9,E.last=hn,E.lastIndexOf=Y$,E.lowerCase=L9,E.lowerFirst=M9,E.lt=KP,E.lte=VP,E.max=AT,E.maxBy=PT,E.mean=TT,E.meanBy=RT,E.min=NT,E.minBy=LT,E.stubArray=Td,E.stubFalse=Rd,E.stubObject=bT,E.stubString=_T,E.stubTrue=ET,E.multiply=MT,E.nth=Z$,E.noConflict=fT,E.noop=Pd,E.now=Cl,E.pad=U9,E.padEnd=j9,E.padStart=F9,E.parseInt=B9,E.random=$9,E.reduce=XA,E.reduceRight=eP,E.repeat=k9,E.replace=q9,E.result=w9,E.round=UT,E.runInContext=q,E.sample=rP,E.size=sP,E.snakeCase=z9,E.some=oP,E.sortedIndex=nA,E.sortedIndexBy=iA,E.sortedIndexOf=sA,E.sortedLastIndex=oA,E.sortedLastIndexBy=aA,E.sortedLastIndexOf=cA,E.startCase=W9,E.startsWith=K9,E.subtract=jT,E.sum=FT,E.sumBy=BT,E.template=V9,E.times=xT,E.toFinite=ti,E.toInteger=qe,E.toLength=gy,E.toLower=G9,E.toNumber=fn,E.toSafeInteger=GP,E.toString=ft,E.toUpper=Y9,E.trim=Z9,E.trimEnd=J9,E.trimStart=Q9,E.truncate=X9,E.unescape=eT,E.uniqueId=DT,E.upperCase=tT,E.upperFirst=Od,E.each=ty,E.eachRight=ry,E.first=Jv,Ad(E,function(){var s={};return Tn(E,function(o,l){dt.call(E.prototype,l)||(s[l]=o)}),s}(),{chain:!1}),E.VERSION=n,on(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){E[s].placeholder=E}),on(["drop","take"],function(s,o){tt.prototype[s]=function(l){l=l===t?1:nr(qe(l),0);var p=this.__filtered__&&!o?new tt(this):this.clone();return p.__filtered__?p.__takeCount__=gr(l,p.__takeCount__):p.__views__.push({size:gr(l,ie),type:s+(p.__dir__<0?"Right":"")}),p},tt.prototype[s+"Right"]=function(l){return this.reverse()[s](l).reverse()}}),on(["filter","map","takeWhile"],function(s,o){var l=o+1,p=l==I||l==X;tt.prototype[s]=function(v){var D=this.clone();return D.__iteratees__.push({iteratee:_e(v,3),type:l}),D.__filtered__=D.__filtered__||p,D}}),on(["head","last"],function(s,o){var l="take"+(o?"Right":"");tt.prototype[s]=function(){return this[l](1).value()[0]}}),on(["initial","tail"],function(s,o){var l="drop"+(o?"":"Right");tt.prototype[s]=function(){return this.__filtered__?new tt(this):this[l](1)}}),tt.prototype.compact=function(){return this.filter(kr)},tt.prototype.find=function(s){return this.filter(s).head()},tt.prototype.findLast=function(s){return this.reverse().find(s)},tt.prototype.invokeMap=Ge(function(s,o){return typeof s=="function"?new tt(this):this.map(function(l){return wa(l,s,o)})}),tt.prototype.reject=function(s){return this.filter(Al(_e(s)))},tt.prototype.slice=function(s,o){s=qe(s);var l=this;return l.__filtered__&&(s>0||o<0)?new tt(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=qe(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},tt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},tt.prototype.toArray=function(){return this.take(ie)},Tn(tt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),p=/^(?:head|last)$/.test(o),v=E[p?"take"+(o=="last"?"Right":""):o],D=p||/^find/.test(o);v&&(E.prototype[o]=function(){var R=this.__wrapped__,M=p?[1]:arguments,z=R instanceof tt,te=M[0],re=z||Le(R),oe=function(Qe){var st=v.apply(E,xi([Qe],M));return p&&fe?st[0]:st};re&&l&&typeof te=="function"&&te.length!=1&&(z=re=!1);var fe=this.__chain__,ye=!!this.__actions__.length,Ie=D&&!fe,We=z&&!ye;if(!D&&re){R=We?R:new tt(this);var De=s.apply(R,M);return De.__actions__.push({func:Sl,args:[oe],thisArg:t}),new cn(De,fe)}return Ie&&We?s.apply(this,M):(De=this.thru(oe),Ie?p?De.value()[0]:De.value():De)})}),on(["pop","push","shift","sort","splice","unshift"],function(s){var o=Qc[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",p=/^(?:pop|shift)$/.test(s);E.prototype[s]=function(){var v=arguments;if(p&&!this.__chain__){var D=this.value();return o.apply(Le(D)?D:[],v)}return this[l](function(R){return o.apply(Le(R)?R:[],v)})}}),Tn(tt.prototype,function(s,o){var l=E[o];if(l){var p=l.name+"";dt.call(co,p)||(co[p]=[]),co[p].push({name:o,func:l})}}),co[wl(t,U).name]=[{name:"wrapper",func:t}],tt.prototype.clone=e7,tt.prototype.reverse=t7,tt.prototype.value=r7,E.prototype.at=PA,E.prototype.chain=TA,E.prototype.commit=RA,E.prototype.next=NA,E.prototype.plant=MA,E.prototype.reverse=UA,E.prototype.toJSON=E.prototype.valueOf=E.prototype.value=jA,E.prototype.first=E.prototype.head,fa&&(E.prototype[fa]=LA),E},so=RC();Wt?((Wt.exports=so)._=so,wt._=so):it._=so}).call(Bo)})(Gu,Gu.exports);var ex=Object.defineProperty,tx=Object.defineProperties,rx=Object.getOwnPropertyDescriptors,W1=Object.getOwnPropertySymbols,nx=Object.prototype.hasOwnProperty,ix=Object.prototype.propertyIsEnumerable,K1=(r,e,t)=>e in r?ex(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Qa=(r,e)=>{for(var t in e||(e={}))nx.call(e,t)&&K1(r,t,e[t]);if(W1)for(var t of W1(e))ix.call(e,t)&&K1(r,t,e[t]);return r},sx=(r,e)=>tx(r,rx(e));function ai(r,e,t){var n;const i=Z2(r);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${X8}?chainId=${i.namespace}:${i.reference}&projectId=${t}`}function zi(r){return r.includes(":")?r.split(":")[1]:r}function V1(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function ox(r,e){const t=Object.keys(e.namespaces).filter(i=>i.includes(r));if(!t.length)return[];const n=[];return t.forEach(i=>{const a=e.namespaces[i].accounts;n.push(...a)}),n}function G1(r={},e={}){const t=Y1(r),n=Y1(e);return Gu.exports.merge(t,n)}function Y1(r){var e,t,n,i;const a={};if(!Oo(r))return a;for(const[c,u]of Object.entries(r)){const f=hu(c)?[c]:u.chains,h=u.methods||[],m=u.events||[],w=u.rpcMap||{},y=So(c);a[y]=sx(Qa(Qa({},a[y]),u),{chains:lu(f,(e=a[y])==null?void 0:e.chains),methods:lu(h,(t=a[y])==null?void 0:t.methods),events:lu(m,(n=a[y])==null?void 0:n.events),rpcMap:Qa(Qa({},w),(i=a[y])==null?void 0:i.rpcMap)})}return a}function ax(r){return r.includes(":")?r.split(":")[2]:r}function cx(r){const e={};for(const[t,n]of Object.entries(r)){const i=n.methods||[],a=n.events||[],c=n.accounts||[],u=hu(t)?[t]:n.chains?n.chains:V1(n.accounts);e[t]={chains:u,methods:i,events:a,accounts:c}}return e}function Yu(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const Z1={},St=r=>Z1[r],Zu=(r,e)=>{Z1[r]=e};class lx{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=St("events"),this.client=St("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(kn.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 n;const i=zi(t);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[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 n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||ai(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new jn(new oi(n,St("disableProviderPing")))}}class ux{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=St("events"),this.client=St("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(kn.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 n=t||ai(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new jn(new oi(n,St("disableProviderPing")))}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const i=parseInt(zi(t));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[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,n;let i=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const a=parseInt(i,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:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[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 hx{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=St("events"),this.client=St("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(kn.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 n;const i=zi(t);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[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 n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||ai(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new jn(new oi(n,St("disableProviderPing")))}}class fx{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=St("events"),this.client=St("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(kn.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 n;const i=zi(t);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[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 n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||ai(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new jn(new oi(n,St("disableProviderPing")))}}class dx{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=St("events"),this.client=St("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(kn.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 n=this.getCardanoRPCUrl(t),i=zi(t);e[i]=this.createHttpProvider(i,n)}),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 n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new jn(new oi(n,St("disableProviderPing")))}}class px{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=St("events"),this.client=St("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(kn.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 n;const i=zi(t);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[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 n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||ai(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new jn(new oi(n,St("disableProviderPing")))}}class gx{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=St("events"),this.client=St("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(kn.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 n;const i=zi(t);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[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 n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||ai(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new jn(new oi(n,St("disableProviderPing")))}}class mx{constructor(e){this.name="near",this.namespace=e.namespace,this.events=St("events"),this.client=St("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 n=t||ai(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(kn.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 n;e[t]=this.createHttpProvider(t,(n=this.namespace.rpcMap)==null?void 0:n[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 n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||ai(e,this.namespace);return typeof n>"u"?void 0:new jn(new oi(n,St("disableProviderPing")))}}var vx=Object.defineProperty,yx=Object.defineProperties,wx=Object.getOwnPropertyDescriptors,J1=Object.getOwnPropertySymbols,bx=Object.prototype.hasOwnProperty,_x=Object.prototype.propertyIsEnumerable,Q1=(r,e,t)=>e in r?vx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Xa=(r,e)=>{for(var t in e||(e={}))bx.call(e,t)&&Q1(r,t,e[t]);if(J1)for(var t of J1(e))_x.call(e,t)&&Q1(r,t,e[t]);return r},Ju=(r,e)=>yx(r,wx(e));class Qu{constructor(e){this.events=new lr.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:Xe.pino(Xe.getDefaultLoggerOptions({level:e?.logger||z1})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const t=new Qu(e);return await t.initialize(),t}async request(e,t,n){const[i,a]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:Xa({},e),chainId:`${i}:${a}`,topic:this.session.topic,expiry:n})}sendAsync(e,t,n,i){const a=new Date().getTime();this.request(e,n,i).then(c=>t(null,Ka(a,c))).catch(c=>t(c,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:xt("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:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(a=>{this.session=a;const c=cx(a.namespaces);this.namespaces=G1(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==U1)throw a;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[n,i]=this.validateChain(e);this.getProvider(n).setDefaultChain(i,t)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(En(t)){for(const n of t)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.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 Ku.init({logger:this.providerOpts.logger||z1,relayUrl:this.providerOpts.relayUrl||Z8,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=>So(t)))];Zu("client",this.client),Zu("events",this.events),Zu("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const n=ox(t,this.session),i=V1(n),a=G1(this.namespaces,this.optionalNamespaces),c=Ju(Xa({},a[t]),{accounts:n,chains:i});switch(t){case"eip155":this.rpcProviders[t]=new ux({namespace:c});break;case"solana":this.rpcProviders[t]=new hx({namespace:c});break;case"cosmos":this.rpcProviders[t]=new fx({namespace:c});break;case"polkadot":this.rpcProviders[t]=new lx({namespace:c});break;case"cip34":this.rpcProviders[t]=new dx({namespace:c});break;case"elrond":this.rpcProviders[t]=new px({namespace:c});break;case"multiversx":this.rpcProviders[t]=new gx({namespace:c});break;case"near":this.rpcProviders[t]=new mx({namespace:c});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:n}=t;if(n.name==="accountsChanged"){const i=n.data;i&&En(i)&&this.events.emit("accountsChanged",i.map(ax))}else if(n.name==="chainChanged"){const i=t.chainId,a=t.event.data,c=So(i),u=Yu(i)!==Yu(a)?`${c}:${Yu(a)}`:i;this.onChainChanged(u)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var n;const{namespaces:i}=t,a=(n=this.client)==null?void 0:n.session.get(e);this.session=Ju(Xa({},a),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",Ju(Xa({},xt("USER_DISCONNECTED")),{data:e.topic}))}),this.on(kn.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:n,sessionProperties:i}=e;t&&Object.keys(t).length&&(this.namespaces=t),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",t),this.persist("optionalNamespaces",n)}validateChain(e){const[t,n]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,n];if(t&&!Object.keys(this.namespaces||{}).map(c=>So(c)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&n)return[t,n];const i=So(Object.keys(this.namespaces)[0]),a=this.rpcProviders[i].getDefaultChain();return[i,a]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(t||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${H1}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${H1}/${e}`)}}const Ex=Qu,xx="wc",Ix="ethereum_provider",Dx=`${xx}@2:${Ix}:`,Sx="https://rpc.walletconnect.com/v1/",ec=["eth_sendTransaction","personal_sign"],X1=["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"],tc=["chainChanged","accountsChanged"],eg=["chainChanged","accountsChanged","message","disconnect","connect"];var Ox=Object.defineProperty,Cx=Object.defineProperties,$x=Object.getOwnPropertyDescriptors,tg=Object.getOwnPropertySymbols,Ax=Object.prototype.hasOwnProperty,Px=Object.prototype.propertyIsEnumerable,rg=(r,e,t)=>e in r?Ox(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ko=(r,e)=>{for(var t in e||(e={}))Ax.call(e,t)&&rg(r,t,e[t]);if(tg)for(var t of tg(e))Px.call(e,t)&&rg(r,t,e[t]);return r},ng=(r,e)=>Cx(r,$x(e));function rc(r){return Number(r[0].split(":")[1])}function Xu(r){return`0x${r.toString(16)}`}function Tx(r){const{chains:e,optionalChains:t,methods:n,optionalMethods:i,events:a,optionalEvents:c,rpcMap:u}=r;if(!En(e))throw new Error("Invalid chains");const f={chains:e,methods:n||ec,events:a||tc,rpcMap:ko({},e.length?{[rc(e)]:u[rc(e)]}:{})},h=a?.filter(_=>!tc.includes(_)),m=n?.filter(_=>!ec.includes(_));if(!t&&!c&&!i&&!(h!=null&&h.length)&&!(m!=null&&m.length))return{required:e.length?f:void 0};const w=h?.length&&m?.length||!t,y={chains:[...new Set(w?f.chains.concat(t||[]):t)],methods:[...new Set(f.methods.concat(i!=null&&i.length?i:X1))],events:[...new Set(f.events.concat(c!=null&&c.length?c:eg))],rpcMap:u};return{required:e.length?f:void 0,optional:t.length?y:void 0}}class nc{constructor(){this.events=new lr.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=Dx,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 nc;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,n){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),n)}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:n}=Tx(this.rpc);try{const i=await new Promise(async(c,u)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),u(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(ng(ko({namespaces:ko({},t&&{[this.namespace]:t})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e?.pairingTopic})).then(h=>{c(h)}).catch(h=>{u(new Error(h.message))})});if(!i)return;const a=J2(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Xu(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}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:n}=t;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",Xu(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",ng(ko({},xt("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,n;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(n=this.modal)==null||n.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(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",Xu(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,n,i]=e.split(":");return{chainId:`${t}:${n}`,address:i}}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,n;const i=(t=e?.chains)!=null?t:[],a=(n=e?.optionalChains)!=null?n:[],c=i.concat(a);if(!c.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const u=i.length?e?.methods||ec:[],f=i.length?e?.events||tc:[],h=e?.optionalMethods||[],m=e?.optionalEvents||[],w=e?.rpcMap||this.buildRpcMap(c,e.projectId),y=e?.qrModalOptions||void 0;return{chains:i?.map(_=>this.formatChainId(_)),optionalChains:a.map(_=>this.formatChainId(_)),methods:u,events:f,optionalMethods:h,optionalEvents:m,rpcMap:w,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:y,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const n={};return e.forEach(i=>{n[i]=this.getRpcUrl(i,t)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?rc(this.rpc.chains):rc(this.rpc.optionalChains),this.signer=await Ex.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{const{WalletConnectModal:n}=await Promise.resolve().then(function(){return tI});t=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(ko({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:n,rpcMap:i}=e;t&&En(t)&&(this.rpc.chains=t.map(a=>this.formatChainId(a)),t.forEach(a=>{this.rpc.rpcMap[a]=i?.[a]||this.getRpcUrl(a)})),n&&En(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n?.map(a=>this.formatChainId(a)),n.forEach(a=>{this.rpc.rpcMap[a]=i?.[a]||this.getRpcUrl(a)}))}getRpcUrl(e,t){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${Sx}?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 Rx=nc,Nx=Symbol(),ig=Object.getPrototypeOf,eh=new WeakMap,Lx=r=>r&&(eh.has(r)?eh.get(r):ig(r)===Object.prototype||ig(r)===Array.prototype),Mx=r=>Lx(r)&&r[Nx]||null,sg=(r,e=!0)=>{eh.set(r,e)},th=r=>typeof r=="object"&&r!==null,ci=new WeakMap,ic=new WeakSet,Ux=(r=Object.is,e=(h,m)=>new Proxy(h,m),t=h=>th(h)&&!ic.has(h)&&(Array.isArray(h)||!(Symbol.iterator in h))&&!(h instanceof WeakMap)&&!(h instanceof WeakSet)&&!(h instanceof Error)&&!(h instanceof Number)&&!(h instanceof Date)&&!(h instanceof String)&&!(h instanceof RegExp)&&!(h instanceof ArrayBuffer),n=h=>{switch(h.status){case"fulfilled":return h.value;case"rejected":throw h.reason;default:throw h}},i=new WeakMap,a=(h,m,w=n)=>{const y=i.get(h);if(y?.[0]===m)return y[1];const _=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h));return sg(_,!0),i.set(h,[m,_]),Reflect.ownKeys(h).forEach(S=>{if(Object.getOwnPropertyDescriptor(_,S))return;const P=Reflect.get(h,S),j={value:P,enumerable:!0,configurable:!0};if(ic.has(P))sg(P,!1);else if(P instanceof Promise)delete j.value,j.get=()=>w(P);else if(ci.has(P)){const[U,A]=ci.get(P);j.value=a(U,A(),w)}Object.defineProperty(_,S,j)}),Object.preventExtensions(_)},c=new WeakMap,u=[1,1],f=h=>{if(!th(h))throw new Error("object required");const m=c.get(h);if(m)return m;let w=u[0];const y=new Set,_=(H,F=++u[0])=>{w!==F&&(w=F,y.forEach(V=>V(H,F)))};let S=u[1];const P=(H=++u[1])=>(S!==H&&!y.size&&(S=H,U.forEach(([F])=>{const V=F[1](H);V>w&&(w=V)})),w),j=H=>(F,V)=>{const se=[...F];se[1]=[H,...se[1]],_(se,V)},U=new Map,A=(H,F)=>{if(U.has(H))throw new Error("prop listener already exists");if(y.size){const V=F[3](j(H));U.set(H,[F,V])}else U.set(H,[F])},T=H=>{var F;const V=U.get(H);V&&(U.delete(H),(F=V[1])==null||F.call(V))},O=H=>(y.add(H),y.size===1&&U.forEach(([V,se],ce)=>{if(se)throw new Error("remove already exists");const I=V[3](j(ce));U.set(ce,[V,I])}),()=>{y.delete(H),y.size===0&&U.forEach(([V,se],ce)=>{se&&(se(),U.set(ce,[V]))})}),$=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h)),d=e($,{deleteProperty(H,F){const V=Reflect.get(H,F);T(F);const se=Reflect.deleteProperty(H,F);return se&&_(["delete",[F],V]),se},set(H,F,V,se){const ce=Reflect.has(H,F),I=Reflect.get(H,F,se);if(ce&&(r(I,V)||c.has(V)&&r(I,c.get(V))))return!0;T(F),th(V)&&(V=Mx(V)||V);let N=V;if(V instanceof Promise)V.then(X=>{V.status="fulfilled",V.value=X,_(["resolve",[F],X])}).catch(X=>{V.status="rejected",V.reason=X,_(["reject",[F],X])});else{!ci.has(V)&&t(V)&&(N=f(V));const X=!ic.has(N)&&ci.get(N);X&&A(F,X)}return Reflect.set(H,F,N,se),_(["set",[F],V,I]),!0}});c.set(h,d);const b=[$,P,a,O];return ci.set(d,b),Reflect.ownKeys(h).forEach(H=>{const F=Object.getOwnPropertyDescriptor(h,H);"value"in F&&(d[H]=h[H],delete F.value,delete F.writable),Object.defineProperty($,H,F)}),d})=>[f,ci,ic,r,e,t,n,i,a,c,u],[jx]=Ux();function li(r={}){return jx(r)}function Hi(r,e,t){const n=ci.get(r);n||console.warn("Please use proxy object");let i;const a=[],c=n[3];let u=!1;const h=c(m=>{if(a.push(m),t){e(a.splice(0));return}i||(i=Promise.resolve().then(()=>{i=void 0,u&&e(a.splice(0))}))});return u=!0,()=>{u=!1,h()}}function Fx(r,e){const t=ci.get(r);t||console.warn("Please use proxy object");const[n,i,a]=t;return a(n,i(),e)}const or=li({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),Tt={state:or,subscribe(r){return Hi(or,()=>r(or))},push(r,e){r!==or.view&&(or.view=r,e&&(or.data=e),or.history.push(r))},reset(r){or.view=r,or.history=[r]},replace(r){or.history.length>1&&(or.history[or.history.length-1]=r,or.view=r)},goBack(){if(or.history.length>1){or.history.pop();const[r]=or.history.slice(-1);or.view=r}},setData(r){or.data=r}},we={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return we.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const r=navigator.userAgent.toLowerCase();return we.isMobile()&&(r.includes("iphone")||r.includes("ipad"))},isHttpUrl(r){return r.startsWith("http://")||r.startsWith("https://")},isArray(r){return Array.isArray(r)&&r.length>0},formatNativeUrl(r,e,t){if(we.isHttpUrl(r))return this.formatUniversalUrl(r,e,t);let n=r;n.includes("://")||(n=r.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,t);const i=encodeURIComponent(e);return`${n}wc?uri=${i}`},formatUniversalUrl(r,e,t){if(!we.isHttpUrl(r))return this.formatNativeUrl(r,e,t);let n=r;n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,t);const i=encodeURIComponent(e);return`${n}wc?uri=${i}`},async wait(r){return new Promise(e=>{setTimeout(e,r)})},openHref(r,e){window.open(r,e,"noreferrer noopener")},setWalletConnectDeepLink(r,e){try{localStorage.setItem(we.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:r,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(r){try{const[e]=r.split("?");localStorage.setItem(we.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(we.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(we.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var r;const e=(r=Tt.state.data)==null?void 0:r.Wallet;if(!e)throw new Error('Missing "Wallet" view data');return e}},Bx=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),pr=li({enabled:Bx,userSessionId:"",events:[],connectedWalletId:void 0}),og={state:pr,subscribe(r){return Hi(pr.events,()=>r(Fx(pr.events[pr.events.length-1])))},initialize(){pr.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(pr.userSessionId=crypto.randomUUID())},setConnectedWalletId(r){pr.connectedWalletId=r},click(r){if(pr.enabled){const e={type:"CLICK",name:r.name,userSessionId:pr.userSessionId,timestamp:Date.now(),data:r};pr.events.push(e)}},track(r){if(pr.enabled){const e={type:"TRACK",name:r.name,userSessionId:pr.userSessionId,timestamp:Date.now(),data:r};pr.events.push(e)}},view(r){if(pr.enabled){const e={type:"VIEW",name:r.name,userSessionId:pr.userSessionId,timestamp:Date.now(),data:r};pr.events.push(e)}}},Dn=li({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),zt={state:Dn,subscribe(r){return Hi(Dn,()=>r(Dn))},setChains(r){Dn.chains=r},setWalletConnectUri(r){Dn.walletConnectUri=r},setIsCustomDesktop(r){Dn.isCustomDesktop=r},setIsCustomMobile(r){Dn.isCustomMobile=r},setIsDataLoaded(r){Dn.isDataLoaded=r},setIsUiLoaded(r){Dn.isUiLoaded=r},setIsAuth(r){Dn.isAuth=r}},sc=li({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),Kr={state:sc,subscribe(r){return Hi(sc,()=>r(sc))},setConfig(r){var e,t;og.initialize(),zt.setChains(r.chains),zt.setIsAuth(!!r.enableAuthMode),zt.setIsCustomMobile(!!((e=r.mobileWallets)!=null&&e.length)),zt.setIsCustomDesktop(!!((t=r.desktopWallets)!=null&&t.length)),we.setModalVersionInStorage(),Object.assign(sc,r)}};var kx=Object.defineProperty,ag=Object.getOwnPropertySymbols,qx=Object.prototype.hasOwnProperty,zx=Object.prototype.propertyIsEnumerable,cg=(r,e,t)=>e in r?kx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Hx=(r,e)=>{for(var t in e||(e={}))qx.call(e,t)&&cg(r,t,e[t]);if(ag)for(var t of ag(e))zx.call(e,t)&&cg(r,t,e[t]);return r};const rh="https://explorer-api.walletconnect.com",nh="wcm",ih="js-2.6.2";async function oc(r,e){const t=Hx({sdkType:nh,sdkVersion:ih},e),n=new URL(r,rh);return n.searchParams.append("projectId",Kr.state.projectId),Object.entries(t).forEach(([i,a])=>{a&&n.searchParams.append(i,String(a))}),(await fetch(n)).json()}const Wi={async getDesktopListings(r){return oc("/w3m/v1/getDesktopListings",r)},async getMobileListings(r){return oc("/w3m/v1/getMobileListings",r)},async getInjectedListings(r){return oc("/w3m/v1/getInjectedListings",r)},async getAllListings(r){return oc("/w3m/v1/getAllListings",r)},getWalletImageUrl(r){return`${rh}/w3m/v1/getWalletImage/${r}?projectId=${Kr.state.projectId}&sdkType=${nh}&sdkVersion=${ih}`},getAssetImageUrl(r){return`${rh}/w3m/v1/getAssetImage/${r}?projectId=${Kr.state.projectId}&sdkType=${nh}&sdkVersion=${ih}`}};var Wx=Object.defineProperty,lg=Object.getOwnPropertySymbols,Kx=Object.prototype.hasOwnProperty,Vx=Object.prototype.propertyIsEnumerable,ug=(r,e,t)=>e in r?Wx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gx=(r,e)=>{for(var t in e||(e={}))Kx.call(e,t)&&ug(r,t,e[t]);if(lg)for(var t of lg(e))Vx.call(e,t)&&ug(r,t,e[t]);return r};const hg=we.isMobile(),Sn=li({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Nr={state:Sn,async getRecomendedWallets(){const{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:e}=Kr.state;if(r==="NONE"||e==="ALL"&&!r)return Sn.recomendedWallets;if(we.isArray(r)){const t={recommendedIds:r.join(",")},{listings:n}=await Wi.getAllListings(t),i=Object.values(n);i.sort((a,c)=>{const u=r.indexOf(a.id),f=r.indexOf(c.id);return u-f}),Sn.recomendedWallets=i}else{const{chains:t,isAuth:n}=zt.state,i=t?.join(","),a=we.isArray(e),c={page:1,sdks:n?"auth_v1":void 0,entries:we.RECOMMENDED_WALLET_AMOUNT,chains:i,version:2,excludedIds:a?e.join(","):void 0},{listings:u}=hg?await Wi.getMobileListings(c):await Wi.getDesktopListings(c);Sn.recomendedWallets=Object.values(u)}return Sn.recomendedWallets},async getWallets(r){const e=Gx({},r),{explorerRecommendedWalletIds:t,explorerExcludedWalletIds:n}=Kr.state,{recomendedWallets:i}=Sn;if(n==="ALL")return Sn.wallets;i.length?e.excludedIds=i.map(w=>w.id).join(","):we.isArray(t)&&(e.excludedIds=t.join(",")),we.isArray(n)&&(e.excludedIds=[e.excludedIds,n].filter(Boolean).join(",")),zt.state.isAuth&&(e.sdks="auth_v1");const{page:a,search:c}=r,{listings:u,total:f}=hg?await Wi.getMobileListings(e):await Wi.getDesktopListings(e),h=Object.values(u),m=c?"search":"wallets";return Sn[m]={listings:[...Sn[m].listings,...h],total:f,page:a??1},{listings:h,total:f}},getWalletImageUrl(r){return Wi.getWalletImageUrl(r)},getAssetImageUrl(r){return Wi.getAssetImageUrl(r)},resetSearch(){Sn.search={listings:[],total:0,page:1}}},Ts=li({open:!1}),Ki={state:Ts,subscribe(r){return Hi(Ts,()=>r(Ts))},async open(r){return new Promise(e=>{const{isUiLoaded:t,isDataLoaded:n}=zt.state;if(we.removeWalletConnectDeepLink(),zt.setWalletConnectUri(r?.uri),zt.setChains(r?.chains),Tt.reset("ConnectWallet"),t&&n)Ts.open=!0,e();else{const i=setInterval(()=>{const a=zt.state;a.isUiLoaded&&a.isDataLoaded&&(clearInterval(i),Ts.open=!0,e())},200)}})},close(){Ts.open=!1}};var Yx=Object.defineProperty,fg=Object.getOwnPropertySymbols,Zx=Object.prototype.hasOwnProperty,Jx=Object.prototype.propertyIsEnumerable,dg=(r,e,t)=>e in r?Yx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Qx=(r,e)=>{for(var t in e||(e={}))Zx.call(e,t)&&dg(r,t,e[t]);if(fg)for(var t of fg(e))Jx.call(e,t)&&dg(r,t,e[t]);return r};function Xx(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const qo=li({themeMode:Xx()?"dark":"light"}),ui={state:qo,subscribe(r){return Hi(qo,()=>r(qo))},setThemeConfig(r){const{themeMode:e,themeVariables:t}=r;e&&(qo.themeMode=e),t&&(qo.themeVariables=Qx({},t))}},Vi=li({open:!1,message:"",variant:"success"}),hi={state:Vi,subscribe(r){return Hi(Vi,()=>r(Vi))},openToast(r,e){Vi.open=!0,Vi.message=r,Vi.variant=e},closeToast(){Vi.open=!1}};class eI{constructor(e){this.openModal=Ki.open,this.closeModal=Ki.close,this.subscribeModal=Ki.subscribe,this.setTheme=ui.setThemeConfig,ui.setThemeConfig(e),Kr.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(function(){return lC});const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),zt.setIsUiLoaded(!0)}}}var tI=Object.freeze({__proto__:null,WalletConnectModal:eI});/**
94
+ `)+ge+`return __p
95
+ }`;var pt=r3(function(){return $t(B,Le+"return "+ge).apply(r,G)});if(pt.source=ge,Np(pt))throw pt;return pt}function zU(o){return Bt(o).toLowerCase()}function HU(o){return Bt(o).toUpperCase()}function KU(o,a,u){if(o=Bt(o),o&&(u||a===r))return h2(o);if(!o||!(a=An(a)))return o;var w=ii(o),S=ii(a),B=f2(w,S),G=d2(w,S)+1;return Ls(w,B,G).join("")}function WU(o,a,u){if(o=Bt(o),o&&(u||a===r))return o.slice(0,g2(o)+1);if(!o||!(a=An(a)))return o;var w=ii(o),S=d2(w,ii(a))+1;return Ls(w,0,S).join("")}function VU(o,a,u){if(o=Bt(o),o&&(u||a===r))return o.replace(Qe,"");if(!o||!(a=An(a)))return o;var w=ii(o),S=f2(w,ii(a));return Ls(w,S).join("")}function GU(o,a){var u=J,w=te;if(sr(a)){var S="separator"in a?a.separator:S;u="length"in a?ft(a.length):u,w="omission"in a?An(a.omission):w}o=Bt(o);var B=o.length;if(Oa(o)){var G=ii(o);B=G.length}if(u>=B)return o;var Q=u-Pa(w);if(Q<1)return w;var re=G?Ls(G,0,Q).join(""):o.slice(0,Q);if(S===r)return re+w;if(G&&(Q+=re.length-Q),Rp(S)){if(o.slice(Q).search(S)){var le,he=re;for(S.global||(S=Qd(S.source,Bt(vt.exec(S))+"g")),S.lastIndex=0;le=S.exec(he);)var ge=le.index;re=re.slice(0,ge===r?Q:ge)}}else if(o.indexOf(An(S),Q)!=Q){var ye=re.lastIndexOf(S);ye>-1&&(re=re.slice(0,ye))}return re+w}function YU(o){return o=Bt(o),o&&Ye.test(o)?o.replace(Ot,x$):o}var JU=Ba(function(o,a,u){return o+(u?" ":"")+a.toUpperCase()}),Up=nb("toUpperCase");function t3(o,a,u){return o=Bt(o),a=u?r:a,a===r?w$(o)?D$(o):u$(o):o.match(a)||[]}var r3=gt(function(o,a){try{return Sr(o,r,a)}catch(u){return Np(u)?u:new it(u)}}),QU=Zi(function(o,a){return zn(a,function(u){u=$i(u),Ji(o,u,Tp(o[u],o))}),o});function ZU(o){var a=o==null?0:o.length,u=qe();return o=a?tr(o,function(w){if(typeof w[1]!="function")throw new Hn(c);return[u(w[0]),w[1]]}):[],gt(function(w){for(var S=-1;++S<a;){var B=o[S];if(Sr(B[0],this,w))return Sr(B[1],this,w)}})}function XU(o){return xN(Wn(o,_))}function Fp(o){return function(){return o}}function eF(o,a){return o==null||o!==o?a:o}var tF=sb(),rF=sb(!0);function hn(o){return o}function jp(o){return R2(typeof o=="function"?o:Wn(o,_))}function nF(o){return B2(Wn(o,_))}function iF(o,a){return U2(o,Wn(a,_))}var sF=gt(function(o,a){return function(u){return el(u,o,a)}}),oF=gt(function(o,a){return function(u){return el(o,u,a)}});function kp(o,a,u){var w=Ir(a),S=ph(a,w);u==null&&!(sr(a)&&(S.length||!w.length))&&(u=a,a=o,o=this,S=ph(a,Ir(a)));var B=!(sr(u)&&"chain"in u)||!!u.chain,G=es(o);return zn(S,function(Q){var re=a[Q];o[Q]=re,G&&(o.prototype[Q]=function(){var le=this.__chain__;if(B||le){var he=o(this.__wrapped__),ge=he.__actions__=cn(this.__actions__);return ge.push({func:re,args:arguments,thisArg:o}),he.__chain__=le,he}return re.apply(o,Ps([this.value()],arguments))})}),o}function aF(){return It._===this&&(It._=$$),this}function qp(){}function cF(o){return o=ft(o),gt(function(a){return F2(a,o)})}var lF=wp(tr),uF=wp(o2),hF=wp(Hd);function n3(o){return Ip(o)?Kd($i(o)):kN(o)}function fF(o){return function(a){return o==null?r:To(o,a)}}var dF=ab(),pF=ab(!0);function zp(){return[]}function Hp(){return!1}function gF(){return{}}function mF(){return""}function vF(){return!0}function yF(o,a){if(o=ft(o),o<1||o>N)return[];var u=v,w=Br(o,v);a=qe(a),o-=v;for(var S=Gd(w,a);++u<o;)a(u);return S}function wF(o){return at(o)?tr(o,$i):xn(o)?[o]:cn(Ab(Bt(o)))}function bF(o){var a=++M$;return Bt(o)+a}var _F=bh(function(o,a){return o+a},0),EF=bp("ceil"),AF=bh(function(o,a){return o/a},1),xF=bp("floor");function SF(o){return o&&o.length?dh(o,hn,sp):r}function IF(o,a){return o&&o.length?dh(o,qe(a,2),sp):r}function DF(o){return l2(o,hn)}function CF(o,a){return l2(o,qe(a,2))}function OF(o){return o&&o.length?dh(o,hn,lp):r}function PF(o,a){return o&&o.length?dh(o,qe(a,2),lp):r}var MF=bh(function(o,a){return o*a},1),TF=bp("round"),$F=bh(function(o,a){return o-a},0);function NF(o){return o&&o.length?Vd(o,hn):0}function RF(o,a){return o&&o.length?Vd(o,qe(a,2)):0}return T.after=nB,T.ary=Nb,T.assign=HB,T.assignIn=Gb,T.assignInWith=$h,T.assignWith=KB,T.at=WB,T.before=Rb,T.bind=Tp,T.bindAll=QU,T.bindKey=Lb,T.castArray=gB,T.chain=Mb,T.chunk=xR,T.compact=SR,T.concat=IR,T.cond=ZU,T.conforms=XU,T.constant=Fp,T.countBy=NL,T.create=VB,T.curry=Bb,T.curryRight=Ub,T.debounce=Fb,T.defaults=GB,T.defaultsDeep=YB,T.defer=iB,T.delay=sB,T.difference=DR,T.differenceBy=CR,T.differenceWith=OR,T.drop=PR,T.dropRight=MR,T.dropRightWhile=TR,T.dropWhile=$R,T.fill=NR,T.filter=LL,T.flatMap=FL,T.flatMapDeep=jL,T.flatMapDepth=kL,T.flatten=Db,T.flattenDeep=RR,T.flattenDepth=LR,T.flip=oB,T.flow=tF,T.flowRight=rF,T.fromPairs=BR,T.functions=rU,T.functionsIn=nU,T.groupBy=qL,T.initial=FR,T.intersection=jR,T.intersectionBy=kR,T.intersectionWith=qR,T.invert=sU,T.invertBy=oU,T.invokeMap=HL,T.iteratee=jp,T.keyBy=KL,T.keys=Ir,T.keysIn=un,T.map=Dh,T.mapKeys=cU,T.mapValues=lU,T.matches=nF,T.matchesProperty=iF,T.memoize=Oh,T.merge=uU,T.mergeWith=Yb,T.method=sF,T.methodOf=oF,T.mixin=kp,T.negate=Ph,T.nthArg=cF,T.omit=hU,T.omitBy=fU,T.once=aB,T.orderBy=WL,T.over=lF,T.overArgs=cB,T.overEvery=uF,T.overSome=hF,T.partial=$p,T.partialRight=jb,T.partition=VL,T.pick=dU,T.pickBy=Jb,T.property=n3,T.propertyOf=fF,T.pull=WR,T.pullAll=Ob,T.pullAllBy=VR,T.pullAllWith=GR,T.pullAt=YR,T.range=dF,T.rangeRight=pF,T.rearg=lB,T.reject=JL,T.remove=JR,T.rest=uB,T.reverse=Pp,T.sampleSize=ZL,T.set=gU,T.setWith=mU,T.shuffle=XL,T.slice=QR,T.sortBy=rB,T.sortedUniq=iL,T.sortedUniqBy=sL,T.split=FU,T.spread=hB,T.tail=oL,T.take=aL,T.takeRight=cL,T.takeRightWhile=lL,T.takeWhile=uL,T.tap=SL,T.throttle=fB,T.thru=Ih,T.toArray=Kb,T.toPairs=Qb,T.toPairsIn=Zb,T.toPath=wF,T.toPlainObject=Vb,T.transform=vU,T.unary=dB,T.union=hL,T.unionBy=fL,T.unionWith=dL,T.uniq=pL,T.uniqBy=gL,T.uniqWith=mL,T.unset=yU,T.unzip=Mp,T.unzipWith=Pb,T.update=wU,T.updateWith=bU,T.values=ja,T.valuesIn=_U,T.without=vL,T.words=t3,T.wrap=pB,T.xor=yL,T.xorBy=wL,T.xorWith=bL,T.zip=_L,T.zipObject=EL,T.zipObjectDeep=AL,T.zipWith=xL,T.entries=Qb,T.entriesIn=Zb,T.extend=Gb,T.extendWith=$h,kp(T,T),T.add=_F,T.attempt=r3,T.camelCase=SU,T.capitalize=Xb,T.ceil=EF,T.clamp=EU,T.clone=mB,T.cloneDeep=yB,T.cloneDeepWith=wB,T.cloneWith=vB,T.conformsTo=bB,T.deburr=e3,T.defaultTo=eF,T.divide=AF,T.endsWith=IU,T.eq=oi,T.escape=DU,T.escapeRegExp=CU,T.every=RL,T.find=BL,T.findIndex=Sb,T.findKey=JB,T.findLast=UL,T.findLastIndex=Ib,T.findLastKey=QB,T.floor=xF,T.forEach=Tb,T.forEachRight=$b,T.forIn=ZB,T.forInRight=XB,T.forOwn=eU,T.forOwnRight=tU,T.get=Lp,T.gt=_B,T.gte=EB,T.has=iU,T.hasIn=Bp,T.head=Cb,T.identity=hn,T.includes=zL,T.indexOf=UR,T.inRange=AU,T.invoke=aU,T.isArguments=Ro,T.isArray=at,T.isArrayBuffer=AB,T.isArrayLike=ln,T.isArrayLikeObject=dr,T.isBoolean=xB,T.isBuffer=Bs,T.isDate=SB,T.isElement=IB,T.isEmpty=DB,T.isEqual=CB,T.isEqualWith=OB,T.isError=Np,T.isFinite=PB,T.isFunction=es,T.isInteger=kb,T.isLength=Mh,T.isMap=qb,T.isMatch=MB,T.isMatchWith=TB,T.isNaN=$B,T.isNative=NB,T.isNil=LB,T.isNull=RB,T.isNumber=zb,T.isObject=sr,T.isObjectLike=cr,T.isPlainObject=ol,T.isRegExp=Rp,T.isSafeInteger=BB,T.isSet=Hb,T.isString=Th,T.isSymbol=xn,T.isTypedArray=Fa,T.isUndefined=UB,T.isWeakMap=FB,T.isWeakSet=jB,T.join=zR,T.kebabCase=OU,T.last=Gn,T.lastIndexOf=HR,T.lowerCase=PU,T.lowerFirst=MU,T.lt=kB,T.lte=qB,T.max=SF,T.maxBy=IF,T.mean=DF,T.meanBy=CF,T.min=OF,T.minBy=PF,T.stubArray=zp,T.stubFalse=Hp,T.stubObject=gF,T.stubString=mF,T.stubTrue=vF,T.multiply=MF,T.nth=KR,T.noConflict=aF,T.noop=qp,T.now=Ch,T.pad=TU,T.padEnd=$U,T.padStart=NU,T.parseInt=RU,T.random=xU,T.reduce=GL,T.reduceRight=YL,T.repeat=LU,T.replace=BU,T.result=pU,T.round=TF,T.runInContext=ee,T.sample=QL,T.size=eB,T.snakeCase=UU,T.some=tB,T.sortedIndex=ZR,T.sortedIndexBy=XR,T.sortedIndexOf=eL,T.sortedLastIndex=tL,T.sortedLastIndexBy=rL,T.sortedLastIndexOf=nL,T.startCase=jU,T.startsWith=kU,T.subtract=$F,T.sum=NF,T.sumBy=RF,T.template=qU,T.times=yF,T.toFinite=ts,T.toInteger=ft,T.toLength=Wb,T.toLower=zU,T.toNumber=Yn,T.toSafeInteger=zB,T.toString=Bt,T.toUpper=HU,T.trim=KU,T.trimEnd=WU,T.trimStart=VU,T.truncate=GU,T.unescape=YU,T.uniqueId=bF,T.upperCase=JU,T.upperFirst=Up,T.each=Tb,T.eachRight=$b,T.first=Cb,kp(T,function(){var o={};return Mi(T,function(a,u){qt.call(T.prototype,u)||(o[u]=a)}),o}(),{chain:!1}),T.VERSION=n,zn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){T[o].placeholder=T}),zn(["drop","take"],function(o,a){At.prototype[o]=function(u){u=u===r?1:wr(ft(u),0);var w=this.__filtered__&&!a?new At(this):this.clone();return w.__filtered__?w.__takeCount__=Br(u,w.__takeCount__):w.__views__.push({size:Br(u,v),type:o+(w.__dir__<0?"Right":"")}),w},At.prototype[o+"Right"]=function(u){return this.reverse()[o](u).reverse()}}),zn(["filter","map","takeWhile"],function(o,a){var u=a+1,w=u==d||u==D;At.prototype[o]=function(S){var B=this.clone();return B.__iteratees__.push({iteratee:qe(S,3),type:u}),B.__filtered__=B.__filtered__||w,B}}),zn(["head","last"],function(o,a){var u="take"+(a?"Right":"");At.prototype[o]=function(){return this[u](1).value()[0]}}),zn(["initial","tail"],function(o,a){var u="drop"+(a?"":"Right");At.prototype[o]=function(){return this.__filtered__?new At(this):this[u](1)}}),At.prototype.compact=function(){return this.filter(hn)},At.prototype.find=function(o){return this.filter(o).head()},At.prototype.findLast=function(o){return this.reverse().find(o)},At.prototype.invokeMap=gt(function(o,a){return typeof o=="function"?new At(this):this.map(function(u){return el(u,o,a)})}),At.prototype.reject=function(o){return this.filter(Ph(qe(o)))},At.prototype.slice=function(o,a){o=ft(o);var u=this;return u.__filtered__&&(o>0||a<0)?new At(u):(o<0?u=u.takeRight(-o):o&&(u=u.drop(o)),a!==r&&(a=ft(a),u=a<0?u.dropRight(-a):u.take(a-o)),u)},At.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},At.prototype.toArray=function(){return this.take(v)},Mi(At.prototype,function(o,a){var u=/^(?:filter|find|map|reject)|While$/.test(a),w=/^(?:head|last)$/.test(a),S=T[w?"take"+(a=="last"?"Right":""):a],B=w||/^find/.test(a);S&&(T.prototype[a]=function(){var G=this.__wrapped__,Q=w?[1]:arguments,re=G instanceof At,le=Q[0],he=re||at(G),ge=function(yt){var Dt=S.apply(T,Ps([yt],Q));return w&&ye?Dt[0]:Dt};he&&u&&typeof le=="function"&&le.length!=1&&(re=he=!1);var ye=this.__chain__,Le=!!this.__actions__.length,Ke=B&&!ye,pt=re&&!Le;if(!B&&he){G=pt?G:new At(this);var We=o.apply(G,Q);return We.__actions__.push({func:Ih,args:[ge],thisArg:r}),new Kn(We,ye)}return Ke&&pt?o.apply(this,Q):(We=this.thru(ge),Ke?w?We.value()[0]:We.value():We)})}),zn(["pop","push","shift","sort","splice","unshift"],function(o){var a=Zu[o],u=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",w=/^(?:pop|shift)$/.test(o);T.prototype[o]=function(){var S=arguments;if(w&&!this.__chain__){var B=this.value();return a.apply(at(B)?B:[],S)}return this[u](function(G){return a.apply(at(G)?G:[],S)})}}),Mi(At.prototype,function(o,a){var u=T[a];if(u){var w=u.name+"";qt.call(Na,w)||(Na[w]=[]),Na[w].push({name:a,func:u})}}),Na[wh(r,Y).name]=[{name:"wrapper",func:r}],At.prototype.clone=Y$,At.prototype.reverse=J$,At.prototype.value=Q$,T.prototype.at=IL,T.prototype.chain=DL,T.prototype.commit=CL,T.prototype.next=OL,T.prototype.plant=ML,T.prototype.reverse=TL,T.prototype.toJSON=T.prototype.valueOf=T.prototype.value=$L,T.prototype.first=T.prototype.head,Vc&&(T.prototype[Vc]=PL),T},Ma=C$();fr?((fr.exports=Ma)._=Ma,Gt._=Ma):It._=Ma}).call(Ec)})(b0,b0.exports);var JD=Object.defineProperty,QD=Object.defineProperties,ZD=Object.getOwnPropertyDescriptors,Ay=Object.getOwnPropertySymbols,XD=Object.prototype.hasOwnProperty,eC=Object.prototype.propertyIsEnumerable,xy=(t,e,r)=>e in t?JD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xl=(t,e)=>{for(var r in e||(e={}))XD.call(e,r)&&xy(t,r,e[r]);if(Ay)for(var r of Ay(e))eC.call(e,r)&&xy(t,r,e[r]);return t},tC=(t,e)=>QD(t,ZD(e));function ds(t,e,r){var n;const i=yl(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${YD}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function to(t){return t.includes(":")?t.split(":")[1]:t}function Sy(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function rC(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function _0(t={},e={}){const r=Iy(t),n=Iy(e);return b0.exports.merge(r,n)}function Iy(t){var e,r,n,i;const s={};if(!cc(t))return s;for(const[c,l]of Object.entries(t)){const f=Lf(c)?[c]:l.chains,h=l.methods||[],m=l.events||[],_=l.rpcMap||{},E=ac(c);s[E]=tC(Xl(Xl({},s[E]),l),{chains:wl(f,(e=s[E])==null?void 0:e.chains),methods:wl(h,(r=s[E])==null?void 0:r.methods),events:wl(m,(n=s[E])==null?void 0:n.events),rpcMap:Xl(Xl({},_),(i=s[E])==null?void 0:i.rpcMap)})}return s}function nC(t){return t.includes(":")?t.split(":")[2]:t}function Dy(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],c=n.accounts||[],l=Lf(r)?[r]:n.chains?n.chains:Sy(n.accounts);e[r]={chains:l,methods:i,events:s,accounts:c}}return e}function E0(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const Cy={},er=t=>Cy[t],A0=(t,e)=>{Cy[t]=e};class iC{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(zi.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=to(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ki(new fs(n,er("disableProviderPing")))}}class sC{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(zi.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,r){const n=r||ds(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ki(new fs(n,er("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(to(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. 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 oC{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(zi.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(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=to(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ki(new fs(n,er("disableProviderPing")))}}class aC{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(zi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=to(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ki(new fs(n,er("disableProviderPing")))}}class cC{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(zi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=to(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ki(new fs(n,er("disableProviderPing")))}}class lC{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(zi.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(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=to(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ki(new fs(n,er("disableProviderPing")))}}class uC{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(zi.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(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=to(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new ki(new fs(n,er("disableProviderPing")))}}class hC{constructor(e){this.name="near",this.namespace=e.namespace,this.events=er("events"),this.client=er("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,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||ds(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(zi.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||ds(e,this.namespace);return typeof n>"u"?void 0:new ki(new fs(n,er("disableProviderPing")))}}var fC=Object.defineProperty,dC=Object.defineProperties,pC=Object.getOwnPropertyDescriptors,Oy=Object.getOwnPropertySymbols,gC=Object.prototype.hasOwnProperty,mC=Object.prototype.propertyIsEnumerable,Py=(t,e,r)=>e in t?fC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,eu=(t,e)=>{for(var r in e||(e={}))gC.call(e,r)&&Py(t,r,e[r]);if(Oy)for(var r of Oy(e))mC.call(e,r)&&Py(t,r,e[r]);return t},x0=(t,e)=>dC(t,pC(e));class S0{constructor(e){this.events=new Dr.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:Xs.pino(Xs.getDefaultLoggerOptions({level:e?.logger||_y})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const r=new S0(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:eu({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(c=>r(null,Vl(s,c))).catch(c=>r(c,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:Ut("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)}async authenticate(e){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:r,response:n}=await this.client.authenticate(e);r&&(this.uri=r,this.events.emit("display_uri",r));const i=await n();if(this.session=i.session,this.session){const s=Dy(this.session.namespaces);this.namespaces=_0(this.namespaces,s),this.persist("namespaces",this.namespaces),this.onConnect()}return i}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const c=Dy(s.namespaces);this.namespaces=_0(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==gy)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e);this.getProvider(n).setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(wi(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.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 y0.init({logger:this.providerOpts.logger||_y,relayUrl:this.providerOpts.relayUrl||WD,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(r=>ac(r)))];A0("client",this.client),A0("events",this.events),A0("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=rC(r,this.session),i=Sy(n),s=_0(this.namespaces,this.optionalNamespaces),c=x0(eu({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new sC({namespace:c});break;case"solana":this.rpcProviders[r]=new oC({namespace:c});break;case"cosmos":this.rpcProviders[r]=new aC({namespace:c});break;case"polkadot":this.rpcProviders[r]=new iC({namespace:c});break;case"cip34":this.rpcProviders[r]=new cC({namespace:c});break;case"elrond":this.rpcProviders[r]=new lC({namespace:c});break;case"multiversx":this.rpcProviders[r]=new uC({namespace:c});break;case"near":this.rpcProviders[r]=new hC({namespace:c});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:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&wi(i)&&this.events.emit("accountsChanged",i.map(nC))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,c=ac(i),l=E0(i)!==E0(s)?`${c}:${E0(s)}`:i;this.onChainChanged(l)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=x0(eu({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",x0(eu({},Ut("USER_DISCONNECTED")),{data:e.topic}))}),this.on(zi.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 r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(c=>ac(c)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=ac(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${Ey}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${Ey}/${e}`)}}const vC=S0,yC="wc",wC="ethereum_provider",bC=`${yC}@2:${wC}:`,_C="https://rpc.walletconnect.com/v1/",tu=["eth_sendTransaction","personal_sign"],My=["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"],ru=["chainChanged","accountsChanged"],Ty=["chainChanged","accountsChanged","message","disconnect","connect"];var EC=Object.defineProperty,AC=Object.defineProperties,xC=Object.getOwnPropertyDescriptors,$y=Object.getOwnPropertySymbols,SC=Object.prototype.hasOwnProperty,IC=Object.prototype.propertyIsEnumerable,Ny=(t,e,r)=>e in t?EC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,oa=(t,e)=>{for(var r in e||(e={}))SC.call(e,r)&&Ny(t,r,e[r]);if($y)for(var r of $y(e))IC.call(e,r)&&Ny(t,r,e[r]);return t},I0=(t,e)=>AC(t,xC(e));function nu(t){return Number(t[0].split(":")[1])}function iu(t){return`0x${t.toString(16)}`}function DC(t){const{chains:e,optionalChains:r,methods:n,optionalMethods:i,events:s,optionalEvents:c,rpcMap:l}=t;if(!wi(e))throw new Error("Invalid chains");const f={chains:e,methods:n||tu,events:s||ru,rpcMap:oa({},e.length?{[nu(e)]:l[nu(e)]}:{})},h=s?.filter(A=>!ru.includes(A)),m=n?.filter(A=>!tu.includes(A));if(!r&&!c&&!i&&!(h!=null&&h.length)&&!(m!=null&&m.length))return{required:e.length?f:void 0};const _=h?.length&&m?.length||!r,E={chains:[...new Set(_?f.chains.concat(r||[]):r)],methods:[...new Set(f.methods.concat(i!=null&&i.length?i:My))],events:[...new Set(f.events.concat(c!=null&&c.length?c:Ty))],rpcMap:l};return{required:e.length?f:void 0,optional:r.length?E:void 0}}class su{constructor(){this.events=new Dr.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=bC,this.on=(e,r)=>(this.events.on(e,r),this),this.once=(e,r)=>(this.events.once(e,r),this),this.removeListener=(e,r)=>(this.events.removeListener(e,r),this),this.off=(e,r)=>(this.events.off(e,r),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const r=new su;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,n){this.signer.sendAsync(e,r,this.formatChainId(this.chainId),n)}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:r,optional:n}=DC(this.rpc);try{const i=await new Promise(async(c,l)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),l(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(I0(oa({namespaces:oa({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e?.pairingTopic})).then(h=>{c(h)}).catch(h=>{l(new Error(h.message))})});if(!i)return;const s=eg(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:iu(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async authenticate(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e?.chains});try{const r=await new Promise(async(i,s)=>{var c;this.rpc.showQrModal&&((c=this.modal)==null||c.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),s(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(I0(oa({},e),{chains:this.rpc.chains})).then(l=>{i(l)}).catch(l=>{s(new Error(l.message))})}),n=r.session;if(n){const i=eg(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:i),this.setAccounts(i),this.events.emit("connect",{chainId:iu(this.chainId)})}return r}catch(r){throw this.signer.logger.error(r),r}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:r}=e,{event:n}=r;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",iu(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",I0(oa({},Ut("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.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 r=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",iu(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){const[r,n,i]=e.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,n;const i=(r=e?.chains)!=null?r:[],s=(n=e?.optionalChains)!=null?n:[],c=i.concat(s);if(!c.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const l=i.length?e?.methods||tu:[],f=i.length?e?.events||ru:[],h=e?.optionalMethods||[],m=e?.optionalEvents||[],_=e?.rpcMap||this.buildRpcMap(c,e.projectId),E=e?.qrModalOptions||void 0;return{chains:i?.map(A=>this.formatChainId(A)),optionalChains:s.map(A=>this.formatChainId(A)),methods:l,events:f,optionalMethods:h,optionalEvents:m,rpcMap:_,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:E,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){const n={};return e.forEach(i=>{n[i]=this.getRpcUrl(i,r)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?nu(this.rpc.chains):nu(this.rpc.optionalChains),this.signer=await vC.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 r;try{const{WalletConnectModal:n}=await Promise.resolve().then(function(){return JC});r=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(oa({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:r,optionalChains:n,rpcMap:i}=e;r&&wi(r)&&(this.rpc.chains=r.map(s=>this.formatChainId(s)),r.forEach(s=>{this.rpc.rpcMap[s]=i?.[s]||this.getRpcUrl(s)})),n&&wi(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n?.map(s=>this.formatChainId(s)),n.forEach(s=>{this.rpc.rpcMap[s]=i?.[s]||this.getRpcUrl(s)}))}getRpcUrl(e,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${_C}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r?.accounts),this.setAccounts(r?.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(r=>this.parseAccount(r))}}const CC=su,OC=Symbol(),Ry=Object.getPrototypeOf,D0=new WeakMap,PC=t=>t&&(D0.has(t)?D0.get(t):Ry(t)===Object.prototype||Ry(t)===Array.prototype),MC=t=>PC(t)&&t[OC]||null,Ly=(t,e=!0)=>{D0.set(t,e)},C0=t=>typeof t=="object"&&t!==null,ps=new WeakMap,ou=new WeakSet,TC=(t=Object.is,e=(h,m)=>new Proxy(h,m),r=h=>C0(h)&&!ou.has(h)&&(Array.isArray(h)||!(Symbol.iterator in h))&&!(h instanceof WeakMap)&&!(h instanceof WeakSet)&&!(h instanceof Error)&&!(h instanceof Number)&&!(h instanceof Date)&&!(h instanceof String)&&!(h instanceof RegExp)&&!(h instanceof ArrayBuffer),n=h=>{switch(h.status){case"fulfilled":return h.value;case"rejected":throw h.reason;default:throw h}},i=new WeakMap,s=(h,m,_=n)=>{const E=i.get(h);if(E?.[0]===m)return E[1];const A=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h));return Ly(A,!0),i.set(h,[m,A]),Reflect.ownKeys(h).forEach(I=>{if(Object.getOwnPropertyDescriptor(A,I))return;const R=Reflect.get(h,I),W={value:R,enumerable:!0,configurable:!0};if(ou.has(R))Ly(R,!1);else if(R instanceof Promise)delete W.value,W.get=()=>_(R);else if(ps.has(R)){const[Y,F]=ps.get(R);W.value=s(Y,F(),_)}Object.defineProperty(A,I,W)}),Object.preventExtensions(A)},c=new WeakMap,l=[1,1],f=h=>{if(!C0(h))throw new Error("object required");const m=c.get(h);if(m)return m;let _=l[0];const E=new Set,A=(Z,J=++l[0])=>{_!==J&&(_=J,E.forEach(te=>te(Z,J)))};let I=l[1];const R=(Z=++l[1])=>(I!==Z&&!E.size&&(I=Z,Y.forEach(([J])=>{const te=J[1](Z);te>_&&(_=te)})),_),W=Z=>(J,te)=>{const ae=[...J];ae[1]=[Z,...ae[1]],A(ae,te)},Y=new Map,F=(Z,J)=>{if(Y.has(Z))throw new Error("prop listener already exists");if(E.size){const te=J[3](W(Z));Y.set(Z,[J,te])}else Y.set(Z,[J])},z=Z=>{var J;const te=Y.get(Z);te&&(Y.delete(Z),(J=te[1])==null||J.call(te))},$=Z=>(E.add(Z),E.size===1&&Y.forEach(([te,ae],p)=>{if(ae)throw new Error("remove already exists");const d=te[3](W(p));Y.set(p,[te,d])}),()=>{E.delete(Z),E.size===0&&Y.forEach(([te,ae],p)=>{ae&&(ae(),Y.set(p,[te]))})}),j=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h)),g=e(j,{deleteProperty(Z,J){const te=Reflect.get(Z,J);z(J);const ae=Reflect.deleteProperty(Z,J);return ae&&A(["delete",[J],te]),ae},set(Z,J,te,ae){const p=Reflect.has(Z,J),d=Reflect.get(Z,J,ae);if(p&&(t(d,te)||c.has(te)&&t(d,c.get(te))))return!0;z(J),C0(te)&&(te=MC(te)||te);let b=te;if(te instanceof Promise)te.then(D=>{te.status="fulfilled",te.value=D,A(["resolve",[J],D])}).catch(D=>{te.status="rejected",te.reason=D,A(["reject",[J],D])});else{!ps.has(te)&&r(te)&&(b=f(te));const D=!ou.has(b)&&ps.get(b);D&&F(J,D)}return Reflect.set(Z,J,b,ae),A(["set",[J],te,d]),!0}});c.set(h,g);const C=[j,R,s,$];return ps.set(g,C),Reflect.ownKeys(h).forEach(Z=>{const J=Object.getOwnPropertyDescriptor(h,Z);"value"in J&&(g[Z]=h[Z],delete J.value,delete J.writable),Object.defineProperty(j,Z,J)}),g})=>[f,ps,ou,t,e,r,n,i,s,c,l],[$C]=TC();function gs(t={}){return $C(t)}function ro(t,e,r){const n=ps.get(t);n||console.warn("Please use proxy object");let i;const s=[],c=n[3];let l=!1;const h=c(m=>{if(s.push(m),r){e(s.splice(0));return}i||(i=Promise.resolve().then(()=>{i=void 0,l&&e(s.splice(0))}))});return l=!0,()=>{l=!1,h()}}function NC(t,e){const r=ps.get(t);r||console.warn("Please use proxy object");const[n,i,s]=r;return s(n,i(),e)}const Ar=gs({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),rr={state:Ar,subscribe(t){return ro(Ar,()=>t(Ar))},push(t,e){t!==Ar.view&&(Ar.view=t,e&&(Ar.data=e),Ar.history.push(t))},reset(t){Ar.view=t,Ar.history=[t]},replace(t){Ar.history.length>1&&(Ar.history[Ar.history.length-1]=t,Ar.view=t)},goBack(){if(Ar.history.length>1){Ar.history.pop();const[t]=Ar.history.slice(-1);Ar.view=t}},setData(t){Ar.data=t}},Ue={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return Ue.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const t=navigator.userAgent.toLowerCase();return Ue.isMobile()&&(t.includes("iphone")||t.includes("ipad"))},isHttpUrl(t){return t.startsWith("http://")||t.startsWith("https://")},isArray(t){return Array.isArray(t)&&t.length>0},formatNativeUrl(t,e,r){if(Ue.isHttpUrl(t))return this.formatUniversalUrl(t,e,r);let n=t;n.includes("://")||(n=t.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);const i=encodeURIComponent(e);return`${n}wc?uri=${i}`},formatUniversalUrl(t,e,r){if(!Ue.isHttpUrl(t))return this.formatNativeUrl(t,e,r);let n=t;n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);const i=encodeURIComponent(e);return`${n}wc?uri=${i}`},async wait(t){return new Promise(e=>{setTimeout(e,t)})},openHref(t,e){window.open(t,e,"noreferrer noopener")},setWalletConnectDeepLink(t,e){try{localStorage.setItem(Ue.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(t){try{const[e]=t.split("?");localStorage.setItem(Ue.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(Ue.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(Ue.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var t;const e=(t=rr.state.data)==null?void 0:t.Wallet;if(!e)throw new Error('Missing "Wallet" view data');return e}},RC=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),Lr=gs({enabled:RC,userSessionId:"",events:[],connectedWalletId:void 0}),By={state:Lr,subscribe(t){return ro(Lr.events,()=>t(NC(Lr.events[Lr.events.length-1])))},initialize(){Lr.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(Lr.userSessionId=crypto.randomUUID())},setConnectedWalletId(t){Lr.connectedWalletId=t},click(t){if(Lr.enabled){const e={type:"CLICK",name:t.name,userSessionId:Lr.userSessionId,timestamp:Date.now(),data:t};Lr.events.push(e)}},track(t){if(Lr.enabled){const e={type:"TRACK",name:t.name,userSessionId:Lr.userSessionId,timestamp:Date.now(),data:t};Lr.events.push(e)}},view(t){if(Lr.enabled){const e={type:"VIEW",name:t.name,userSessionId:Lr.userSessionId,timestamp:Date.now(),data:t};Lr.events.push(e)}}},Ei=gs({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),hr={state:Ei,subscribe(t){return ro(Ei,()=>t(Ei))},setChains(t){Ei.chains=t},setWalletConnectUri(t){Ei.walletConnectUri=t},setIsCustomDesktop(t){Ei.isCustomDesktop=t},setIsCustomMobile(t){Ei.isCustomMobile=t},setIsDataLoaded(t){Ei.isDataLoaded=t},setIsUiLoaded(t){Ei.isUiLoaded=t},setIsAuth(t){Ei.isAuth=t}},au=gs({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),wn={state:au,subscribe(t){return ro(au,()=>t(au))},setConfig(t){var e,r;By.initialize(),hr.setChains(t.chains),hr.setIsAuth(!!t.enableAuthMode),hr.setIsCustomMobile(!!((e=t.mobileWallets)!=null&&e.length)),hr.setIsCustomDesktop(!!((r=t.desktopWallets)!=null&&r.length)),Ue.setModalVersionInStorage(),Object.assign(au,t)}};var LC=Object.defineProperty,Uy=Object.getOwnPropertySymbols,BC=Object.prototype.hasOwnProperty,UC=Object.prototype.propertyIsEnumerable,Fy=(t,e,r)=>e in t?LC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,FC=(t,e)=>{for(var r in e||(e={}))BC.call(e,r)&&Fy(t,r,e[r]);if(Uy)for(var r of Uy(e))UC.call(e,r)&&Fy(t,r,e[r]);return t};const O0="https://explorer-api.walletconnect.com",P0="wcm",M0="js-2.6.2";async function cu(t,e){const r=FC({sdkType:P0,sdkVersion:M0},e),n=new URL(t,O0);return n.searchParams.append("projectId",wn.state.projectId),Object.entries(r).forEach(([i,s])=>{s&&n.searchParams.append(i,String(s))}),(await fetch(n)).json()}const no={async getDesktopListings(t){return cu("/w3m/v1/getDesktopListings",t)},async getMobileListings(t){return cu("/w3m/v1/getMobileListings",t)},async getInjectedListings(t){return cu("/w3m/v1/getInjectedListings",t)},async getAllListings(t){return cu("/w3m/v1/getAllListings",t)},getWalletImageUrl(t){return`${O0}/w3m/v1/getWalletImage/${t}?projectId=${wn.state.projectId}&sdkType=${P0}&sdkVersion=${M0}`},getAssetImageUrl(t){return`${O0}/w3m/v1/getAssetImage/${t}?projectId=${wn.state.projectId}&sdkType=${P0}&sdkVersion=${M0}`}};var jC=Object.defineProperty,jy=Object.getOwnPropertySymbols,kC=Object.prototype.hasOwnProperty,qC=Object.prototype.propertyIsEnumerable,ky=(t,e,r)=>e in t?jC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,zC=(t,e)=>{for(var r in e||(e={}))kC.call(e,r)&&ky(t,r,e[r]);if(jy)for(var r of jy(e))qC.call(e,r)&&ky(t,r,e[r]);return t};const qy=Ue.isMobile(),Ai=gs({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),sn={state:Ai,async getRecomendedWallets(){const{explorerRecommendedWalletIds:t,explorerExcludedWalletIds:e}=wn.state;if(t==="NONE"||e==="ALL"&&!t)return Ai.recomendedWallets;if(Ue.isArray(t)){const r={recommendedIds:t.join(",")},{listings:n}=await no.getAllListings(r),i=Object.values(n);i.sort((s,c)=>{const l=t.indexOf(s.id),f=t.indexOf(c.id);return l-f}),Ai.recomendedWallets=i}else{const{chains:r,isAuth:n}=hr.state,i=r?.join(","),s=Ue.isArray(e),c={page:1,sdks:n?"auth_v1":void 0,entries:Ue.RECOMMENDED_WALLET_AMOUNT,chains:i,version:2,excludedIds:s?e.join(","):void 0},{listings:l}=qy?await no.getMobileListings(c):await no.getDesktopListings(c);Ai.recomendedWallets=Object.values(l)}return Ai.recomendedWallets},async getWallets(t){const e=zC({},t),{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:n}=wn.state,{recomendedWallets:i}=Ai;if(n==="ALL")return Ai.wallets;i.length?e.excludedIds=i.map(_=>_.id).join(","):Ue.isArray(r)&&(e.excludedIds=r.join(",")),Ue.isArray(n)&&(e.excludedIds=[e.excludedIds,n].filter(Boolean).join(",")),hr.state.isAuth&&(e.sdks="auth_v1");const{page:s,search:c}=t,{listings:l,total:f}=qy?await no.getMobileListings(e):await no.getDesktopListings(e),h=Object.values(l),m=c?"search":"wallets";return Ai[m]={listings:[...Ai[m].listings,...h],total:f,page:s??1},{listings:h,total:f}},getWalletImageUrl(t){return no.getWalletImageUrl(t)},getAssetImageUrl(t){return no.getAssetImageUrl(t)},resetSearch(){Ai.search={listings:[],total:0,page:1}}},aa=gs({open:!1}),io={state:aa,subscribe(t){return ro(aa,()=>t(aa))},async open(t){return new Promise(e=>{const{isUiLoaded:r,isDataLoaded:n}=hr.state;if(Ue.removeWalletConnectDeepLink(),hr.setWalletConnectUri(t?.uri),hr.setChains(t?.chains),rr.reset("ConnectWallet"),r&&n)aa.open=!0,e();else{const i=setInterval(()=>{const s=hr.state;s.isUiLoaded&&s.isDataLoaded&&(clearInterval(i),aa.open=!0,e())},200)}})},close(){aa.open=!1}};var HC=Object.defineProperty,zy=Object.getOwnPropertySymbols,KC=Object.prototype.hasOwnProperty,WC=Object.prototype.propertyIsEnumerable,Hy=(t,e,r)=>e in t?HC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,VC=(t,e)=>{for(var r in e||(e={}))KC.call(e,r)&&Hy(t,r,e[r]);if(zy)for(var r of zy(e))WC.call(e,r)&&Hy(t,r,e[r]);return t};function GC(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const Ac=gs({themeMode:GC()?"dark":"light"}),ms={state:Ac,subscribe(t){return ro(Ac,()=>t(Ac))},setThemeConfig(t){const{themeMode:e,themeVariables:r}=t;e&&(Ac.themeMode=e),r&&(Ac.themeVariables=VC({},r))}},so=gs({open:!1,message:"",variant:"success"}),vs={state:so,subscribe(t){return ro(so,()=>t(so))},openToast(t,e){so.open=!0,so.message=t,so.variant=e},closeToast(){so.open=!1}};class YC{constructor(e){this.openModal=io.open,this.closeModal=io.close,this.subscribeModal=io.subscribe,this.setTheme=ms.setThemeConfig,ms.setThemeConfig(e),wn.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(function(){return i$});const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),hr.setIsUiLoaded(!0)}}}var JC=Object.freeze({__proto__:null,WalletConnectModal:YC});/**
86
96
  * @license
87
97
  * Copyright 2019 Google LLC
88
98
  * SPDX-License-Identifier: BSD-3-Clause
89
- */const ac=window,sh=ac.ShadowRoot&&(ac.ShadyCSS===void 0||ac.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,oh=Symbol(),pg=new WeakMap;class gg{constructor(e,t,n){if(this._$cssResult$=!0,n!==oh)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(sh&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=pg.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&pg.set(t,e))}return e}toString(){return this.cssText}}const rI=r=>new gg(typeof r=="string"?r:r+"",void 0,oh),lt=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((n,i,a)=>n+(c=>{if(c._$cssResult$===!0)return c.cssText;if(typeof c=="number")return c;throw Error("Value passed to 'css' function must be a 'css' function result: "+c+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[a+1],r[0]);return new gg(t,r,oh)},nI=(r,e)=>{sh?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{const n=document.createElement("style"),i=ac.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)})},mg=sh?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return rI(t)})(r):r;/**
99
+ */const lu=window,T0=lu.ShadowRoot&&(lu.ShadyCSS===void 0||lu.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$0=Symbol(),Ky=new WeakMap;class Wy{constructor(e,r,n){if(this._$cssResult$=!0,n!==$0)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=r}get styleSheet(){let e=this.o;const r=this.t;if(T0&&e===void 0){const n=r!==void 0&&r.length===1;n&&(e=Ky.get(r)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Ky.set(r,e))}return e}toString(){return this.cssText}}const QC=t=>new Wy(typeof t=="string"?t:t+"",void 0,$0),Tt=(t,...e)=>{const r=t.length===1?t[0]:e.reduce((n,i,s)=>n+(c=>{if(c._$cssResult$===!0)return c.cssText;if(typeof c=="number")return c;throw Error("Value passed to 'css' function must be a 'css' function result: "+c+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1],t[0]);return new Wy(r,t,$0)},ZC=(t,e)=>{T0?t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):e.forEach(r=>{const n=document.createElement("style"),i=lu.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=r.cssText,t.appendChild(n)})},Vy=T0?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let r="";for(const n of e.cssRules)r+=n.cssText;return QC(r)})(t):t;/**
90
100
  * @license
91
101
  * Copyright 2017 Google LLC
92
102
  * SPDX-License-Identifier: BSD-3-Clause
93
- */var ah;const cc=window,vg=cc.trustedTypes,iI=vg?vg.emptyScript:"",yg=cc.reactiveElementPolyfillSupport,ch={toAttribute(r,e){switch(e){case Boolean:r=r?iI:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},wg=(r,e)=>e!==r&&(e==e||r==r),lh={attribute:!0,type:String,converter:ch,reflect:!1,hasChanged:wg},uh="finalized";class Rs extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach((t,n)=>{const i=this._$Ep(n,t);i!==void 0&&(this._$Ev.set(i,n),e.push(i))}),e}static createProperty(e,t=lh){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n=typeof e=="symbol"?Symbol():"__"+e,i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(i){const a=this[e];this[t]=i,this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||lh}static finalize(){if(this.hasOwnProperty(uh))return!1;this[uh]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,n=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of n)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(mg(i))}else e!==void 0&&t.push(mg(e));return t}static _$Ep(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,n;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;const t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return nI(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var n;return(n=t.hostConnected)===null||n===void 0?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var n;return(n=t.hostDisconnected)===null||n===void 0?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=lh){var i;const a=this.constructor._$Ep(e,n);if(a!==void 0&&n.reflect===!0){const c=(((i=n.converter)===null||i===void 0?void 0:i.toAttribute)!==void 0?n.converter:ch).toAttribute(t,n.type);this._$El=e,c==null?this.removeAttribute(a):this.setAttribute(a,c),this._$El=null}}_$AK(e,t){var n;const i=this.constructor,a=i._$Ev.get(e);if(a!==void 0&&this._$El!==a){const c=i.getPropertyOptions(a),u=typeof c.converter=="function"?{fromAttribute:c.converter}:((n=c.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?c.converter:ch;this._$El=a,this[a]=u.fromAttribute(t,c.type),this._$El=null}}requestUpdate(e,t,n){let i=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||wg)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((i,a)=>this[a]=i),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var a;return(a=i.hostUpdate)===null||a===void 0?void 0:a.call(i)}),this.update(n)):this._$Ek()}catch(i){throw t=!1,this._$Ek(),i}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(n=>{var i;return(i=n.hostUpdated)===null||i===void 0?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,n)=>this._$EO(n,this[n],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}Rs[uh]=!0,Rs.elementProperties=new Map,Rs.elementStyles=[],Rs.shadowRootOptions={mode:"open"},yg?.({ReactiveElement:Rs}),((ah=cc.reactiveElementVersions)!==null&&ah!==void 0?ah:cc.reactiveElementVersions=[]).push("1.6.3");/**
103
+ */var N0;const uu=window,Gy=uu.trustedTypes,XC=Gy?Gy.emptyScript:"",Yy=uu.reactiveElementPolyfillSupport,R0={toAttribute(t,e){switch(e){case Boolean:t=t?XC:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=t!==null;break;case Number:r=t===null?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch{r=null}}return r}},Jy=(t,e)=>e!==t&&(e==e||t==t),L0={attribute:!0,type:String,converter:R0,reflect:!1,hasChanged:Jy},B0="finalized";class ca extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var r;this.finalize(),((r=this.h)!==null&&r!==void 0?r:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach((r,n)=>{const i=this._$Ep(n,r);i!==void 0&&(this._$Ev.set(i,n),e.push(i))}),e}static createProperty(e,r=L0){if(r.state&&(r.attribute=!1),this.finalize(),this.elementProperties.set(e,r),!r.noAccessor&&!this.prototype.hasOwnProperty(e)){const n=typeof e=="symbol"?Symbol():"__"+e,i=this.getPropertyDescriptor(e,n,r);i!==void 0&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,r,n){return{get(){return this[r]},set(i){const s=this[e];this[r]=i,this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||L0}static finalize(){if(this.hasOwnProperty(B0))return!1;this[B0]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const r=this.properties,n=[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)];for(const i of n)this.createProperty(i,r[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const r=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)r.unshift(Vy(i))}else e!==void 0&&r.push(Vy(e));return r}static _$Ep(e,r){const n=r.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(r=>r(this))}addController(e){var r,n;((r=this._$ES)!==null&&r!==void 0?r:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var r;(r=this._$ES)===null||r===void 0||r.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,r)=>{this.hasOwnProperty(r)&&(this._$Ei.set(r,this[r]),delete this[r])})}createRenderRoot(){var e;const r=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return ZC(r,this.constructor.elementStyles),r}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var n;return(n=r.hostConnected)===null||n===void 0?void 0:n.call(r)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(r=>{var n;return(n=r.hostDisconnected)===null||n===void 0?void 0:n.call(r)})}attributeChangedCallback(e,r,n){this._$AK(e,n)}_$EO(e,r,n=L0){var i;const s=this.constructor._$Ep(e,n);if(s!==void 0&&n.reflect===!0){const c=(((i=n.converter)===null||i===void 0?void 0:i.toAttribute)!==void 0?n.converter:R0).toAttribute(r,n.type);this._$El=e,c==null?this.removeAttribute(s):this.setAttribute(s,c),this._$El=null}}_$AK(e,r){var n;const i=this.constructor,s=i._$Ev.get(e);if(s!==void 0&&this._$El!==s){const c=i.getPropertyOptions(s),l=typeof c.converter=="function"?{fromAttribute:c.converter}:((n=c.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?c.converter:R0;this._$El=s,this[s]=l.fromAttribute(r,c.type),this._$El=null}}requestUpdate(e,r,n){let i=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Jy)(this[e],r)?(this._$AL.has(e)||this._$AL.set(e,r),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(r){Promise.reject(r)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((i,s)=>this[s]=i),this._$Ei=void 0);let r=!1;const n=this._$AL;try{r=this.shouldUpdate(n),r?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var s;return(s=i.hostUpdate)===null||s===void 0?void 0:s.call(i)}),this.update(n)):this._$Ek()}catch(i){throw r=!1,this._$Ek(),i}r&&this._$AE(n)}willUpdate(e){}_$AE(e){var r;(r=this._$ES)===null||r===void 0||r.forEach(n=>{var i;return(i=n.hostUpdated)===null||i===void 0?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((r,n)=>this._$EO(n,this[n],r)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}ca[B0]=!0,ca.elementProperties=new Map,ca.elementStyles=[],ca.shadowRootOptions={mode:"open"},Yy?.({ReactiveElement:ca}),((N0=uu.reactiveElementVersions)!==null&&N0!==void 0?N0:uu.reactiveElementVersions=[]).push("1.6.3");/**
94
104
  * @license
95
105
  * Copyright 2017 Google LLC
96
106
  * SPDX-License-Identifier: BSD-3-Clause
97
- */var hh;const lc=window,Ns=lc.trustedTypes,bg=Ns?Ns.createPolicy("lit-html",{createHTML:r=>r}):void 0,fh="$lit$",fi=`lit$${(Math.random()+"").slice(9)}$`,_g="?"+fi,sI=`<${_g}>`,Gi=document,zo=()=>Gi.createComment(""),Ho=r=>r===null||typeof r!="object"&&typeof r!="function",Eg=Array.isArray,oI=r=>Eg(r)||typeof r?.[Symbol.iterator]=="function",dh=`[
98
- \f\r]`,Wo=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,xg=/-->/g,Ig=/>/g,Yi=RegExp(`>|${dh}(?:([^\\s"'>=/]+)(${dh}*=${dh}*(?:[^
99
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Dg=/'/g,Sg=/"/g,Og=/^(?:script|style|textarea|title)$/i,Cg=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),he=Cg(1),Lt=Cg(2),Zi=Symbol.for("lit-noChange"),tr=Symbol.for("lit-nothing"),$g=new WeakMap,Ji=Gi.createTreeWalker(Gi,129,null,!1);function Ag(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return bg!==void 0?bg.createHTML(e):e}const aI=(r,e)=>{const t=r.length-1,n=[];let i,a=e===2?"<svg>":"",c=Wo;for(let u=0;u<t;u++){const f=r[u];let h,m,w=-1,y=0;for(;y<f.length&&(c.lastIndex=y,m=c.exec(f),m!==null);)y=c.lastIndex,c===Wo?m[1]==="!--"?c=xg:m[1]!==void 0?c=Ig:m[2]!==void 0?(Og.test(m[2])&&(i=RegExp("</"+m[2],"g")),c=Yi):m[3]!==void 0&&(c=Yi):c===Yi?m[0]===">"?(c=i??Wo,w=-1):m[1]===void 0?w=-2:(w=c.lastIndex-m[2].length,h=m[1],c=m[3]===void 0?Yi:m[3]==='"'?Sg:Dg):c===Sg||c===Dg?c=Yi:c===xg||c===Ig?c=Wo:(c=Yi,i=void 0);const _=c===Yi&&r[u+1].startsWith("/>")?" ":"";a+=c===Wo?f+sI:w>=0?(n.push(h),f.slice(0,w)+fh+f.slice(w)+fi+_):f+fi+(w===-2?(n.push(void 0),u):_)}return[Ag(r,a+(r[t]||"<?>")+(e===2?"</svg>":"")),n]};class Ko{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let a=0,c=0;const u=e.length-1,f=this.parts,[h,m]=aI(e,t);if(this.el=Ko.createElement(h,n),Ji.currentNode=this.el.content,t===2){const w=this.el.content,y=w.firstChild;y.remove(),w.append(...y.childNodes)}for(;(i=Ji.nextNode())!==null&&f.length<u;){if(i.nodeType===1){if(i.hasAttributes()){const w=[];for(const y of i.getAttributeNames())if(y.endsWith(fh)||y.startsWith(fi)){const _=m[c++];if(w.push(y),_!==void 0){const S=i.getAttribute(_.toLowerCase()+fh).split(fi),P=/([.?@])?(.*)/.exec(_);f.push({type:1,index:a,name:P[2],strings:S,ctor:P[1]==="."?lI:P[1]==="?"?hI:P[1]==="@"?fI:uc})}else f.push({type:6,index:a})}for(const y of w)i.removeAttribute(y)}if(Og.test(i.tagName)){const w=i.textContent.split(fi),y=w.length-1;if(y>0){i.textContent=Ns?Ns.emptyScript:"";for(let _=0;_<y;_++)i.append(w[_],zo()),Ji.nextNode(),f.push({type:2,index:++a});i.append(w[y],zo())}}}else if(i.nodeType===8)if(i.data===_g)f.push({type:2,index:a});else{let w=-1;for(;(w=i.data.indexOf(fi,w+1))!==-1;)f.push({type:7,index:a}),w+=fi.length-1}a++}}static createElement(e,t){const n=Gi.createElement("template");return n.innerHTML=e,n}}function Ls(r,e,t=r,n){var i,a,c,u;if(e===Zi)return e;let f=n!==void 0?(i=t._$Co)===null||i===void 0?void 0:i[n]:t._$Cl;const h=Ho(e)?void 0:e._$litDirective$;return f?.constructor!==h&&((a=f?._$AO)===null||a===void 0||a.call(f,!1),h===void 0?f=void 0:(f=new h(r),f._$AT(r,t,n)),n!==void 0?((c=(u=t)._$Co)!==null&&c!==void 0?c:u._$Co=[])[n]=f:t._$Cl=f),f!==void 0&&(e=Ls(r,f._$AS(r,e.values),f,n)),e}class cI{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;const{el:{content:n},parts:i}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:Gi).importNode(n,!0);Ji.currentNode=a;let c=Ji.nextNode(),u=0,f=0,h=i[0];for(;h!==void 0;){if(u===h.index){let m;h.type===2?m=new Vo(c,c.nextSibling,this,e):h.type===1?m=new h.ctor(c,h.name,h.strings,this,e):h.type===6&&(m=new dI(c,this,e)),this._$AV.push(m),h=i[++f]}u!==h?.index&&(c=Ji.nextNode(),u++)}return Ji.currentNode=Gi,a}v(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class Vo{constructor(e,t,n,i){var a;this.type=2,this._$AH=tr,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cp=(a=i?.isConnected)===null||a===void 0||a}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ls(this,e,t),Ho(e)?e===tr||e==null||e===""?(this._$AH!==tr&&this._$AR(),this._$AH=tr):e!==this._$AH&&e!==Zi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):oI(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==tr&&Ho(this._$AH)?this._$AA.nextSibling.data=e:this.$(Gi.createTextNode(e)),this._$AH=e}g(e){var t;const{values:n,_$litType$:i}=e,a=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Ko.createElement(Ag(i.h,i.h[0]),this.options)),i);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(n);else{const c=new cI(a,this),u=c.u(this.options);c.v(n),this.$(u),this._$AH=c}}_$AC(e){let t=$g.get(e.strings);return t===void 0&&$g.set(e.strings,t=new Ko(e)),t}T(e){Eg(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const a of e)i===t.length?t.push(n=new Vo(this.k(zo()),this.k(zo()),this,this.options)):n=t[i],n._$AI(a),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,t);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}}class uc{constructor(e,t,n,i,a){this.type=1,this._$AH=tr,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=a,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=tr}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,n,i){const a=this.strings;let c=!1;if(a===void 0)e=Ls(this,e,t,0),c=!Ho(e)||e!==this._$AH&&e!==Zi,c&&(this._$AH=e);else{const u=e;let f,h;for(e=a[0],f=0;f<a.length-1;f++)h=Ls(this,u[n+f],t,f),h===Zi&&(h=this._$AH[f]),c||(c=!Ho(h)||h!==this._$AH[f]),h===tr?e=tr:e!==tr&&(e+=(h??"")+a[f+1]),this._$AH[f]=h}c&&!i&&this.j(e)}j(e){e===tr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class lI extends uc{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===tr?void 0:e}}const uI=Ns?Ns.emptyScript:"";class hI extends uc{constructor(){super(...arguments),this.type=4}j(e){e&&e!==tr?this.element.setAttribute(this.name,uI):this.element.removeAttribute(this.name)}}class fI extends uc{constructor(e,t,n,i,a){super(e,t,n,i,a),this.type=5}_$AI(e,t=this){var n;if((e=(n=Ls(this,e,t,0))!==null&&n!==void 0?n:tr)===Zi)return;const i=this._$AH,a=e===tr&&i!==tr||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,c=e!==tr&&(i===tr||a);a&&this.element.removeEventListener(this.name,this,i),c&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,n;typeof this._$AH=="function"?this._$AH.call((n=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}}class dI{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Ls(this,e)}}const Pg=lc.litHtmlPolyfillSupport;Pg?.(Ko,Vo),((hh=lc.litHtmlVersions)!==null&&hh!==void 0?hh:lc.litHtmlVersions=[]).push("2.8.0");const pI=(r,e,t)=>{var n,i;const a=(n=t?.renderBefore)!==null&&n!==void 0?n:e;let c=a._$litPart$;if(c===void 0){const u=(i=t?.renderBefore)!==null&&i!==void 0?i:null;a._$litPart$=c=new Vo(e.insertBefore(zo(),u),u,void 0,t??{})}return c._$AI(r),c};/**
107
+ */var U0;const hu=window,la=hu.trustedTypes,Qy=la?la.createPolicy("lit-html",{createHTML:t=>t}):void 0,F0="$lit$",ys=`lit$${(Math.random()+"").slice(9)}$`,Zy="?"+ys,eO=`<${Zy}>`,oo=document,xc=()=>oo.createComment(""),Sc=t=>t===null||typeof t!="object"&&typeof t!="function",Xy=Array.isArray,tO=t=>Xy(t)||typeof t?.[Symbol.iterator]=="function",j0=`[
108
+ \f\r]`,Ic=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ew=/-->/g,tw=/>/g,ao=RegExp(`>|${j0}(?:([^\\s"'>=/]+)(${j0}*=${j0}*(?:[^
109
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),rw=/'/g,nw=/"/g,iw=/^(?:script|style|textarea|title)$/i,sw=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),ve=sw(1),ar=sw(2),co=Symbol.for("lit-noChange"),vr=Symbol.for("lit-nothing"),ow=new WeakMap,lo=oo.createTreeWalker(oo,129,null,!1);function aw(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Qy!==void 0?Qy.createHTML(e):e}const rO=(t,e)=>{const r=t.length-1,n=[];let i,s=e===2?"<svg>":"",c=Ic;for(let l=0;l<r;l++){const f=t[l];let h,m,_=-1,E=0;for(;E<f.length&&(c.lastIndex=E,m=c.exec(f),m!==null);)E=c.lastIndex,c===Ic?m[1]==="!--"?c=ew:m[1]!==void 0?c=tw:m[2]!==void 0?(iw.test(m[2])&&(i=RegExp("</"+m[2],"g")),c=ao):m[3]!==void 0&&(c=ao):c===ao?m[0]===">"?(c=i??Ic,_=-1):m[1]===void 0?_=-2:(_=c.lastIndex-m[2].length,h=m[1],c=m[3]===void 0?ao:m[3]==='"'?nw:rw):c===nw||c===rw?c=ao:c===ew||c===tw?c=Ic:(c=ao,i=void 0);const A=c===ao&&t[l+1].startsWith("/>")?" ":"";s+=c===Ic?f+eO:_>=0?(n.push(h),f.slice(0,_)+F0+f.slice(_)+ys+A):f+ys+(_===-2?(n.push(void 0),l):A)}return[aw(t,s+(t[r]||"<?>")+(e===2?"</svg>":"")),n]};class Dc{constructor({strings:e,_$litType$:r},n){let i;this.parts=[];let s=0,c=0;const l=e.length-1,f=this.parts,[h,m]=rO(e,r);if(this.el=Dc.createElement(h,n),lo.currentNode=this.el.content,r===2){const _=this.el.content,E=_.firstChild;E.remove(),_.append(...E.childNodes)}for(;(i=lo.nextNode())!==null&&f.length<l;){if(i.nodeType===1){if(i.hasAttributes()){const _=[];for(const E of i.getAttributeNames())if(E.endsWith(F0)||E.startsWith(ys)){const A=m[c++];if(_.push(E),A!==void 0){const I=i.getAttribute(A.toLowerCase()+F0).split(ys),R=/([.?@])?(.*)/.exec(A);f.push({type:1,index:s,name:R[2],strings:I,ctor:R[1]==="."?iO:R[1]==="?"?oO:R[1]==="@"?aO:fu})}else f.push({type:6,index:s})}for(const E of _)i.removeAttribute(E)}if(iw.test(i.tagName)){const _=i.textContent.split(ys),E=_.length-1;if(E>0){i.textContent=la?la.emptyScript:"";for(let A=0;A<E;A++)i.append(_[A],xc()),lo.nextNode(),f.push({type:2,index:++s});i.append(_[E],xc())}}}else if(i.nodeType===8)if(i.data===Zy)f.push({type:2,index:s});else{let _=-1;for(;(_=i.data.indexOf(ys,_+1))!==-1;)f.push({type:7,index:s}),_+=ys.length-1}s++}}static createElement(e,r){const n=oo.createElement("template");return n.innerHTML=e,n}}function ua(t,e,r=t,n){var i,s,c,l;if(e===co)return e;let f=n!==void 0?(i=r._$Co)===null||i===void 0?void 0:i[n]:r._$Cl;const h=Sc(e)?void 0:e._$litDirective$;return f?.constructor!==h&&((s=f?._$AO)===null||s===void 0||s.call(f,!1),h===void 0?f=void 0:(f=new h(t),f._$AT(t,r,n)),n!==void 0?((c=(l=r)._$Co)!==null&&c!==void 0?c:l._$Co=[])[n]=f:r._$Cl=f),f!==void 0&&(e=ua(t,f._$AS(t,e.values),f,n)),e}class nO{constructor(e,r){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var r;const{el:{content:n},parts:i}=this._$AD,s=((r=e?.creationScope)!==null&&r!==void 0?r:oo).importNode(n,!0);lo.currentNode=s;let c=lo.nextNode(),l=0,f=0,h=i[0];for(;h!==void 0;){if(l===h.index){let m;h.type===2?m=new Cc(c,c.nextSibling,this,e):h.type===1?m=new h.ctor(c,h.name,h.strings,this,e):h.type===6&&(m=new cO(c,this,e)),this._$AV.push(m),h=i[++f]}l!==h?.index&&(c=lo.nextNode(),l++)}return lo.currentNode=oo,s}v(e){let r=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,r),r+=n.strings.length-2):n._$AI(e[r])),r++}}class Cc{constructor(e,r,n,i){var s;this.type=2,this._$AH=vr,this._$AN=void 0,this._$AA=e,this._$AB=r,this._$AM=n,this.options=i,this._$Cp=(s=i?.isConnected)===null||s===void 0||s}get _$AU(){var e,r;return(r=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&r!==void 0?r:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const r=this._$AM;return r!==void 0&&e?.nodeType===11&&(e=r.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,r=this){e=ua(this,e,r),Sc(e)?e===vr||e==null||e===""?(this._$AH!==vr&&this._$AR(),this._$AH=vr):e!==this._$AH&&e!==co&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):tO(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==vr&&Sc(this._$AH)?this._$AA.nextSibling.data=e:this.$(oo.createTextNode(e)),this._$AH=e}g(e){var r;const{values:n,_$litType$:i}=e,s=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Dc.createElement(aw(i.h,i.h[0]),this.options)),i);if(((r=this._$AH)===null||r===void 0?void 0:r._$AD)===s)this._$AH.v(n);else{const c=new nO(s,this),l=c.u(this.options);c.v(n),this.$(l),this._$AH=c}}_$AC(e){let r=ow.get(e.strings);return r===void 0&&ow.set(e.strings,r=new Dc(e)),r}T(e){Xy(this._$AH)||(this._$AH=[],this._$AR());const r=this._$AH;let n,i=0;for(const s of e)i===r.length?r.push(n=new Cc(this.k(xc()),this.k(xc()),this,this.options)):n=r[i],n._$AI(s),i++;i<r.length&&(this._$AR(n&&n._$AB.nextSibling,i),r.length=i)}_$AR(e=this._$AA.nextSibling,r){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,r);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var r;this._$AM===void 0&&(this._$Cp=e,(r=this._$AP)===null||r===void 0||r.call(this,e))}}class fu{constructor(e,r,n,i,s){this.type=1,this._$AH=vr,this._$AN=void 0,this.element=e,this.name=r,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=vr}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,r=this,n,i){const s=this.strings;let c=!1;if(s===void 0)e=ua(this,e,r,0),c=!Sc(e)||e!==this._$AH&&e!==co,c&&(this._$AH=e);else{const l=e;let f,h;for(e=s[0],f=0;f<s.length-1;f++)h=ua(this,l[n+f],r,f),h===co&&(h=this._$AH[f]),c||(c=!Sc(h)||h!==this._$AH[f]),h===vr?e=vr:e!==vr&&(e+=(h??"")+s[f+1]),this._$AH[f]=h}c&&!i&&this.j(e)}j(e){e===vr?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class iO extends fu{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===vr?void 0:e}}const sO=la?la.emptyScript:"";class oO extends fu{constructor(){super(...arguments),this.type=4}j(e){e&&e!==vr?this.element.setAttribute(this.name,sO):this.element.removeAttribute(this.name)}}class aO extends fu{constructor(e,r,n,i,s){super(e,r,n,i,s),this.type=5}_$AI(e,r=this){var n;if((e=(n=ua(this,e,r,0))!==null&&n!==void 0?n:vr)===co)return;const i=this._$AH,s=e===vr&&i!==vr||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,c=e!==vr&&(i===vr||s);s&&this.element.removeEventListener(this.name,this,i),c&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var r,n;typeof this._$AH=="function"?this._$AH.call((n=(r=this.options)===null||r===void 0?void 0:r.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}}class cO{constructor(e,r,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=r,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){ua(this,e)}}const cw=hu.litHtmlPolyfillSupport;cw?.(Dc,Cc),((U0=hu.litHtmlVersions)!==null&&U0!==void 0?U0:hu.litHtmlVersions=[]).push("2.8.0");const lO=(t,e,r)=>{var n,i;const s=(n=r?.renderBefore)!==null&&n!==void 0?n:e;let c=s._$litPart$;if(c===void 0){const l=(i=r?.renderBefore)!==null&&i!==void 0?i:null;s._$litPart$=c=new Cc(e.insertBefore(xc(),l),l,void 0,r??{})}return c._$AI(t),c};/**
100
110
  * @license
101
111
  * Copyright 2017 Google LLC
102
112
  * SPDX-License-Identifier: BSD-3-Clause
103
- */var ph,gh;class Ye extends Rs{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const n=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=n.firstChild),n}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=pI(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return Zi}}Ye.finalized=!0,Ye._$litElement$=!0,(ph=globalThis.litElementHydrateSupport)===null||ph===void 0||ph.call(globalThis,{LitElement:Ye});const Tg=globalThis.litElementPolyfillSupport;Tg?.({LitElement:Ye}),((gh=globalThis.litElementVersions)!==null&&gh!==void 0?gh:globalThis.litElementVersions=[]).push("3.3.3");/**
113
+ */var k0,q0;class mt extends ca{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;const n=super.createRenderRoot();return(e=(r=this.renderOptions).renderBefore)!==null&&e!==void 0||(r.renderBefore=n.firstChild),n}update(e){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=lO(r,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return co}}mt.finalized=!0,mt._$litElement$=!0,(k0=globalThis.litElementHydrateSupport)===null||k0===void 0||k0.call(globalThis,{LitElement:mt});const lw=globalThis.litElementPolyfillSupport;lw?.({LitElement:mt}),((q0=globalThis.litElementVersions)!==null&&q0!==void 0?q0:globalThis.litElementVersions=[]).push("3.3.3");/**
104
114
  * @license
105
115
  * Copyright 2017 Google LLC
106
116
  * SPDX-License-Identifier: BSD-3-Clause
107
- */const ot=r=>e=>typeof e=="function"?((t,n)=>(customElements.define(t,n),n))(r,e):((t,n)=>{const{kind:i,elements:a}=n;return{kind:i,elements:a,finisher(c){customElements.define(t,c)}}})(r,e);/**
117
+ */const Ct=t=>e=>typeof e=="function"?((r,n)=>(customElements.define(r,n),n))(t,e):((r,n)=>{const{kind:i,elements:s}=n;return{kind:i,elements:s,finisher(c){customElements.define(r,c)}}})(t,e);/**
108
118
  * @license
109
119
  * Copyright 2017 Google LLC
110
120
  * SPDX-License-Identifier: BSD-3-Clause
111
- */const gI=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}},mI=(r,e,t)=>{e.constructor.createProperty(t,r)};function Be(r){return(e,t)=>t!==void 0?mI(r,e,t):gI(r,e)}/**
121
+ */const uO=(t,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(r){r.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(r){r.createProperty(e.key,t)}},hO=(t,e,r)=>{e.constructor.createProperty(r,t)};function ht(t){return(e,r)=>r!==void 0?hO(t,e,r):uO(t,e)}/**
112
122
  * @license
113
123
  * Copyright 2017 Google LLC
114
124
  * SPDX-License-Identifier: BSD-3-Clause
115
- */function Lr(r){return Be({...r,state:!0})}/**
125
+ */function on(t){return ht({...t,state:!0})}/**
116
126
  * @license
117
127
  * Copyright 2021 Google LLC
118
128
  * SPDX-License-Identifier: BSD-3-Clause
119
- */var mh;((mh=window.HTMLSlotElement)===null||mh===void 0?void 0:mh.prototype.assignedElements)!=null;/**
129
+ */var z0;((z0=window.HTMLSlotElement)===null||z0===void 0?void 0:z0.prototype.assignedElements)!=null;/**
120
130
  * @license
121
131
  * Copyright 2017 Google LLC
122
132
  * SPDX-License-Identifier: BSD-3-Clause
123
- */const vI={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},yI=r=>(...e)=>({_$litDirective$:r,values:e});class wI{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
133
+ */const fO={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},dO=t=>(...e)=>({_$litDirective$:t,values:e});class pO{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,r,n){this._$Ct=e,this._$AM=r,this._$Ci=n}_$AS(e,r){return this.update(e,r)}update(e,r){return this.render(...r)}}/**
124
134
  * @license
125
135
  * Copyright 2018 Google LLC
126
136
  * SPDX-License-Identifier: BSD-3-Clause
127
- */const qn=yI(class extends wI{constructor(r){var e;if(super(r),r.type!==vI.ATTRIBUTE||r.name!=="class"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter(e=>r[e]).join(" ")+" "}update(r,[e]){var t,n;if(this.it===void 0){this.it=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(a=>a!=="")));for(const a in e)e[a]&&!(!((t=this.nt)===null||t===void 0)&&t.has(a))&&this.it.add(a);return this.render(e)}const i=r.element.classList;this.it.forEach(a=>{a in e||(i.remove(a),this.it.delete(a))});for(const a in e){const c=!!e[a];c===this.it.has(a)||!((n=this.nt)===null||n===void 0)&&n.has(a)||(c?(i.add(a),this.it.add(a)):(i.remove(a),this.it.delete(a)))}return Zi}});function bI(r,e){r.indexOf(e)===-1&&r.push(e)}const Rg=(r,e,t)=>Math.min(Math.max(t,r),e),rn={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},hc=r=>typeof r=="number",Ms=r=>Array.isArray(r)&&!hc(r[0]),_I=(r,e,t)=>{const n=e-r;return((t-r)%n+n)%n+r};function EI(r,e){return Ms(r)?r[_I(0,r.length,e)]:r}const Ng=(r,e,t)=>-t*r+t*e+r,Lg=()=>{},di=r=>r,vh=(r,e,t)=>e-r===0?1:(t-r)/(e-r);function Mg(r,e){const t=r[r.length-1];for(let n=1;n<=e;n++){const i=vh(0,e,n);r.push(Ng(t,1,i))}}function xI(r){const e=[0];return Mg(e,r-1),e}function II(r,e=xI(r.length),t=di){const n=r.length,i=n-e.length;return i>0&&Mg(e,i),a=>{let c=0;for(;c<n-2&&!(a<e[c+1]);c++);let u=Rg(0,1,vh(e[c],e[c+1],a));return u=EI(t,c)(u),Ng(r[c],r[c+1],u)}}const Ug=r=>Array.isArray(r)&&hc(r[0]),yh=r=>typeof r=="object"&&!!r.createAnimation,Qi=r=>typeof r=="function",DI=r=>typeof r=="string",Go={ms:r=>r*1e3,s:r=>r/1e3},jg=(r,e,t)=>(((1-3*t+3*e)*r+(3*t-6*e))*r+3*e)*r,SI=1e-7,OI=12;function CI(r,e,t,n,i){let a,c,u=0;do c=e+(t-e)/2,a=jg(c,n,i)-r,a>0?t=c:e=c;while(Math.abs(a)>SI&&++u<OI);return c}function Yo(r,e,t,n){if(r===e&&t===n)return di;const i=a=>CI(a,0,1,r,t);return a=>a===0||a===1?a:jg(i(a),e,n)}const $I=(r,e="end")=>t=>{t=e==="end"?Math.min(t,.999):Math.max(t,.001);const n=t*r,i=e==="end"?Math.floor(n):Math.ceil(n);return Rg(0,1,i/r)},Fg={ease:Yo(.25,.1,.25,1),"ease-in":Yo(.42,0,1,1),"ease-in-out":Yo(.42,0,.58,1),"ease-out":Yo(0,0,.58,1)},AI=/\((.*?)\)/;function Bg(r){if(Qi(r))return r;if(Ug(r))return Yo(...r);if(Fg[r])return Fg[r];if(r.startsWith("steps")){const e=AI.exec(r);if(e){const t=e[1].split(",");return $I(parseFloat(t[0]),t[1].trim())}}return di}class kg{constructor(e,t=[0,1],{easing:n,duration:i=rn.duration,delay:a=rn.delay,endDelay:c=rn.endDelay,repeat:u=rn.repeat,offset:f,direction:h="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=di,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((w,y)=>{this.resolve=w,this.reject=y}),n=n||rn.easing,yh(n)){const w=n.createAnimation(t);n=w.easing,t=w.keyframes||t,i=w.duration||i}this.repeat=u,this.easing=Ms(n)?di:Bg(n),this.updateDuration(i);const m=II(t,f,Ms(n)?n.map(Bg):di);this.tick=w=>{var y;a=a;let _=0;this.pauseTime!==void 0?_=this.pauseTime:_=(w-this.startTime)*this.rate,this.t=_,_/=1e3,_=Math.max(_-a,0),this.playState==="finished"&&this.pauseTime===void 0&&(_=this.totalDuration);const S=_/this.duration;let P=Math.floor(S),j=S%1;!j&&S>=1&&(j=1),j===1&&P--;const U=P%2;(h==="reverse"||h==="alternate"&&U||h==="alternate-reverse"&&!U)&&(j=1-j);const A=_>=this.totalDuration?1:Math.min(j,1),T=m(this.easing(A));e(T),this.pauseTime===void 0&&(this.playState==="finished"||_>=this.totalDuration+c)?(this.playState="finished",(y=this.resolve)===null||y===void 0||y.call(this,T)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const e=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=e-this.pauseTime:this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var e;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(e=this.reject)===null||e===void 0||e.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(e){this.duration=e,this.totalDuration=e*(this.repeat+1)}get currentTime(){return this.t}set currentTime(e){this.pauseTime!==void 0||this.rate===0?this.pauseTime=e:this.startTime=performance.now()-e/this.rate}get playbackRate(){return this.rate}set playbackRate(e){this.rate=e}}var wh=function(){};process.env.NODE_ENV!=="production"&&(wh=function(r,e){if(!r)throw new Error(e)});class PI{setAnimation(e){this.animation=e,e?.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const bh=new WeakMap;function qg(r){return bh.has(r)||bh.set(r,{transforms:[],values:new Map}),bh.get(r)}function TI(r,e){return r.has(e)||r.set(e,new PI),r.get(e)}const RI=["","X","Y","Z"],NI=["translate","scale","rotate","skew"],fc={x:"translateX",y:"translateY",z:"translateZ"},zg={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:r=>r+"deg"},LI={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:r=>r+"px"},rotate:zg,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:di},skew:zg},Zo=new Map,_h=r=>`--motion-${r}`,dc=["x","y","z"];NI.forEach(r=>{RI.forEach(e=>{dc.push(r+e),Zo.set(_h(r+e),LI[r])})});const MI=(r,e)=>dc.indexOf(r)-dc.indexOf(e),UI=new Set(dc),Hg=r=>UI.has(r),jI=(r,e)=>{fc[e]&&(e=fc[e]);const{transforms:t}=qg(r);bI(t,e),r.style.transform=FI(t)},FI=r=>r.sort(MI).reduce(BI,"").trim(),BI=(r,e)=>`${r} ${e}(var(${_h(e)}))`,Eh=r=>r.startsWith("--"),Wg=new Set;function kI(r){if(!Wg.has(r)){Wg.add(r);try{const{syntax:e,initialValue:t}=Zo.has(r)?Zo.get(r):{};CSS.registerProperty({name:r,inherits:!1,syntax:e,initialValue:t})}catch{}}}const xh=(r,e)=>document.createElement("div").animate(r,e),Kg={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{xh({opacity:[1]})}catch{return!1}return!0},finished:()=>!!xh({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{xh({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},Ih={},Us={};for(const r in Kg)Us[r]=()=>(Ih[r]===void 0&&(Ih[r]=Kg[r]()),Ih[r]);const qI=.015,zI=(r,e)=>{let t="";const n=Math.round(e/qI);for(let i=0;i<n;i++)t+=r(vh(0,n-1,i))+", ";return t.substring(0,t.length-2)},Vg=(r,e)=>Qi(r)?Us.linearEasing()?`linear(${zI(r,e)})`:rn.easing:Ug(r)?HI(r):r,HI=([r,e,t,n])=>`cubic-bezier(${r}, ${e}, ${t}, ${n})`;function WI(r,e){for(let t=0;t<r.length;t++)r[t]===null&&(r[t]=t?r[t-1]:e());return r}const KI=r=>Array.isArray(r)?r:[r];function Dh(r){return fc[r]&&(r=fc[r]),Hg(r)?_h(r):r}const pc={get:(r,e)=>{e=Dh(e);let t=Eh(e)?r.style.getPropertyValue(e):getComputedStyle(r)[e];if(!t&&t!==0){const n=Zo.get(e);n&&(t=n.initialValue)}return t},set:(r,e,t)=>{e=Dh(e),Eh(e)?r.style.setProperty(e,t):r.style[e]=t}};function Gg(r,e=!0){if(!(!r||r.playState==="finished"))try{r.stop?r.stop():(e&&r.commitStyles(),r.cancel())}catch{}}function VI(r,e){var t;let n=e?.toDefaultUnit||di;const i=r[r.length-1];if(DI(i)){const a=((t=i.match(/(-?[\d.]+)([a-z%]*)/))===null||t===void 0?void 0:t[2])||"";a&&(n=c=>c+a)}return n}function GI(){return window.__MOTION_DEV_TOOLS_RECORD}function YI(r,e,t,n={},i){const a=GI(),c=n.record!==!1&&a;let u,{duration:f=rn.duration,delay:h=rn.delay,endDelay:m=rn.endDelay,repeat:w=rn.repeat,easing:y=rn.easing,persist:_=!1,direction:S,offset:P,allowWebkitAcceleration:j=!1}=n;const U=qg(r),A=Hg(e);let T=Us.waapi();A&&jI(r,e);const O=Dh(e),$=TI(U.values,O),x=Zo.get(O);return Gg($.animation,!(yh(y)&&$.generator)&&n.record!==!1),()=>{const d=()=>{var F,V;return(V=(F=pc.get(r,O))!==null&&F!==void 0?F:x?.initialValue)!==null&&V!==void 0?V:0};let b=WI(KI(t),d);const H=VI(b,x);if(yh(y)){const F=y.createAnimation(b,e!=="opacity",d,O,$);y=F.easing,b=F.keyframes||b,f=F.duration||f}if(Eh(O)&&(Us.cssRegisterProperty()?kI(O):T=!1),A&&!Us.linearEasing()&&(Qi(y)||Ms(y)&&y.some(Qi))&&(T=!1),T){x&&(b=b.map(se=>hc(se)?x.toDefaultUnit(se):se)),b.length===1&&(!Us.partialKeyframes()||c)&&b.unshift(d());const F={delay:Go.ms(h),duration:Go.ms(f),endDelay:Go.ms(m),easing:Ms(y)?void 0:Vg(y,f),direction:S,iterations:w+1,fill:"both"};u=r.animate({[O]:b,offset:P,easing:Ms(y)?y.map(se=>Vg(se,f)):void 0},F),u.finished||(u.finished=new Promise((se,ce)=>{u.onfinish=se,u.oncancel=ce}));const V=b[b.length-1];u.finished.then(()=>{_||(pc.set(r,O,V),u.cancel())}).catch(Lg),j||(u.playbackRate=1.000001)}else if(i&&A)b=b.map(F=>typeof F=="string"?parseFloat(F):F),b.length===1&&b.unshift(parseFloat(d())),u=new i(F=>{pc.set(r,O,H?H(F):F)},b,Object.assign(Object.assign({},n),{duration:f,easing:y}));else{const F=b[b.length-1];pc.set(r,O,x&&hc(F)?x.toDefaultUnit(F):F)}return c&&a(r,e,b,{duration:f,delay:h,easing:y,repeat:w,offset:P},"motion-one"),$.setAnimation(u),u}}const ZI=(r,e)=>r[e]?Object.assign(Object.assign({},r),r[e]):Object.assign({},r);function Yg(r,e){var t;return typeof r=="string"?e?((t=e[r])!==null&&t!==void 0||(e[r]=document.querySelectorAll(r)),r=e[r]):r=document.querySelectorAll(r):r instanceof Element&&(r=[r]),Array.from(r||[])}const JI=r=>r(),Zg=(r,e,t=rn.duration)=>new Proxy({animations:r.map(JI).filter(Boolean),duration:t,options:e},XI),QI=r=>r.animations[0],XI={get:(r,e)=>{const t=QI(r);switch(e){case"duration":return r.duration;case"currentTime":return Go.s(t?.[e]||0);case"playbackRate":case"playState":return t?.[e];case"finished":return r.finished||(r.finished=Promise.all(r.animations.map(eD)).catch(Lg)),r.finished;case"stop":return()=>{r.animations.forEach(n=>Gg(n))};case"forEachNative":return n=>{r.animations.forEach(i=>n(i,r))};default:return typeof t?.[e]>"u"?void 0:()=>r.animations.forEach(n=>n[e]())}},set:(r,e,t)=>{switch(e){case"currentTime":t=Go.ms(t);case"playbackRate":for(let n=0;n<r.animations.length;n++)r.animations[n][e]=t;return!0}return!1}},eD=r=>r.finished;function tD(r,e,t){return Qi(r)?r(e,t):r}function rD(r){return function(t,n,i={}){t=Yg(t);const a=t.length;wh(!!a,"No valid element provided."),wh(!!n,"No keyframes defined.");const c=[];for(let u=0;u<a;u++){const f=t[u];for(const h in n){const m=ZI(i,h);m.delay=tD(m.delay,u,a);const w=YI(f,h,n[h],m,r);c.push(w)}}return Zg(c,i,i.duration)}}const nD=rD(kg);function iD(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}typeof SuppressedError=="function"&&SuppressedError;const sD={any:0,all:1};function oD(r,e,{root:t,margin:n,amount:i="any"}={}){if(typeof IntersectionObserver>"u")return()=>{};const a=Yg(r),c=new WeakMap,u=h=>{h.forEach(m=>{const w=c.get(m.target);if(m.isIntersecting!==!!w)if(m.isIntersecting){const y=e(m);Qi(y)?c.set(m.target,y):f.unobserve(m.target)}else w&&(w(m),c.delete(m.target))})},f=new IntersectionObserver(u,{root:t,rootMargin:n,threshold:typeof i=="number"?i:sD[i]});return a.forEach(h=>f.observe(h)),()=>f.disconnect()}function Sh(r,e,t){r.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:t}}))}function Jg(r,e,t){r.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:t}}))}const aD={isActive:r=>!!r.inView,subscribe:(r,{enable:e,disable:t},{inViewOptions:n={}})=>{const{once:i}=n,a=iD(n,["once"]);return oD(r,c=>{if(e(),Jg(r,"viewenter",c),!i)return u=>{t(),Jg(r,"viewleave",u)}},a)}},Qg=(r,e,t)=>n=>{n.pointerType&&n.pointerType!=="mouse"||(t(),Sh(r,e,n))};[...Object.keys({inView:aD,hover:{isActive:r=>!!r.hover,subscribe:(r,{enable:e,disable:t})=>{const n=Qg(r,"hoverstart",e),i=Qg(r,"hoverend",t);return r.addEventListener("pointerenter",n),r.addEventListener("pointerleave",i),()=>{r.removeEventListener("pointerenter",n),r.removeEventListener("pointerleave",i)}}},press:{isActive:r=>!!r.press,subscribe:(r,{enable:e,disable:t})=>{const n=a=>{t(),Sh(r,"pressend",a),window.removeEventListener("pointerup",n)},i=a=>{e(),Sh(r,"pressstart",a),window.addEventListener("pointerup",n)};return r.addEventListener("pointerdown",i),()=>{r.removeEventListener("pointerdown",i),window.removeEventListener("pointerup",n)}}}})];function cD(r,e={}){return Zg([()=>{const t=new kg(r,[0,1],e);return t.finished.catch(()=>{}),t}],e,e.duration)}function Xi(r,e,t){return(Qi(r)?cD:nD)(r,e,t)}/**
137
+ */const Hi=dO(class extends pO{constructor(t){var e;if(super(t),t.type!==fO.ATTRIBUTE||t.name!=="class"||((e=t.strings)===null||e===void 0?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){var r,n;if(this.it===void 0){this.it=new Set,t.strings!==void 0&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in e)e[s]&&!(!((r=this.nt)===null||r===void 0)&&r.has(s))&&this.it.add(s);return this.render(e)}const i=t.element.classList;this.it.forEach(s=>{s in e||(i.remove(s),this.it.delete(s))});for(const s in e){const c=!!e[s];c===this.it.has(s)||!((n=this.nt)===null||n===void 0)&&n.has(s)||(c?(i.add(s),this.it.add(s)):(i.remove(s),this.it.delete(s)))}return co}});function gO(t,e){t.indexOf(e)===-1&&t.push(e)}const uw=(t,e,r)=>Math.min(Math.max(r,t),e),Ln={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},du=t=>typeof t=="number",ha=t=>Array.isArray(t)&&!du(t[0]),mO=(t,e,r)=>{const n=e-t;return((r-t)%n+n)%n+t};function vO(t,e){return ha(t)?t[mO(0,t.length,e)]:t}const hw=(t,e,r)=>-r*t+r*e+t,fw=()=>{},ws=t=>t,H0=(t,e,r)=>e-t===0?1:(r-t)/(e-t);function dw(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const i=H0(0,e,n);t.push(hw(r,1,i))}}function yO(t){const e=[0];return dw(e,t-1),e}function wO(t,e=yO(t.length),r=ws){const n=t.length,i=n-e.length;return i>0&&dw(e,i),s=>{let c=0;for(;c<n-2&&!(s<e[c+1]);c++);let l=uw(0,1,H0(e[c],e[c+1],s));return l=vO(r,c)(l),hw(t[c],t[c+1],l)}}const pw=t=>Array.isArray(t)&&du(t[0]),K0=t=>typeof t=="object"&&!!t.createAnimation,uo=t=>typeof t=="function",bO=t=>typeof t=="string",Oc={ms:t=>t*1e3,s:t=>t/1e3},gw=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,_O=1e-7,EO=12;function AO(t,e,r,n,i){let s,c,l=0;do c=e+(r-e)/2,s=gw(c,n,i)-t,s>0?r=c:e=c;while(Math.abs(s)>_O&&++l<EO);return c}function Pc(t,e,r,n){if(t===e&&r===n)return ws;const i=s=>AO(s,0,1,t,r);return s=>s===0||s===1?s:gw(i(s),e,n)}const xO=(t,e="end")=>r=>{r=e==="end"?Math.min(r,.999):Math.max(r,.001);const n=r*t,i=e==="end"?Math.floor(n):Math.ceil(n);return uw(0,1,i/t)},mw={ease:Pc(.25,.1,.25,1),"ease-in":Pc(.42,0,1,1),"ease-in-out":Pc(.42,0,.58,1),"ease-out":Pc(0,0,.58,1)},SO=/\((.*?)\)/;function vw(t){if(uo(t))return t;if(pw(t))return Pc(...t);if(mw[t])return mw[t];if(t.startsWith("steps")){const e=SO.exec(t);if(e){const r=e[1].split(",");return xO(parseFloat(r[0]),r[1].trim())}}return ws}class yw{constructor(e,r=[0,1],{easing:n,duration:i=Ln.duration,delay:s=Ln.delay,endDelay:c=Ln.endDelay,repeat:l=Ln.repeat,offset:f,direction:h="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=ws,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((_,E)=>{this.resolve=_,this.reject=E}),n=n||Ln.easing,K0(n)){const _=n.createAnimation(r);n=_.easing,r=_.keyframes||r,i=_.duration||i}this.repeat=l,this.easing=ha(n)?ws:vw(n),this.updateDuration(i);const m=wO(r,f,ha(n)?n.map(vw):ws);this.tick=_=>{var E;s=s;let A=0;this.pauseTime!==void 0?A=this.pauseTime:A=(_-this.startTime)*this.rate,this.t=A,A/=1e3,A=Math.max(A-s,0),this.playState==="finished"&&this.pauseTime===void 0&&(A=this.totalDuration);const I=A/this.duration;let R=Math.floor(I),W=I%1;!W&&I>=1&&(W=1),W===1&&R--;const Y=R%2;(h==="reverse"||h==="alternate"&&Y||h==="alternate-reverse"&&!Y)&&(W=1-W);const F=A>=this.totalDuration?1:Math.min(W,1),z=m(this.easing(F));e(z),this.pauseTime===void 0&&(this.playState==="finished"||A>=this.totalDuration+c)?(this.playState="finished",(E=this.resolve)===null||E===void 0||E.call(this,z)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const e=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=e-this.pauseTime:this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var e;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(e=this.reject)===null||e===void 0||e.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(e){this.duration=e,this.totalDuration=e*(this.repeat+1)}get currentTime(){return this.t}set currentTime(e){this.pauseTime!==void 0||this.rate===0?this.pauseTime=e:this.startTime=performance.now()-e/this.rate}get playbackRate(){return this.rate}set playbackRate(e){this.rate=e}}var W0=function(){};process.env.NODE_ENV!=="production"&&(W0=function(t,e){if(!t)throw new Error(e)});class IO{setAnimation(e){this.animation=e,e?.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const V0=new WeakMap;function ww(t){return V0.has(t)||V0.set(t,{transforms:[],values:new Map}),V0.get(t)}function DO(t,e){return t.has(e)||t.set(e,new IO),t.get(e)}const CO=["","X","Y","Z"],OO=["translate","scale","rotate","skew"],pu={x:"translateX",y:"translateY",z:"translateZ"},bw={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},PO={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:bw,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:ws},skew:bw},Mc=new Map,G0=t=>`--motion-${t}`,gu=["x","y","z"];OO.forEach(t=>{CO.forEach(e=>{gu.push(t+e),Mc.set(G0(t+e),PO[t])})});const MO=(t,e)=>gu.indexOf(t)-gu.indexOf(e),TO=new Set(gu),_w=t=>TO.has(t),$O=(t,e)=>{pu[e]&&(e=pu[e]);const{transforms:r}=ww(t);gO(r,e),t.style.transform=NO(r)},NO=t=>t.sort(MO).reduce(RO,"").trim(),RO=(t,e)=>`${t} ${e}(var(${G0(e)}))`,Y0=t=>t.startsWith("--"),Ew=new Set;function LO(t){if(!Ew.has(t)){Ew.add(t);try{const{syntax:e,initialValue:r}=Mc.has(t)?Mc.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:r})}catch{}}}const J0=(t,e)=>document.createElement("div").animate(t,e),Aw={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{J0({opacity:[1]})}catch{return!1}return!0},finished:()=>!!J0({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{J0({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},Q0={},fa={};for(const t in Aw)fa[t]=()=>(Q0[t]===void 0&&(Q0[t]=Aw[t]()),Q0[t]);const BO=.015,UO=(t,e)=>{let r="";const n=Math.round(e/BO);for(let i=0;i<n;i++)r+=t(H0(0,n-1,i))+", ";return r.substring(0,r.length-2)},xw=(t,e)=>uo(t)?fa.linearEasing()?`linear(${UO(t,e)})`:Ln.easing:pw(t)?FO(t):t,FO=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`;function jO(t,e){for(let r=0;r<t.length;r++)t[r]===null&&(t[r]=r?t[r-1]:e());return t}const kO=t=>Array.isArray(t)?t:[t];function Z0(t){return pu[t]&&(t=pu[t]),_w(t)?G0(t):t}const mu={get:(t,e)=>{e=Z0(e);let r=Y0(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!r&&r!==0){const n=Mc.get(e);n&&(r=n.initialValue)}return r},set:(t,e,r)=>{e=Z0(e),Y0(e)?t.style.setProperty(e,r):t.style[e]=r}};function Sw(t,e=!0){if(!(!t||t.playState==="finished"))try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch{}}function qO(t,e){var r;let n=e?.toDefaultUnit||ws;const i=t[t.length-1];if(bO(i)){const s=((r=i.match(/(-?[\d.]+)([a-z%]*)/))===null||r===void 0?void 0:r[2])||"";s&&(n=c=>c+s)}return n}function zO(){return window.__MOTION_DEV_TOOLS_RECORD}function HO(t,e,r,n={},i){const s=zO(),c=n.record!==!1&&s;let l,{duration:f=Ln.duration,delay:h=Ln.delay,endDelay:m=Ln.endDelay,repeat:_=Ln.repeat,easing:E=Ln.easing,persist:A=!1,direction:I,offset:R,allowWebkitAcceleration:W=!1}=n;const Y=ww(t),F=_w(e);let z=fa.waapi();F&&$O(t,e);const $=Z0(e),j=DO(Y.values,$),P=Mc.get($);return Sw(j.animation,!(K0(E)&&j.generator)&&n.record!==!1),()=>{const g=()=>{var J,te;return(te=(J=mu.get(t,$))!==null&&J!==void 0?J:P?.initialValue)!==null&&te!==void 0?te:0};let C=jO(kO(r),g);const Z=qO(C,P);if(K0(E)){const J=E.createAnimation(C,e!=="opacity",g,$,j);E=J.easing,C=J.keyframes||C,f=J.duration||f}if(Y0($)&&(fa.cssRegisterProperty()?LO($):z=!1),F&&!fa.linearEasing()&&(uo(E)||ha(E)&&E.some(uo))&&(z=!1),z){P&&(C=C.map(ae=>du(ae)?P.toDefaultUnit(ae):ae)),C.length===1&&(!fa.partialKeyframes()||c)&&C.unshift(g());const J={delay:Oc.ms(h),duration:Oc.ms(f),endDelay:Oc.ms(m),easing:ha(E)?void 0:xw(E,f),direction:I,iterations:_+1,fill:"both"};l=t.animate({[$]:C,offset:R,easing:ha(E)?E.map(ae=>xw(ae,f)):void 0},J),l.finished||(l.finished=new Promise((ae,p)=>{l.onfinish=ae,l.oncancel=p}));const te=C[C.length-1];l.finished.then(()=>{A||(mu.set(t,$,te),l.cancel())}).catch(fw),W||(l.playbackRate=1.000001)}else if(i&&F)C=C.map(J=>typeof J=="string"?parseFloat(J):J),C.length===1&&C.unshift(parseFloat(g())),l=new i(J=>{mu.set(t,$,Z?Z(J):J)},C,Object.assign(Object.assign({},n),{duration:f,easing:E}));else{const J=C[C.length-1];mu.set(t,$,P&&du(J)?P.toDefaultUnit(J):J)}return c&&s(t,e,C,{duration:f,delay:h,easing:E,repeat:_,offset:R},"motion-one"),j.setAnimation(l),l}}const KO=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function Iw(t,e){var r;return typeof t=="string"?e?((r=e[t])!==null&&r!==void 0||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t||[])}const WO=t=>t(),Dw=(t,e,r=Ln.duration)=>new Proxy({animations:t.map(WO).filter(Boolean),duration:r,options:e},GO),VO=t=>t.animations[0],GO={get:(t,e)=>{const r=VO(t);switch(e){case"duration":return t.duration;case"currentTime":return Oc.s(r?.[e]||0);case"playbackRate":case"playState":return r?.[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(YO)).catch(fw)),t.finished;case"stop":return()=>{t.animations.forEach(n=>Sw(n))};case"forEachNative":return n=>{t.animations.forEach(i=>n(i,t))};default:return typeof r?.[e]>"u"?void 0:()=>t.animations.forEach(n=>n[e]())}},set:(t,e,r)=>{switch(e){case"currentTime":r=Oc.ms(r);case"playbackRate":for(let n=0;n<t.animations.length;n++)t.animations[n][e]=r;return!0}return!1}},YO=t=>t.finished;function JO(t,e,r){return uo(t)?t(e,r):t}function QO(t){return function(r,n,i={}){r=Iw(r);const s=r.length;W0(!!s,"No valid element provided."),W0(!!n,"No keyframes defined.");const c=[];for(let l=0;l<s;l++){const f=r[l];for(const h in n){const m=KO(i,h);m.delay=JO(m.delay,l,s);const _=HO(f,h,n[h],m,t);c.push(_)}}return Dw(c,i,i.duration)}}const ZO=QO(yw);function XO(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}typeof SuppressedError=="function"&&SuppressedError;const eP={any:0,all:1};function tP(t,e,{root:r,margin:n,amount:i="any"}={}){if(typeof IntersectionObserver>"u")return()=>{};const s=Iw(t),c=new WeakMap,l=h=>{h.forEach(m=>{const _=c.get(m.target);if(m.isIntersecting!==!!_)if(m.isIntersecting){const E=e(m);uo(E)?c.set(m.target,E):f.unobserve(m.target)}else _&&(_(m),c.delete(m.target))})},f=new IntersectionObserver(l,{root:r,rootMargin:n,threshold:typeof i=="number"?i:eP[i]});return s.forEach(h=>f.observe(h)),()=>f.disconnect()}function X0(t,e,r){t.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:r}}))}function Cw(t,e,r){t.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:r}}))}const rP={isActive:t=>!!t.inView,subscribe:(t,{enable:e,disable:r},{inViewOptions:n={}})=>{const{once:i}=n,s=XO(n,["once"]);return tP(t,c=>{if(e(),Cw(t,"viewenter",c),!i)return l=>{r(),Cw(t,"viewleave",l)}},s)}},Ow=(t,e,r)=>n=>{n.pointerType&&n.pointerType!=="mouse"||(r(),X0(t,e,n))};[...Object.keys({inView:rP,hover:{isActive:t=>!!t.hover,subscribe:(t,{enable:e,disable:r})=>{const n=Ow(t,"hoverstart",e),i=Ow(t,"hoverend",r);return t.addEventListener("pointerenter",n),t.addEventListener("pointerleave",i),()=>{t.removeEventListener("pointerenter",n),t.removeEventListener("pointerleave",i)}}},press:{isActive:t=>!!t.press,subscribe:(t,{enable:e,disable:r})=>{const n=s=>{r(),X0(t,"pressend",s),window.removeEventListener("pointerup",n)},i=s=>{e(),X0(t,"pressstart",s),window.addEventListener("pointerup",n)};return t.addEventListener("pointerdown",i),()=>{t.removeEventListener("pointerdown",i),window.removeEventListener("pointerup",n)}}}})];function nP(t,e={}){return Dw([()=>{const r=new yw(t,[0,1],e);return r.finished.catch(()=>{}),r}],e,e.duration)}function ho(t,e,r){return(uo(t)?nP:ZO)(t,e,r)}/**
128
138
  * @license
129
139
  * Copyright 2018 Google LLC
130
140
  * SPDX-License-Identifier: BSD-3-Clause
131
- */const Ir=r=>r??tr;var Jo={},lD=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},Xg={},Vr={};let Oh;const uD=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Vr.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17},Vr.getSymbolTotalCodewords=function(e){return uD[e]},Vr.getBCHDigit=function(r){let e=0;for(;r!==0;)e++,r>>>=1;return e},Vr.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');Oh=e},Vr.isKanjiModeEnabled=function(){return typeof Oh<"u"},Vr.toSJIS=function(e){return Oh(e)};var gc={};(function(r){r.L={bit:1},r.M={bit:0},r.Q={bit:3},r.H={bit:2};function e(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return r.L;case"m":case"medium":return r.M;case"q":case"quartile":return r.Q;case"h":case"high":return r.H;default:throw new Error("Unknown EC Level: "+t)}}r.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},r.from=function(n,i){if(r.isValid(n))return n;try{return e(n)}catch{return i}}})(gc);function em(){this.buffer=[],this.length=0}em.prototype={get:function(r){const e=Math.floor(r/8);return(this.buffer[e]>>>7-r%8&1)===1},put:function(r,e){for(let t=0;t<e;t++)this.putBit((r>>>e-t-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),r&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var hD=em;function Qo(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}Qo.prototype.set=function(r,e,t,n){const i=r*this.size+e;this.data[i]=t,n&&(this.reservedBit[i]=!0)},Qo.prototype.get=function(r,e){return this.data[r*this.size+e]},Qo.prototype.xor=function(r,e,t){this.data[r*this.size+e]^=t},Qo.prototype.isReserved=function(r,e){return this.reservedBit[r*this.size+e]};var fD=Qo,tm={};(function(r){const e=Vr.getSymbolSize;r.getRowColCoords=function(n){if(n===1)return[];const i=Math.floor(n/7)+2,a=e(n),c=a===145?26:Math.ceil((a-13)/(2*i-2))*2,u=[a-7];for(let f=1;f<i-1;f++)u[f]=u[f-1]-c;return u.push(6),u.reverse()},r.getPositions=function(n){const i=[],a=r.getRowColCoords(n),c=a.length;for(let u=0;u<c;u++)for(let f=0;f<c;f++)u===0&&f===0||u===0&&f===c-1||u===c-1&&f===0||i.push([a[u],a[f]]);return i}})(tm);var rm={};const dD=Vr.getSymbolSize,nm=7;rm.getPositions=function(e){const t=dD(e);return[[0,0],[t-nm,0],[0,t-nm]]};var im={};(function(r){r.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};r.isValid=function(i){return i!=null&&i!==""&&!isNaN(i)&&i>=0&&i<=7},r.from=function(i){return r.isValid(i)?parseInt(i,10):void 0},r.getPenaltyN1=function(i){const a=i.size;let c=0,u=0,f=0,h=null,m=null;for(let w=0;w<a;w++){u=f=0,h=m=null;for(let y=0;y<a;y++){let _=i.get(w,y);_===h?u++:(u>=5&&(c+=e.N1+(u-5)),h=_,u=1),_=i.get(y,w),_===m?f++:(f>=5&&(c+=e.N1+(f-5)),m=_,f=1)}u>=5&&(c+=e.N1+(u-5)),f>=5&&(c+=e.N1+(f-5))}return c},r.getPenaltyN2=function(i){const a=i.size;let c=0;for(let u=0;u<a-1;u++)for(let f=0;f<a-1;f++){const h=i.get(u,f)+i.get(u,f+1)+i.get(u+1,f)+i.get(u+1,f+1);(h===4||h===0)&&c++}return c*e.N2},r.getPenaltyN3=function(i){const a=i.size;let c=0,u=0,f=0;for(let h=0;h<a;h++){u=f=0;for(let m=0;m<a;m++)u=u<<1&2047|i.get(h,m),m>=10&&(u===1488||u===93)&&c++,f=f<<1&2047|i.get(m,h),m>=10&&(f===1488||f===93)&&c++}return c*e.N3},r.getPenaltyN4=function(i){let a=0;const c=i.data.length;for(let f=0;f<c;f++)a+=i.data[f];return Math.abs(Math.ceil(a*100/c/5)-10)*e.N4};function t(n,i,a){switch(n){case r.Patterns.PATTERN000:return(i+a)%2===0;case r.Patterns.PATTERN001:return i%2===0;case r.Patterns.PATTERN010:return a%3===0;case r.Patterns.PATTERN011:return(i+a)%3===0;case r.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(a/3))%2===0;case r.Patterns.PATTERN101:return i*a%2+i*a%3===0;case r.Patterns.PATTERN110:return(i*a%2+i*a%3)%2===0;case r.Patterns.PATTERN111:return(i*a%3+(i+a)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}r.applyMask=function(i,a){const c=a.size;for(let u=0;u<c;u++)for(let f=0;f<c;f++)a.isReserved(f,u)||a.xor(f,u,t(i,f,u))},r.getBestMask=function(i,a){const c=Object.keys(r.Patterns).length;let u=0,f=1/0;for(let h=0;h<c;h++){a(h),r.applyMask(h,i);const m=r.getPenaltyN1(i)+r.getPenaltyN2(i)+r.getPenaltyN3(i)+r.getPenaltyN4(i);r.applyMask(h,i),m<f&&(f=m,u=h)}return u}})(im);var mc={};const pi=gc,vc=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],yc=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];mc.getBlocksCount=function(e,t){switch(t){case pi.L:return vc[(e-1)*4+0];case pi.M:return vc[(e-1)*4+1];case pi.Q:return vc[(e-1)*4+2];case pi.H:return vc[(e-1)*4+3];default:return}},mc.getTotalCodewordsCount=function(e,t){switch(t){case pi.L:return yc[(e-1)*4+0];case pi.M:return yc[(e-1)*4+1];case pi.Q:return yc[(e-1)*4+2];case pi.H:return yc[(e-1)*4+3];default:return}};var sm={},wc={};const Xo=new Uint8Array(512),bc=new Uint8Array(256);(function(){let e=1;for(let t=0;t<255;t++)Xo[t]=e,bc[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)Xo[t]=Xo[t-255]})(),wc.log=function(e){if(e<1)throw new Error("log("+e+")");return bc[e]},wc.exp=function(e){return Xo[e]},wc.mul=function(e,t){return e===0||t===0?0:Xo[bc[e]+bc[t]]},function(r){const e=wc;r.mul=function(n,i){const a=new Uint8Array(n.length+i.length-1);for(let c=0;c<n.length;c++)for(let u=0;u<i.length;u++)a[c+u]^=e.mul(n[c],i[u]);return a},r.mod=function(n,i){let a=new Uint8Array(n);for(;a.length-i.length>=0;){const c=a[0];for(let f=0;f<i.length;f++)a[f]^=e.mul(i[f],c);let u=0;for(;u<a.length&&a[u]===0;)u++;a=a.slice(u)}return a},r.generateECPolynomial=function(n){let i=new Uint8Array([1]);for(let a=0;a<n;a++)i=r.mul(i,new Uint8Array([1,e.exp(a)]));return i}}(sm);const om=sm;function Ch(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}Ch.prototype.initialize=function(e){this.degree=e,this.genPoly=om.generateECPolynomial(this.degree)},Ch.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=om.mod(t,this.genPoly),i=this.degree-n.length;if(i>0){const a=new Uint8Array(this.degree);return a.set(n,i),a}return n};var pD=Ch,am={},gi={},$h={};$h.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var On={};const cm="[0-9]+",gD="[A-Z $%*+\\-./:]+";let ea="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";ea=ea.replace(/u/g,"\\u");const mD="(?:(?![A-Z0-9 $%*+\\-./:]|"+ea+`)(?:.|[\r
132
- ]))+`;On.KANJI=new RegExp(ea,"g"),On.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),On.BYTE=new RegExp(mD,"g"),On.NUMERIC=new RegExp(cm,"g"),On.ALPHANUMERIC=new RegExp(gD,"g");const vD=new RegExp("^"+ea+"$"),yD=new RegExp("^"+cm+"$"),wD=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");On.testKanji=function(e){return vD.test(e)},On.testNumeric=function(e){return yD.test(e)},On.testAlphanumeric=function(e){return wD.test(e)},function(r){const e=$h,t=On;r.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},r.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},r.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},r.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},r.MIXED={bit:-1},r.getCharCountIndicator=function(a,c){if(!a.ccBits)throw new Error("Invalid mode: "+a);if(!e.isValid(c))throw new Error("Invalid version: "+c);return c>=1&&c<10?a.ccBits[0]:c<27?a.ccBits[1]:a.ccBits[2]},r.getBestModeForData=function(a){return t.testNumeric(a)?r.NUMERIC:t.testAlphanumeric(a)?r.ALPHANUMERIC:t.testKanji(a)?r.KANJI:r.BYTE},r.toString=function(a){if(a&&a.id)return a.id;throw new Error("Invalid mode")},r.isValid=function(a){return a&&a.bit&&a.ccBits};function n(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"numeric":return r.NUMERIC;case"alphanumeric":return r.ALPHANUMERIC;case"kanji":return r.KANJI;case"byte":return r.BYTE;default:throw new Error("Unknown mode: "+i)}}r.from=function(a,c){if(r.isValid(a))return a;try{return n(a)}catch{return c}}}(gi),function(r){const e=Vr,t=mc,n=gc,i=gi,a=$h,c=7973,u=e.getBCHDigit(c);function f(y,_,S){for(let P=1;P<=40;P++)if(_<=r.getCapacity(P,S,y))return P}function h(y,_){return i.getCharCountIndicator(y,_)+4}function m(y,_){let S=0;return y.forEach(function(P){const j=h(P.mode,_);S+=j+P.getBitsLength()}),S}function w(y,_){for(let S=1;S<=40;S++)if(m(y,S)<=r.getCapacity(S,_,i.MIXED))return S}r.from=function(_,S){return a.isValid(_)?parseInt(_,10):S},r.getCapacity=function(_,S,P){if(!a.isValid(_))throw new Error("Invalid QR Code version");typeof P>"u"&&(P=i.BYTE);const j=e.getSymbolTotalCodewords(_),U=t.getTotalCodewordsCount(_,S),A=(j-U)*8;if(P===i.MIXED)return A;const T=A-h(P,_);switch(P){case i.NUMERIC:return Math.floor(T/10*3);case i.ALPHANUMERIC:return Math.floor(T/11*2);case i.KANJI:return Math.floor(T/13);case i.BYTE:default:return Math.floor(T/8)}},r.getBestVersionForData=function(_,S){let P;const j=n.from(S,n.M);if(Array.isArray(_)){if(_.length>1)return w(_,j);if(_.length===0)return 1;P=_[0]}else P=_;return f(P.mode,P.getLength(),j)},r.getEncodedBits=function(_){if(!a.isValid(_)||_<7)throw new Error("Invalid QR Code version");let S=_<<12;for(;e.getBCHDigit(S)-u>=0;)S^=c<<e.getBCHDigit(S)-u;return _<<12|S}}(am);var lm={};const Ah=Vr,um=1335,bD=21522,hm=Ah.getBCHDigit(um);lm.getEncodedBits=function(e,t){const n=e.bit<<3|t;let i=n<<10;for(;Ah.getBCHDigit(i)-hm>=0;)i^=um<<Ah.getBCHDigit(i)-hm;return(n<<10|i)^bD};var fm={};const _D=gi;function js(r){this.mode=_D.NUMERIC,this.data=r.toString()}js.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},js.prototype.getLength=function(){return this.data.length},js.prototype.getBitsLength=function(){return js.getBitsLength(this.data.length)},js.prototype.write=function(e){let t,n,i;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),i=parseInt(n,10),e.put(i,10);const a=this.data.length-t;a>0&&(n=this.data.substr(t),i=parseInt(n,10),e.put(i,a*3+1))};var ED=js;const xD=gi,Ph=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Fs(r){this.mode=xD.ALPHANUMERIC,this.data=r}Fs.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)},Fs.prototype.getLength=function(){return this.data.length},Fs.prototype.getBitsLength=function(){return Fs.getBitsLength(this.data.length)},Fs.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=Ph.indexOf(this.data[t])*45;n+=Ph.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(Ph.indexOf(this.data[t]),6)};var ID=Fs,DD=function(e){for(var t=[],n=e.length,i=0;i<n;i++){var a=e.charCodeAt(i);if(a>=55296&&a<=56319&&n>i+1){var c=e.charCodeAt(i+1);c>=56320&&c<=57343&&(a=(a-55296)*1024+c-56320+65536,i+=1)}if(a<128){t.push(a);continue}if(a<2048){t.push(a>>6|192),t.push(a&63|128);continue}if(a<55296||a>=57344&&a<65536){t.push(a>>12|224),t.push(a>>6&63|128),t.push(a&63|128);continue}if(a>=65536&&a<=1114111){t.push(a>>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(a&63|128);continue}t.push(239,191,189)}return new Uint8Array(t).buffer};const SD=DD,OD=gi;function Bs(r){this.mode=OD.BYTE,typeof r=="string"&&(r=SD(r)),this.data=new Uint8Array(r)}Bs.getBitsLength=function(e){return e*8},Bs.prototype.getLength=function(){return this.data.length},Bs.prototype.getBitsLength=function(){return Bs.getBitsLength(this.data.length)},Bs.prototype.write=function(r){for(let e=0,t=this.data.length;e<t;e++)r.put(this.data[e],8)};var CD=Bs;const $D=gi,AD=Vr;function ks(r){this.mode=$D.KANJI,this.data=r}ks.getBitsLength=function(e){return e*13},ks.prototype.getLength=function(){return this.data.length},ks.prototype.getBitsLength=function(){return ks.getBitsLength(this.data.length)},ks.prototype.write=function(r){let e;for(e=0;e<this.data.length;e++){let t=AD.toSJIS(this.data[e]);if(t>=33088&&t<=40956)t-=33088;else if(t>=57408&&t<=60351)t-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
133
- Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};var PD=ks,dm={exports:{}};(function(r){var e={single_source_shortest_paths:function(t,n,i){var a={},c={};c[n]=0;var u=e.PriorityQueue.make();u.push(n,0);for(var f,h,m,w,y,_,S,P,j;!u.empty();){f=u.pop(),h=f.value,w=f.cost,y=t[h]||{};for(m in y)y.hasOwnProperty(m)&&(_=y[m],S=w+_,P=c[m],j=typeof c[m]>"u",(j||P>S)&&(c[m]=S,u.push(m,S),a[m]=h))}if(typeof i<"u"&&typeof c[i]>"u"){var U=["Could not find a path from ",n," to ",i,"."].join("");throw new Error(U)}return a},extract_shortest_path_from_predecessor_list:function(t,n){for(var i=[],a=n;a;)i.push(a),t[a],a=t[a];return i.reverse(),i},find_path:function(t,n,i){var a=e.single_source_shortest_paths(t,n,i);return e.extract_shortest_path_from_predecessor_list(a,i)},PriorityQueue:{make:function(t){var n=e.PriorityQueue,i={},a;t=t||{};for(a in n)n.hasOwnProperty(a)&&(i[a]=n[a]);return i.queue=[],i.sorter=t.sorter||n.default_sorter,i},default_sorter:function(t,n){return t.cost-n.cost},push:function(t,n){var i={value:t,cost:n};this.queue.push(i),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};r.exports=e})(dm),function(r){const e=gi,t=ED,n=ID,i=CD,a=PD,c=On,u=Vr,f=dm.exports;function h(U){return unescape(encodeURIComponent(U)).length}function m(U,A,T){const O=[];let $;for(;($=U.exec(T))!==null;)O.push({data:$[0],index:$.index,mode:A,length:$[0].length});return O}function w(U){const A=m(c.NUMERIC,e.NUMERIC,U),T=m(c.ALPHANUMERIC,e.ALPHANUMERIC,U);let O,$;return u.isKanjiModeEnabled()?(O=m(c.BYTE,e.BYTE,U),$=m(c.KANJI,e.KANJI,U)):(O=m(c.BYTE_KANJI,e.BYTE,U),$=[]),A.concat(T,O,$).sort(function(d,b){return d.index-b.index}).map(function(d){return{data:d.data,mode:d.mode,length:d.length}})}function y(U,A){switch(A){case e.NUMERIC:return t.getBitsLength(U);case e.ALPHANUMERIC:return n.getBitsLength(U);case e.KANJI:return a.getBitsLength(U);case e.BYTE:return i.getBitsLength(U)}}function _(U){return U.reduce(function(A,T){const O=A.length-1>=0?A[A.length-1]:null;return O&&O.mode===T.mode?(A[A.length-1].data+=T.data,A):(A.push(T),A)},[])}function S(U){const A=[];for(let T=0;T<U.length;T++){const O=U[T];switch(O.mode){case e.NUMERIC:A.push([O,{data:O.data,mode:e.ALPHANUMERIC,length:O.length},{data:O.data,mode:e.BYTE,length:O.length}]);break;case e.ALPHANUMERIC:A.push([O,{data:O.data,mode:e.BYTE,length:O.length}]);break;case e.KANJI:A.push([O,{data:O.data,mode:e.BYTE,length:h(O.data)}]);break;case e.BYTE:A.push([{data:O.data,mode:e.BYTE,length:h(O.data)}])}}return A}function P(U,A){const T={},O={start:{}};let $=["start"];for(let x=0;x<U.length;x++){const d=U[x],b=[];for(let H=0;H<d.length;H++){const F=d[H],V=""+x+H;b.push(V),T[V]={node:F,lastCount:0},O[V]={};for(let se=0;se<$.length;se++){const ce=$[se];T[ce]&&T[ce].node.mode===F.mode?(O[ce][V]=y(T[ce].lastCount+F.length,F.mode)-y(T[ce].lastCount,F.mode),T[ce].lastCount+=F.length):(T[ce]&&(T[ce].lastCount=F.length),O[ce][V]=y(F.length,F.mode)+4+e.getCharCountIndicator(F.mode,A))}}$=b}for(let x=0;x<$.length;x++)O[$[x]].end=0;return{map:O,table:T}}function j(U,A){let T;const O=e.getBestModeForData(U);if(T=e.from(A,O),T!==e.BYTE&&T.bit<O.bit)throw new Error('"'+U+'" cannot be encoded with mode '+e.toString(T)+`.
134
- Suggested mode is: `+e.toString(O));switch(T===e.KANJI&&!u.isKanjiModeEnabled()&&(T=e.BYTE),T){case e.NUMERIC:return new t(U);case e.ALPHANUMERIC:return new n(U);case e.KANJI:return new a(U);case e.BYTE:return new i(U)}}r.fromArray=function(A){return A.reduce(function(T,O){return typeof O=="string"?T.push(j(O,null)):O.data&&T.push(j(O.data,O.mode)),T},[])},r.fromString=function(A,T){const O=w(A,u.isKanjiModeEnabled()),$=S(O),x=P($,T),d=f.find_path(x.map,"start","end"),b=[];for(let H=1;H<d.length-1;H++)b.push(x.table[d[H]].node);return r.fromArray(_(b))},r.rawSplit=function(A){return r.fromArray(w(A,u.isKanjiModeEnabled()))}}(fm);const _c=Vr,Th=gc,TD=hD,RD=fD,ND=tm,LD=rm,Rh=im,Nh=mc,MD=pD,Ec=am,UD=lm,jD=gi,Lh=fm;function FD(r,e){const t=r.size,n=LD.getPositions(e);for(let i=0;i<n.length;i++){const a=n[i][0],c=n[i][1];for(let u=-1;u<=7;u++)if(!(a+u<=-1||t<=a+u))for(let f=-1;f<=7;f++)c+f<=-1||t<=c+f||(u>=0&&u<=6&&(f===0||f===6)||f>=0&&f<=6&&(u===0||u===6)||u>=2&&u<=4&&f>=2&&f<=4?r.set(a+u,c+f,!0,!0):r.set(a+u,c+f,!1,!0))}}function BD(r){const e=r.size;for(let t=8;t<e-8;t++){const n=t%2===0;r.set(t,6,n,!0),r.set(6,t,n,!0)}}function kD(r,e){const t=ND.getPositions(e);for(let n=0;n<t.length;n++){const i=t[n][0],a=t[n][1];for(let c=-2;c<=2;c++)for(let u=-2;u<=2;u++)c===-2||c===2||u===-2||u===2||c===0&&u===0?r.set(i+c,a+u,!0,!0):r.set(i+c,a+u,!1,!0)}}function qD(r,e){const t=r.size,n=Ec.getEncodedBits(e);let i,a,c;for(let u=0;u<18;u++)i=Math.floor(u/3),a=u%3+t-8-3,c=(n>>u&1)===1,r.set(i,a,c,!0),r.set(a,i,c,!0)}function Mh(r,e,t){const n=r.size,i=UD.getEncodedBits(e,t);let a,c;for(a=0;a<15;a++)c=(i>>a&1)===1,a<6?r.set(a,8,c,!0):a<8?r.set(a+1,8,c,!0):r.set(n-15+a,8,c,!0),a<8?r.set(8,n-a-1,c,!0):a<9?r.set(8,15-a-1+1,c,!0):r.set(8,15-a-1,c,!0);r.set(n-8,8,1,!0)}function zD(r,e){const t=r.size;let n=-1,i=t-1,a=7,c=0;for(let u=t-1;u>0;u-=2)for(u===6&&u--;;){for(let f=0;f<2;f++)if(!r.isReserved(i,u-f)){let h=!1;c<e.length&&(h=(e[c]>>>a&1)===1),r.set(i,u-f,h),a--,a===-1&&(c++,a=7)}if(i+=n,i<0||t<=i){i-=n,n=-n;break}}}function HD(r,e,t){const n=new TD;t.forEach(function(f){n.put(f.mode.bit,4),n.put(f.getLength(),jD.getCharCountIndicator(f.mode,r)),f.write(n)});const i=_c.getSymbolTotalCodewords(r),a=Nh.getTotalCodewordsCount(r,e),c=(i-a)*8;for(n.getLengthInBits()+4<=c&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);const u=(c-n.getLengthInBits())/8;for(let f=0;f<u;f++)n.put(f%2?17:236,8);return WD(n,r,e)}function WD(r,e,t){const n=_c.getSymbolTotalCodewords(e),i=Nh.getTotalCodewordsCount(e,t),a=n-i,c=Nh.getBlocksCount(e,t),u=n%c,f=c-u,h=Math.floor(n/c),m=Math.floor(a/c),w=m+1,y=h-m,_=new MD(y);let S=0;const P=new Array(c),j=new Array(c);let U=0;const A=new Uint8Array(r.buffer);for(let d=0;d<c;d++){const b=d<f?m:w;P[d]=A.slice(S,S+b),j[d]=_.encode(P[d]),S+=b,U=Math.max(U,b)}const T=new Uint8Array(n);let O=0,$,x;for($=0;$<U;$++)for(x=0;x<c;x++)$<P[x].length&&(T[O++]=P[x][$]);for($=0;$<y;$++)for(x=0;x<c;x++)T[O++]=j[x][$];return T}function KD(r,e,t,n){let i;if(Array.isArray(r))i=Lh.fromArray(r);else if(typeof r=="string"){let h=e;if(!h){const m=Lh.rawSplit(r);h=Ec.getBestVersionForData(m,t)}i=Lh.fromString(r,h||40)}else throw new Error("Invalid data");const a=Ec.getBestVersionForData(i,t);if(!a)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=a;else if(e<a)throw new Error(`
141
+ */const Wr=t=>t??vr;var Tc={},iP=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},Pw={},bn={};let ed;const sP=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];bn.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17},bn.getSymbolTotalCodewords=function(e){return sP[e]},bn.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e},bn.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');ed=e},bn.isKanjiModeEnabled=function(){return typeof ed<"u"},bn.toSJIS=function(e){return ed(e)};var vu={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+r)}}t.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},t.from=function(n,i){if(t.isValid(n))return n;try{return e(n)}catch{return i}}})(vu);function Mw(){this.buffer=[],this.length=0}Mw.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var oP=Mw;function $c(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}$c.prototype.set=function(t,e,r,n){const i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)},$c.prototype.get=function(t,e){return this.data[t*this.size+e]},$c.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r},$c.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var aP=$c,Tw={};(function(t){const e=bn.getSymbolSize;t.getRowColCoords=function(n){if(n===1)return[];const i=Math.floor(n/7)+2,s=e(n),c=s===145?26:Math.ceil((s-13)/(2*i-2))*2,l=[s-7];for(let f=1;f<i-1;f++)l[f]=l[f-1]-c;return l.push(6),l.reverse()},t.getPositions=function(n){const i=[],s=t.getRowColCoords(n),c=s.length;for(let l=0;l<c;l++)for(let f=0;f<c;f++)l===0&&f===0||l===0&&f===c-1||l===c-1&&f===0||i.push([s[l],s[f]]);return i}})(Tw);var $w={};const cP=bn.getSymbolSize,Nw=7;$w.getPositions=function(e){const r=cP(e);return[[0,0],[r-Nw,0],[0,r-Nw]]};var Rw={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(i){return i!=null&&i!==""&&!isNaN(i)&&i>=0&&i<=7},t.from=function(i){return t.isValid(i)?parseInt(i,10):void 0},t.getPenaltyN1=function(i){const s=i.size;let c=0,l=0,f=0,h=null,m=null;for(let _=0;_<s;_++){l=f=0,h=m=null;for(let E=0;E<s;E++){let A=i.get(_,E);A===h?l++:(l>=5&&(c+=e.N1+(l-5)),h=A,l=1),A=i.get(E,_),A===m?f++:(f>=5&&(c+=e.N1+(f-5)),m=A,f=1)}l>=5&&(c+=e.N1+(l-5)),f>=5&&(c+=e.N1+(f-5))}return c},t.getPenaltyN2=function(i){const s=i.size;let c=0;for(let l=0;l<s-1;l++)for(let f=0;f<s-1;f++){const h=i.get(l,f)+i.get(l,f+1)+i.get(l+1,f)+i.get(l+1,f+1);(h===4||h===0)&&c++}return c*e.N2},t.getPenaltyN3=function(i){const s=i.size;let c=0,l=0,f=0;for(let h=0;h<s;h++){l=f=0;for(let m=0;m<s;m++)l=l<<1&2047|i.get(h,m),m>=10&&(l===1488||l===93)&&c++,f=f<<1&2047|i.get(m,h),m>=10&&(f===1488||f===93)&&c++}return c*e.N3},t.getPenaltyN4=function(i){let s=0;const c=i.data.length;for(let f=0;f<c;f++)s+=i.data[f];return Math.abs(Math.ceil(s*100/c/5)-10)*e.N4};function r(n,i,s){switch(n){case t.Patterns.PATTERN000:return(i+s)%2===0;case t.Patterns.PATTERN001:return i%2===0;case t.Patterns.PATTERN010:return s%3===0;case t.Patterns.PATTERN011:return(i+s)%3===0;case t.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(s/3))%2===0;case t.Patterns.PATTERN101:return i*s%2+i*s%3===0;case t.Patterns.PATTERN110:return(i*s%2+i*s%3)%2===0;case t.Patterns.PATTERN111:return(i*s%3+(i+s)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}t.applyMask=function(i,s){const c=s.size;for(let l=0;l<c;l++)for(let f=0;f<c;f++)s.isReserved(f,l)||s.xor(f,l,r(i,f,l))},t.getBestMask=function(i,s){const c=Object.keys(t.Patterns).length;let l=0,f=1/0;for(let h=0;h<c;h++){s(h),t.applyMask(h,i);const m=t.getPenaltyN1(i)+t.getPenaltyN2(i)+t.getPenaltyN3(i)+t.getPenaltyN4(i);t.applyMask(h,i),m<f&&(f=m,l=h)}return l}})(Rw);var yu={};const bs=vu,wu=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],bu=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];yu.getBlocksCount=function(e,r){switch(r){case bs.L:return wu[(e-1)*4+0];case bs.M:return wu[(e-1)*4+1];case bs.Q:return wu[(e-1)*4+2];case bs.H:return wu[(e-1)*4+3];default:return}},yu.getTotalCodewordsCount=function(e,r){switch(r){case bs.L:return bu[(e-1)*4+0];case bs.M:return bu[(e-1)*4+1];case bs.Q:return bu[(e-1)*4+2];case bs.H:return bu[(e-1)*4+3];default:return}};var Lw={},_u={};const Nc=new Uint8Array(512),Eu=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Nc[r]=e,Eu[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Nc[r]=Nc[r-255]})(),_u.log=function(e){if(e<1)throw new Error("log("+e+")");return Eu[e]},_u.exp=function(e){return Nc[e]},_u.mul=function(e,r){return e===0||r===0?0:Nc[Eu[e]+Eu[r]]},function(t){const e=_u;t.mul=function(n,i){const s=new Uint8Array(n.length+i.length-1);for(let c=0;c<n.length;c++)for(let l=0;l<i.length;l++)s[c+l]^=e.mul(n[c],i[l]);return s},t.mod=function(n,i){let s=new Uint8Array(n);for(;s.length-i.length>=0;){const c=s[0];for(let f=0;f<i.length;f++)s[f]^=e.mul(i[f],c);let l=0;for(;l<s.length&&s[l]===0;)l++;s=s.slice(l)}return s},t.generateECPolynomial=function(n){let i=new Uint8Array([1]);for(let s=0;s<n;s++)i=t.mul(i,new Uint8Array([1,e.exp(s)]));return i}}(Lw);const Bw=Lw;function td(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}td.prototype.initialize=function(e){this.degree=e,this.genPoly=Bw.generateECPolynomial(this.degree)},td.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const r=new Uint8Array(e.length+this.degree);r.set(e);const n=Bw.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){const s=new Uint8Array(this.degree);return s.set(n,i),s}return n};var lP=td,Uw={},_s={},rd={};rd.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var xi={};const Fw="[0-9]+",uP="[A-Z $%*+\\-./:]+";let Rc="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Rc=Rc.replace(/u/g,"\\u");const hP="(?:(?![A-Z0-9 $%*+\\-./:]|"+Rc+`)(?:.|[\r
142
+ ]))+`;xi.KANJI=new RegExp(Rc,"g"),xi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),xi.BYTE=new RegExp(hP,"g"),xi.NUMERIC=new RegExp(Fw,"g"),xi.ALPHANUMERIC=new RegExp(uP,"g");const fP=new RegExp("^"+Rc+"$"),dP=new RegExp("^"+Fw+"$"),pP=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");xi.testKanji=function(e){return fP.test(e)},xi.testNumeric=function(e){return dP.test(e)},xi.testAlphanumeric=function(e){return pP.test(e)},function(t){const e=rd,r=xi;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(s,c){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!e.isValid(c))throw new Error("Invalid version: "+c);return c>=1&&c<10?s.ccBits[0]:c<27?s.ccBits[1]:s.ccBits[2]},t.getBestModeForData=function(s){return r.testNumeric(s)?t.NUMERIC:r.testAlphanumeric(s)?t.ALPHANUMERIC:r.testKanji(s)?t.KANJI:t.BYTE},t.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},t.isValid=function(s){return s&&s.bit&&s.ccBits};function n(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+i)}}t.from=function(s,c){if(t.isValid(s))return s;try{return n(s)}catch{return c}}}(_s),function(t){const e=bn,r=yu,n=vu,i=_s,s=rd,c=7973,l=e.getBCHDigit(c);function f(E,A,I){for(let R=1;R<=40;R++)if(A<=t.getCapacity(R,I,E))return R}function h(E,A){return i.getCharCountIndicator(E,A)+4}function m(E,A){let I=0;return E.forEach(function(R){const W=h(R.mode,A);I+=W+R.getBitsLength()}),I}function _(E,A){for(let I=1;I<=40;I++)if(m(E,I)<=t.getCapacity(I,A,i.MIXED))return I}t.from=function(A,I){return s.isValid(A)?parseInt(A,10):I},t.getCapacity=function(A,I,R){if(!s.isValid(A))throw new Error("Invalid QR Code version");typeof R>"u"&&(R=i.BYTE);const W=e.getSymbolTotalCodewords(A),Y=r.getTotalCodewordsCount(A,I),F=(W-Y)*8;if(R===i.MIXED)return F;const z=F-h(R,A);switch(R){case i.NUMERIC:return Math.floor(z/10*3);case i.ALPHANUMERIC:return Math.floor(z/11*2);case i.KANJI:return Math.floor(z/13);case i.BYTE:default:return Math.floor(z/8)}},t.getBestVersionForData=function(A,I){let R;const W=n.from(I,n.M);if(Array.isArray(A)){if(A.length>1)return _(A,W);if(A.length===0)return 1;R=A[0]}else R=A;return f(R.mode,R.getLength(),W)},t.getEncodedBits=function(A){if(!s.isValid(A)||A<7)throw new Error("Invalid QR Code version");let I=A<<12;for(;e.getBCHDigit(I)-l>=0;)I^=c<<e.getBCHDigit(I)-l;return A<<12|I}}(Uw);var jw={};const nd=bn,kw=1335,gP=21522,qw=nd.getBCHDigit(kw);jw.getEncodedBits=function(e,r){const n=e.bit<<3|r;let i=n<<10;for(;nd.getBCHDigit(i)-qw>=0;)i^=kw<<nd.getBCHDigit(i)-qw;return(n<<10|i)^gP};var zw={};const mP=_s;function da(t){this.mode=mP.NUMERIC,this.data=t.toString()}da.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},da.prototype.getLength=function(){return this.data.length},da.prototype.getBitsLength=function(){return da.getBitsLength(this.data.length)},da.prototype.write=function(e){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),e.put(i,10);const s=this.data.length-r;s>0&&(n=this.data.substr(r),i=parseInt(n,10),e.put(i,s*3+1))};var vP=da;const yP=_s,id=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function pa(t){this.mode=yP.ALPHANUMERIC,this.data=t}pa.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)},pa.prototype.getLength=function(){return this.data.length},pa.prototype.getBitsLength=function(){return pa.getBitsLength(this.data.length)},pa.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=id.indexOf(this.data[r])*45;n+=id.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(id.indexOf(this.data[r]),6)};var wP=pa,bP=function(e){for(var r=[],n=e.length,i=0;i<n;i++){var s=e.charCodeAt(i);if(s>=55296&&s<=56319&&n>i+1){var c=e.charCodeAt(i+1);c>=56320&&c<=57343&&(s=(s-55296)*1024+c-56320+65536,i+=1)}if(s<128){r.push(s);continue}if(s<2048){r.push(s>>6|192),r.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);continue}if(s>=65536&&s<=1114111){r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer};const _P=bP,EP=_s;function ga(t){this.mode=EP.BYTE,typeof t=="string"&&(t=_P(t)),this.data=new Uint8Array(t)}ga.getBitsLength=function(e){return e*8},ga.prototype.getLength=function(){return this.data.length},ga.prototype.getBitsLength=function(){return ga.getBitsLength(this.data.length)},ga.prototype.write=function(t){for(let e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)};var AP=ga;const xP=_s,SP=bn;function ma(t){this.mode=xP.KANJI,this.data=t}ma.getBitsLength=function(e){return e*13},ma.prototype.getLength=function(){return this.data.length},ma.prototype.getBitsLength=function(){return ma.getBitsLength(this.data.length)},ma.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let r=SP.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
143
+ Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};var IP=ma,Hw={exports:{}};(function(t){var e={single_source_shortest_paths:function(r,n,i){var s={},c={};c[n]=0;var l=e.PriorityQueue.make();l.push(n,0);for(var f,h,m,_,E,A,I,R,W;!l.empty();){f=l.pop(),h=f.value,_=f.cost,E=r[h]||{};for(m in E)E.hasOwnProperty(m)&&(A=E[m],I=_+A,R=c[m],W=typeof c[m]>"u",(W||R>I)&&(c[m]=I,l.push(m,I),s[m]=h))}if(typeof i<"u"&&typeof c[i]>"u"){var Y=["Could not find a path from ",n," to ",i,"."].join("");throw new Error(Y)}return s},extract_shortest_path_from_predecessor_list:function(r,n){for(var i=[],s=n;s;)i.push(s),r[s],s=r[s];return i.reverse(),i},find_path:function(r,n,i){var s=e.single_source_shortest_paths(r,n,i);return e.extract_shortest_path_from_predecessor_list(s,i)},PriorityQueue:{make:function(r){var n=e.PriorityQueue,i={},s;r=r||{};for(s in n)n.hasOwnProperty(s)&&(i[s]=n[s]);return i.queue=[],i.sorter=r.sorter||n.default_sorter,i},default_sorter:function(r,n){return r.cost-n.cost},push:function(r,n){var i={value:r,cost:n};this.queue.push(i),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=e})(Hw),function(t){const e=_s,r=vP,n=wP,i=AP,s=IP,c=xi,l=bn,f=Hw.exports;function h(Y){return unescape(encodeURIComponent(Y)).length}function m(Y,F,z){const $=[];let j;for(;(j=Y.exec(z))!==null;)$.push({data:j[0],index:j.index,mode:F,length:j[0].length});return $}function _(Y){const F=m(c.NUMERIC,e.NUMERIC,Y),z=m(c.ALPHANUMERIC,e.ALPHANUMERIC,Y);let $,j;return l.isKanjiModeEnabled()?($=m(c.BYTE,e.BYTE,Y),j=m(c.KANJI,e.KANJI,Y)):($=m(c.BYTE_KANJI,e.BYTE,Y),j=[]),F.concat(z,$,j).sort(function(g,C){return g.index-C.index}).map(function(g){return{data:g.data,mode:g.mode,length:g.length}})}function E(Y,F){switch(F){case e.NUMERIC:return r.getBitsLength(Y);case e.ALPHANUMERIC:return n.getBitsLength(Y);case e.KANJI:return s.getBitsLength(Y);case e.BYTE:return i.getBitsLength(Y)}}function A(Y){return Y.reduce(function(F,z){const $=F.length-1>=0?F[F.length-1]:null;return $&&$.mode===z.mode?(F[F.length-1].data+=z.data,F):(F.push(z),F)},[])}function I(Y){const F=[];for(let z=0;z<Y.length;z++){const $=Y[z];switch($.mode){case e.NUMERIC:F.push([$,{data:$.data,mode:e.ALPHANUMERIC,length:$.length},{data:$.data,mode:e.BYTE,length:$.length}]);break;case e.ALPHANUMERIC:F.push([$,{data:$.data,mode:e.BYTE,length:$.length}]);break;case e.KANJI:F.push([$,{data:$.data,mode:e.BYTE,length:h($.data)}]);break;case e.BYTE:F.push([{data:$.data,mode:e.BYTE,length:h($.data)}])}}return F}function R(Y,F){const z={},$={start:{}};let j=["start"];for(let P=0;P<Y.length;P++){const g=Y[P],C=[];for(let Z=0;Z<g.length;Z++){const J=g[Z],te=""+P+Z;C.push(te),z[te]={node:J,lastCount:0},$[te]={};for(let ae=0;ae<j.length;ae++){const p=j[ae];z[p]&&z[p].node.mode===J.mode?($[p][te]=E(z[p].lastCount+J.length,J.mode)-E(z[p].lastCount,J.mode),z[p].lastCount+=J.length):(z[p]&&(z[p].lastCount=J.length),$[p][te]=E(J.length,J.mode)+4+e.getCharCountIndicator(J.mode,F))}}j=C}for(let P=0;P<j.length;P++)$[j[P]].end=0;return{map:$,table:z}}function W(Y,F){let z;const $=e.getBestModeForData(Y);if(z=e.from(F,$),z!==e.BYTE&&z.bit<$.bit)throw new Error('"'+Y+'" cannot be encoded with mode '+e.toString(z)+`.
144
+ Suggested mode is: `+e.toString($));switch(z===e.KANJI&&!l.isKanjiModeEnabled()&&(z=e.BYTE),z){case e.NUMERIC:return new r(Y);case e.ALPHANUMERIC:return new n(Y);case e.KANJI:return new s(Y);case e.BYTE:return new i(Y)}}t.fromArray=function(F){return F.reduce(function(z,$){return typeof $=="string"?z.push(W($,null)):$.data&&z.push(W($.data,$.mode)),z},[])},t.fromString=function(F,z){const $=_(F,l.isKanjiModeEnabled()),j=I($),P=R(j,z),g=f.find_path(P.map,"start","end"),C=[];for(let Z=1;Z<g.length-1;Z++)C.push(P.table[g[Z]].node);return t.fromArray(A(C))},t.rawSplit=function(F){return t.fromArray(_(F,l.isKanjiModeEnabled()))}}(zw);const Au=bn,sd=vu,DP=oP,CP=aP,OP=Tw,PP=$w,od=Rw,ad=yu,MP=lP,xu=Uw,TP=jw,$P=_s,cd=zw;function NP(t,e){const r=t.size,n=PP.getPositions(e);for(let i=0;i<n.length;i++){const s=n[i][0],c=n[i][1];for(let l=-1;l<=7;l++)if(!(s+l<=-1||r<=s+l))for(let f=-1;f<=7;f++)c+f<=-1||r<=c+f||(l>=0&&l<=6&&(f===0||f===6)||f>=0&&f<=6&&(l===0||l===6)||l>=2&&l<=4&&f>=2&&f<=4?t.set(s+l,c+f,!0,!0):t.set(s+l,c+f,!1,!0))}}function RP(t){const e=t.size;for(let r=8;r<e-8;r++){const n=r%2===0;t.set(r,6,n,!0),t.set(6,r,n,!0)}}function LP(t,e){const r=OP.getPositions(e);for(let n=0;n<r.length;n++){const i=r[n][0],s=r[n][1];for(let c=-2;c<=2;c++)for(let l=-2;l<=2;l++)c===-2||c===2||l===-2||l===2||c===0&&l===0?t.set(i+c,s+l,!0,!0):t.set(i+c,s+l,!1,!0)}}function BP(t,e){const r=t.size,n=xu.getEncodedBits(e);let i,s,c;for(let l=0;l<18;l++)i=Math.floor(l/3),s=l%3+r-8-3,c=(n>>l&1)===1,t.set(i,s,c,!0),t.set(s,i,c,!0)}function ld(t,e,r){const n=t.size,i=TP.getEncodedBits(e,r);let s,c;for(s=0;s<15;s++)c=(i>>s&1)===1,s<6?t.set(s,8,c,!0):s<8?t.set(s+1,8,c,!0):t.set(n-15+s,8,c,!0),s<8?t.set(8,n-s-1,c,!0):s<9?t.set(8,15-s-1+1,c,!0):t.set(8,15-s-1,c,!0);t.set(n-8,8,1,!0)}function UP(t,e){const r=t.size;let n=-1,i=r-1,s=7,c=0;for(let l=r-1;l>0;l-=2)for(l===6&&l--;;){for(let f=0;f<2;f++)if(!t.isReserved(i,l-f)){let h=!1;c<e.length&&(h=(e[c]>>>s&1)===1),t.set(i,l-f,h),s--,s===-1&&(c++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function FP(t,e,r){const n=new DP;r.forEach(function(f){n.put(f.mode.bit,4),n.put(f.getLength(),$P.getCharCountIndicator(f.mode,t)),f.write(n)});const i=Au.getSymbolTotalCodewords(t),s=ad.getTotalCodewordsCount(t,e),c=(i-s)*8;for(n.getLengthInBits()+4<=c&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);const l=(c-n.getLengthInBits())/8;for(let f=0;f<l;f++)n.put(f%2?17:236,8);return jP(n,t,e)}function jP(t,e,r){const n=Au.getSymbolTotalCodewords(e),i=ad.getTotalCodewordsCount(e,r),s=n-i,c=ad.getBlocksCount(e,r),l=n%c,f=c-l,h=Math.floor(n/c),m=Math.floor(s/c),_=m+1,E=h-m,A=new MP(E);let I=0;const R=new Array(c),W=new Array(c);let Y=0;const F=new Uint8Array(t.buffer);for(let g=0;g<c;g++){const C=g<f?m:_;R[g]=F.slice(I,I+C),W[g]=A.encode(R[g]),I+=C,Y=Math.max(Y,C)}const z=new Uint8Array(n);let $=0,j,P;for(j=0;j<Y;j++)for(P=0;P<c;P++)j<R[P].length&&(z[$++]=R[P][j]);for(j=0;j<E;j++)for(P=0;P<c;P++)z[$++]=W[P][j];return z}function kP(t,e,r,n){let i;if(Array.isArray(t))i=cd.fromArray(t);else if(typeof t=="string"){let h=e;if(!h){const m=cd.rawSplit(t);h=xu.getBestVersionForData(m,r)}i=cd.fromString(t,h||40)}else throw new Error("Invalid data");const s=xu.getBestVersionForData(i,r);if(!s)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=s;else if(e<s)throw new Error(`
135
145
  The chosen QR Code version cannot contain this amount of data.
136
- Minimum version required to store current data is: `+a+`.
137
- `);const c=HD(e,t,i),u=_c.getSymbolSize(e),f=new RD(u);return FD(f,e),BD(f),kD(f,e),Mh(f,t,0),e>=7&&qD(f,e),zD(f,c),isNaN(n)&&(n=Rh.getBestMask(f,Mh.bind(null,f,t))),Rh.applyMask(n,f),Mh(f,t,n),{modules:f,version:e,errorCorrectionLevel:t,maskPattern:n,segments:i}}Xg.create=function(e,t){if(typeof e>"u"||e==="")throw new Error("No input text");let n=Th.M,i,a;return typeof t<"u"&&(n=Th.from(t.errorCorrectionLevel,Th.M),i=Ec.from(t.version),a=Rh.from(t.maskPattern),t.toSJISFunc&&_c.setToSJISFunction(t.toSJISFunc)),KD(e,i,n,a)};var pm={},Uh={};(function(r){function e(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let n=t.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+t);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(a){return[a,a]}))),n.length===6&&n.push("F","F");const i=parseInt(n.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+n.slice(0,6).join("")}}r.getOptions=function(n){n||(n={}),n.color||(n.color={});const i=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,a=n.width&&n.width>=21?n.width:void 0,c=n.scale||4;return{width:a,scale:a?4:c,margin:i,color:{dark:e(n.color.dark||"#000000ff"),light:e(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},r.getScale=function(n,i){return i.width&&i.width>=n+i.margin*2?i.width/(n+i.margin*2):i.scale},r.getImageWidth=function(n,i){const a=r.getScale(n,i);return Math.floor((n+i.margin*2)*a)},r.qrToImageData=function(n,i,a){const c=i.modules.size,u=i.modules.data,f=r.getScale(c,a),h=Math.floor((c+a.margin*2)*f),m=a.margin*f,w=[a.color.light,a.color.dark];for(let y=0;y<h;y++)for(let _=0;_<h;_++){let S=(y*h+_)*4,P=a.color.light;if(y>=m&&_>=m&&y<h-m&&_<h-m){const j=Math.floor((y-m)/f),U=Math.floor((_-m)/f);P=w[u[j*c+U]?1:0]}n[S++]=P.r,n[S++]=P.g,n[S++]=P.b,n[S]=P.a}}})(Uh),function(r){const e=Uh;function t(i,a,c){i.clearRect(0,0,a.width,a.height),a.style||(a.style={}),a.height=c,a.width=c,a.style.height=c+"px",a.style.width=c+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}r.render=function(a,c,u){let f=u,h=c;typeof f>"u"&&(!c||!c.getContext)&&(f=c,c=void 0),c||(h=n()),f=e.getOptions(f);const m=e.getImageWidth(a.modules.size,f),w=h.getContext("2d"),y=w.createImageData(m,m);return e.qrToImageData(y.data,a,f),t(w,h,m),w.putImageData(y,0,0),h},r.renderToDataURL=function(a,c,u){let f=u;typeof f>"u"&&(!c||!c.getContext)&&(f=c,c=void 0),f||(f={});const h=r.render(a,c,f),m=f.type||"image/png",w=f.rendererOpts||{};return h.toDataURL(m,w.quality)}}(pm);var gm={};const VD=Uh;function mm(r,e){const t=r.a/255,n=e+'="'+r.hex+'"';return t<1?n+" "+e+'-opacity="'+t.toFixed(2).slice(1)+'"':n}function jh(r,e,t){let n=r+e;return typeof t<"u"&&(n+=" "+t),n}function GD(r,e,t){let n="",i=0,a=!1,c=0;for(let u=0;u<r.length;u++){const f=Math.floor(u%e),h=Math.floor(u/e);!f&&!a&&(a=!0),r[u]?(c++,u>0&&f>0&&r[u-1]||(n+=a?jh("M",f+t,.5+h+t):jh("m",i,0),i=0,a=!1),f+1<e&&r[u+1]||(n+=jh("h",c),c=0)):i++}return n}gm.render=function(e,t,n){const i=VD.getOptions(t),a=e.modules.size,c=e.modules.data,u=a+i.margin*2,f=i.color.light.a?"<path "+mm(i.color.light,"fill")+' d="M0 0h'+u+"v"+u+'H0z"/>':"",h="<path "+mm(i.color.dark,"stroke")+' d="'+GD(c,a,i.margin)+'"/>',m='viewBox="0 0 '+u+" "+u+'"',y='<svg xmlns="http://www.w3.org/2000/svg" '+(i.width?'width="'+i.width+'" height="'+i.width+'" ':"")+m+' shape-rendering="crispEdges">'+f+h+`</svg>
138
- `;return typeof n=="function"&&n(null,y),y};const YD=lD,Fh=Xg,vm=pm,ZD=gm;function Bh(r,e,t,n,i){const a=[].slice.call(arguments,1),c=a.length,u=typeof a[c-1]=="function";if(!u&&!YD())throw new Error("Callback required as last argument");if(u){if(c<2)throw new Error("Too few arguments provided");c===2?(i=t,t=e,e=n=void 0):c===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=t,t=e,e=void 0))}else{if(c<1)throw new Error("Too few arguments provided");return c===1?(t=e,e=n=void 0):c===2&&!e.getContext&&(n=t,t=e,e=void 0),new Promise(function(f,h){try{const m=Fh.create(t,n);f(r(m,e,n))}catch(m){h(m)}})}try{const f=Fh.create(t,n);i(null,r(f,e,n))}catch(f){i(f)}}Jo.create=Fh.create,Jo.toCanvas=Bh.bind(null,vm.render),Jo.toDataURL=Bh.bind(null,vm.renderToDataURL),Jo.toString=Bh.bind(null,function(r,e,t){return ZD.render(r,t)});var JD=Object.defineProperty,ym=Object.getOwnPropertySymbols,QD=Object.prototype.hasOwnProperty,XD=Object.prototype.propertyIsEnumerable,wm=(r,e,t)=>e in r?JD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,kh=(r,e)=>{for(var t in e||(e={}))QD.call(e,t)&&wm(r,t,e[t]);if(ym)for(var t of ym(e))XD.call(e,t)&&wm(r,t,e[t]);return r};function eS(){var r;const e=(r=ui.state.themeMode)!=null?r:"dark",t={light:{foreground:{1:"rgb(20,20,20)",2:"rgb(121,134,134)",3:"rgb(158,169,169)"},background:{1:"rgb(255,255,255)",2:"rgb(241,243,243)",3:"rgb(228,231,231)"},overlay:"rgba(0,0,0,0.1)"},dark:{foreground:{1:"rgb(228,231,231)",2:"rgb(148,158,158)",3:"rgb(110,119,119)"},background:{1:"rgb(20,20,20)",2:"rgb(39,42,42)",3:"rgb(59,64,64)"},overlay:"rgba(255,255,255,0.1)"}}[e];return{"--wcm-color-fg-1":t.foreground[1],"--wcm-color-fg-2":t.foreground[2],"--wcm-color-fg-3":t.foreground[3],"--wcm-color-bg-1":t.background[1],"--wcm-color-bg-2":t.background[2],"--wcm-color-bg-3":t.background[3],"--wcm-color-overlay":t.overlay}}function bm(){return{"--wcm-accent-color":"#3396FF","--wcm-accent-fill-color":"#FFFFFF","--wcm-z-index":"89","--wcm-background-color":"#3396FF","--wcm-background-border-radius":"8px","--wcm-container-border-radius":"30px","--wcm-wallet-icon-border-radius":"15px","--wcm-wallet-icon-large-border-radius":"30px","--wcm-wallet-icon-small-border-radius":"7px","--wcm-input-border-radius":"28px","--wcm-button-border-radius":"10px","--wcm-notification-border-radius":"36px","--wcm-secondary-button-border-radius":"28px","--wcm-icon-button-border-radius":"50%","--wcm-button-hover-highlight-border-radius":"10px","--wcm-text-big-bold-size":"20px","--wcm-text-big-bold-weight":"600","--wcm-text-big-bold-line-height":"24px","--wcm-text-big-bold-letter-spacing":"-0.03em","--wcm-text-big-bold-text-transform":"none","--wcm-text-xsmall-bold-size":"10px","--wcm-text-xsmall-bold-weight":"700","--wcm-text-xsmall-bold-line-height":"12px","--wcm-text-xsmall-bold-letter-spacing":"0.02em","--wcm-text-xsmall-bold-text-transform":"uppercase","--wcm-text-xsmall-regular-size":"12px","--wcm-text-xsmall-regular-weight":"600","--wcm-text-xsmall-regular-line-height":"14px","--wcm-text-xsmall-regular-letter-spacing":"-0.03em","--wcm-text-xsmall-regular-text-transform":"none","--wcm-text-small-thin-size":"14px","--wcm-text-small-thin-weight":"500","--wcm-text-small-thin-line-height":"16px","--wcm-text-small-thin-letter-spacing":"-0.03em","--wcm-text-small-thin-text-transform":"none","--wcm-text-small-regular-size":"14px","--wcm-text-small-regular-weight":"600","--wcm-text-small-regular-line-height":"16px","--wcm-text-small-regular-letter-spacing":"-0.03em","--wcm-text-small-regular-text-transform":"none","--wcm-text-medium-regular-size":"16px","--wcm-text-medium-regular-weight":"600","--wcm-text-medium-regular-line-height":"20px","--wcm-text-medium-regular-letter-spacing":"-0.03em","--wcm-text-medium-regular-text-transform":"none","--wcm-font-family":"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif","--wcm-font-feature-settings":"'tnum' on, 'lnum' on, 'case' on","--wcm-success-color":"rgb(38,181,98)","--wcm-error-color":"rgb(242, 90, 103)","--wcm-overlay-background-color":"rgba(0, 0, 0, 0.3)","--wcm-overlay-backdrop-filter":"none"}}const rt={getPreset(r){return bm()[r]},setTheme(){const r=document.querySelector(":root"),{themeVariables:e}=ui.state;if(r){const t=kh(kh(kh({},eS()),bm()),e);Object.entries(t).forEach(([n,i])=>r.style.setProperty(n,i))}},globalCss:lt`*,::after,::before{margin:0;padding:0;box-sizing:border-box;font-style:normal;text-rendering:optimizeSpeed;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent;backface-visibility:hidden}button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:relative;border:none;background-color:transparent;transition:all .2s ease}@media (hover:hover) and (pointer:fine){button:active{transition:all .1s ease;transform:scale(.93)}}button::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;transition:background-color,.2s ease}button:disabled{cursor:not-allowed}button svg,button wcm-text{position:relative;z-index:1}input{border:none;outline:0;appearance:none}img{display:block}::selection{color:var(--wcm-accent-fill-color);background:var(--wcm-accent-color)}`},tS=lt`button{border-radius:var(--wcm-secondary-button-border-radius);height:28px;padding:0 10px;background-color:var(--wcm-accent-color)}button path{fill:var(--wcm-accent-fill-color)}button::after{border-radius:inherit;border:1px solid var(--wcm-color-overlay)}button:disabled::after{background-color:transparent}.wcm-icon-left svg{margin-right:5px}.wcm-icon-right svg{margin-left:5px}button:active::after{background-color:var(--wcm-color-overlay)}.wcm-ghost,.wcm-ghost:active::after,.wcm-outline{background-color:transparent}.wcm-ghost:active{opacity:.5}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}.wcm-ghost:hover::after{background-color:transparent}.wcm-ghost:hover{opacity:.5}}button:disabled{background-color:var(--wcm-color-bg-3);pointer-events:none}.wcm-ghost::after{border-color:transparent}.wcm-ghost path{fill:var(--wcm-color-fg-2)}.wcm-outline path{fill:var(--wcm-accent-color)}.wcm-outline:disabled{background-color:transparent;opacity:.5}`;var rS=Object.defineProperty,nS=Object.getOwnPropertyDescriptor,qs=(r,e,t,n)=>{for(var i=n>1?void 0:n?nS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&rS(e,t,i),i};let mi=class extends Ye{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const r={"wcm-icon-left":this.iconLeft!==void 0,"wcm-icon-right":this.iconRight!==void 0,"wcm-ghost":this.variant==="ghost","wcm-outline":this.variant==="outline"};let e="inverse";return this.variant==="ghost"&&(e="secondary"),this.variant==="outline"&&(e="accent"),he`<button class="${qn(r)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${e}"><slot></slot></wcm-text>${this.iconRight}</button>`}};mi.styles=[rt.globalCss,tS],qs([Be({type:Boolean})],mi.prototype,"disabled",2),qs([Be()],mi.prototype,"iconLeft",2),qs([Be()],mi.prototype,"iconRight",2),qs([Be()],mi.prototype,"onClick",2),qs([Be()],mi.prototype,"variant",2),mi=qs([ot("wcm-button")],mi);const iS=lt`:host{display:inline-block}button{padding:0 15px 1px;height:40px;border-radius:var(--wcm-button-border-radius);color:var(--wcm-accent-fill-color);background-color:var(--wcm-accent-color)}button::after{content:'';top:0;bottom:0;left:0;right:0;position:absolute;background-color:transparent;border-radius:inherit;transition:background-color .2s ease;border:1px solid var(--wcm-color-overlay)}button:active::after{background-color:var(--wcm-color-overlay)}button:disabled{padding-bottom:0;background-color:var(--wcm-color-bg-3);color:var(--wcm-color-fg-3)}.wcm-secondary{color:var(--wcm-accent-color);background-color:transparent}.wcm-secondary::after{display:none}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}}`;var sS=Object.defineProperty,oS=Object.getOwnPropertyDescriptor,qh=(r,e,t,n)=>{for(var i=n>1?void 0:n?oS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&sS(e,t,i),i};let ta=class extends Ye{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const r={"wcm-secondary":this.variant==="secondary"};return he`<button ?disabled="${this.disabled}" class="${qn(r)}"><slot></slot></button>`}};ta.styles=[rt.globalCss,iS],qh([Be({type:Boolean})],ta.prototype,"disabled",2),qh([Be()],ta.prototype,"variant",2),ta=qh([ot("wcm-button-big")],ta);const aS=lt`:host{background-color:var(--wcm-color-bg-2);border-top:1px solid var(--wcm-color-bg-3)}div{padding:10px 20px;display:inherit;flex-direction:inherit;align-items:inherit;width:inherit;justify-content:inherit}`;var cS=Object.defineProperty,lS=Object.getOwnPropertyDescriptor,uS=(r,e,t,n)=>{for(var i=n>1?void 0:n?lS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&cS(e,t,i),i};let zh=class extends Ye{render(){return he`<div><slot></slot></div>`}};zh.styles=[rt.globalCss,aS],zh=uS([ot("wcm-info-footer")],zh);const ht={CROSS_ICON:Lt`<svg width="12" height="12" viewBox="0 0 12 12"><path d="M9.94 11A.75.75 0 1 0 11 9.94L7.414 6.353a.5.5 0 0 1 0-.708L11 2.061A.75.75 0 1 0 9.94 1L6.353 4.586a.5.5 0 0 1-.708 0L2.061 1A.75.75 0 0 0 1 2.06l3.586 3.586a.5.5 0 0 1 0 .708L1 9.939A.75.75 0 1 0 2.06 11l3.586-3.586a.5.5 0 0 1 .708 0L9.939 11Z" fill="#fff"/></svg>`,WALLET_CONNECT_LOGO:Lt`<svg width="178" height="29" viewBox="0 0 178 29" id="wcm-wc-logo"><path d="M10.683 7.926c5.284-5.17 13.85-5.17 19.134 0l.636.623a.652.652 0 0 1 0 .936l-2.176 2.129a.343.343 0 0 1-.478 0l-.875-.857c-3.686-3.607-9.662-3.607-13.348 0l-.937.918a.343.343 0 0 1-.479 0l-2.175-2.13a.652.652 0 0 1 0-.936l.698-.683Zm23.633 4.403 1.935 1.895a.652.652 0 0 1 0 .936l-8.73 8.543a.687.687 0 0 1-.956 0L20.37 17.64a.172.172 0 0 0-.239 0l-6.195 6.063a.687.687 0 0 1-.957 0l-8.73-8.543a.652.652 0 0 1 0-.936l1.936-1.895a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .239 0l6.195-6.064a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .24 0l6.195-6.064a.687.687 0 0 1 .956 0ZM48.093 20.948l2.338-9.355c.139-.515.258-1.07.416-1.942.12.872.258 1.427.357 1.942l2.022 9.355h4.181l3.528-13.874h-3.21l-1.943 8.523a24.825 24.825 0 0 0-.456 2.457c-.158-.931-.317-1.625-.495-2.438l-1.883-8.542h-4.201l-2.042 8.542a41.204 41.204 0 0 0-.475 2.438 41.208 41.208 0 0 0-.476-2.438l-1.903-8.542h-3.349l3.508 13.874h4.083ZM63.33 21.304c1.585 0 2.596-.654 3.11-1.605-.059.297-.078.595-.078.892v.357h2.655V15.22c0-2.735-1.248-4.32-4.3-4.32-2.636 0-4.36 1.466-4.52 3.487h2.914c.1-.891.734-1.426 1.705-1.426.911 0 1.407.515 1.407 1.11 0 .435-.258.693-1.03.792l-1.388.159c-2.061.257-3.825 1.01-3.825 3.19 0 1.982 1.645 3.092 3.35 3.092Zm.891-2.041c-.773 0-1.348-.436-1.348-1.19 0-.733.655-1.09 1.645-1.268l.674-.119c.575-.118.892-.218 1.09-.396v.912c0 1.228-.892 2.06-2.06 2.06ZM70.398 7.074v13.874h2.874V7.074h-2.874ZM74.934 7.074v13.874h2.874V7.074h-2.874ZM84.08 21.304c2.735 0 4.5-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922H81.92ZM94.92 21.146c.633 0 1.248-.1 1.525-.179v-2.18c-.218.04-.475.06-.693.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.338v-2.24h-2.338V7.788H91.47v3.448H89.37v2.24h2.1v4.201c0 2.3 1.15 3.469 3.45 3.469ZM104.62 21.304c3.924 0 6.302-2.299 6.599-5.608h-3.111c-.238 1.803-1.506 3.032-3.369 3.032-2.2 0-3.746-1.784-3.746-4.796 0-2.953 1.605-4.638 3.805-4.638 1.883 0 2.953 1.15 3.171 2.834h3.191c-.317-3.448-2.854-5.41-6.342-5.41-3.984 0-7.036 2.695-7.036 7.214 0 4.677 2.676 7.372 6.838 7.372ZM117.449 21.304c2.993 0 5.114-1.882 5.114-5.172 0-3.23-2.121-5.233-5.114-5.233-2.972 0-5.093 2.002-5.093 5.233 0 3.29 2.101 5.172 5.093 5.172Zm0-2.22c-1.327 0-2.18-1.09-2.18-2.952 0-1.903.892-2.973 2.18-2.973 1.308 0 2.2 1.07 2.2 2.973 0 1.862-.872 2.953-2.2 2.953ZM126.569 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.229-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM137.464 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.228-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM149.949 21.304c2.735 0 4.499-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922h-3.984ZM160.876 21.304c3.013 0 4.658-1.645 4.975-4.201h-2.874c-.099 1.07-.713 1.982-2.001 1.982-1.309 0-2.2-1.21-2.2-2.993 0-1.942 1.03-2.933 2.259-2.933 1.209 0 1.803.872 1.883 1.882h2.873c-.218-2.358-1.823-4.142-4.776-4.142-2.874 0-5.153 1.903-5.153 5.193 0 3.25 1.923 5.212 5.014 5.212ZM172.067 21.146c.634 0 1.248-.1 1.526-.179v-2.18c-.218.04-.476.06-.694.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.339v-2.24h-2.339V7.788h-2.854v3.448h-2.1v2.24h2.1v4.201c0 2.3 1.15 3.469 3.449 3.469Z" fill="#fff"/></svg>`,WALLET_CONNECT_ICON:Lt`<svg width="28" height="20" viewBox="0 0 28 20"><g clip-path="url(#a)"><path d="M7.386 6.482c3.653-3.576 9.575-3.576 13.228 0l.44.43a.451.451 0 0 1 0 .648L19.55 9.033a.237.237 0 0 1-.33 0l-.606-.592c-2.548-2.496-6.68-2.496-9.228 0l-.648.634a.237.237 0 0 1-.33 0L6.902 7.602a.451.451 0 0 1 0-.647l.483-.473Zm16.338 3.046 1.339 1.31a.451.451 0 0 1 0 .648l-6.035 5.909a.475.475 0 0 1-.662 0L14.083 13.2a.119.119 0 0 0-.166 0l-4.283 4.194a.475.475 0 0 1-.662 0l-6.035-5.91a.451.451 0 0 1 0-.647l1.338-1.31a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0Z" fill="#000000"/></g><defs><clipPath id="a"><path fill="#ffffff" d="M0 0h28v20H0z"/></clipPath></defs></svg>`,WALLET_CONNECT_ICON_COLORED:Lt`<svg width="96" height="96" fill="none"><path fill="#fff" d="M25.322 33.597c12.525-12.263 32.83-12.263 45.355 0l1.507 1.476a1.547 1.547 0 0 1 0 2.22l-5.156 5.048a.814.814 0 0 1-1.134 0l-2.074-2.03c-8.737-8.555-22.903-8.555-31.64 0l-2.222 2.175a.814.814 0 0 1-1.134 0l-5.156-5.049a1.547 1.547 0 0 1 0-2.22l1.654-1.62Zm56.019 10.44 4.589 4.494a1.547 1.547 0 0 1 0 2.22l-20.693 20.26a1.628 1.628 0 0 1-2.267 0L48.283 56.632a.407.407 0 0 0-.567 0L33.03 71.012a1.628 1.628 0 0 1-2.268 0L10.07 50.75a1.547 1.547 0 0 1 0-2.22l4.59-4.494a1.628 1.628 0 0 1 2.267 0l14.687 14.38c.156.153.41.153.567 0l14.685-14.38a1.628 1.628 0 0 1 2.268 0l14.687 14.38c.156.153.41.153.567 0l14.686-14.38a1.628 1.628 0 0 1 2.268 0Z"/><path stroke="#000" d="M25.672 33.954c12.33-12.072 32.325-12.072 44.655 0l1.508 1.476a1.047 1.047 0 0 1 0 1.506l-5.157 5.048a.314.314 0 0 1-.434 0l-2.074-2.03c-8.932-8.746-23.409-8.746-32.34 0l-2.222 2.174a.314.314 0 0 1-.434 0l-5.157-5.048a1.047 1.047 0 0 1 0-1.506l1.655-1.62Zm55.319 10.44 4.59 4.494a1.047 1.047 0 0 1 0 1.506l-20.694 20.26a1.128 1.128 0 0 1-1.568 0l-14.686-14.38a.907.907 0 0 0-1.267 0L32.68 70.655a1.128 1.128 0 0 1-1.568 0L10.42 50.394a1.047 1.047 0 0 1 0-1.506l4.59-4.493a1.128 1.128 0 0 1 1.567 0l14.687 14.379a.907.907 0 0 0 1.266 0l-.35-.357.35.357 14.686-14.38a1.128 1.128 0 0 1 1.568 0l14.687 14.38a.907.907 0 0 0 1.267 0l14.686-14.38a1.128 1.128 0 0 1 1.568 0Z"/></svg>`,BACK_ICON:Lt`<svg width="10" height="18" viewBox="0 0 10 18"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.735.179a.75.75 0 0 1 .087 1.057L2.92 8.192a1.25 1.25 0 0 0 0 1.617l5.902 6.956a.75.75 0 1 1-1.144.97L1.776 10.78a2.75 2.75 0 0 1 0-3.559L7.678.265A.75.75 0 0 1 8.735.18Z" fill="#fff"/></svg>`,COPY_ICON:Lt`<svg width="24" height="24" fill="none"><path fill="#fff" fill-rule="evenodd" d="M7.01 7.01c.03-1.545.138-2.5.535-3.28A5 5 0 0 1 9.73 1.545C10.8 1 12.2 1 15 1c2.8 0 4.2 0 5.27.545a5 5 0 0 1 2.185 2.185C23 4.8 23 6.2 23 9c0 2.8 0 4.2-.545 5.27a5 5 0 0 1-2.185 2.185c-.78.397-1.735.505-3.28.534l-.001.01c-.03 1.54-.138 2.493-.534 3.27a5 5 0 0 1-2.185 2.186C13.2 23 11.8 23 9 23c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C1 19.2 1 17.8 1 15c0-2.8 0-4.2.545-5.27A5 5 0 0 1 3.73 7.545C4.508 7.149 5.46 7.04 7 7.01h.01ZM15 15.5c-1.425 0-2.403-.001-3.162-.063-.74-.06-1.139-.172-1.427-.319a3.5 3.5 0 0 1-1.53-1.529c-.146-.288-.257-.686-.318-1.427C8.501 11.403 8.5 10.425 8.5 9c0-1.425.001-2.403.063-3.162.06-.74.172-1.139.318-1.427a3.5 3.5 0 0 1 1.53-1.53c.288-.146.686-.257 1.427-.318.759-.062 1.737-.063 3.162-.063 1.425 0 2.403.001 3.162.063.74.06 1.139.172 1.427.318a3.5 3.5 0 0 1 1.53 1.53c.146.288.257.686.318 1.427.062.759.063 1.737.063 3.162 0 1.425-.001 2.403-.063 3.162-.06.74-.172 1.139-.319 1.427a3.5 3.5 0 0 1-1.529 1.53c-.288.146-.686.257-1.427.318-.759.062-1.737.063-3.162.063ZM7 8.511c-.444.009-.825.025-1.162.052-.74.06-1.139.172-1.427.318a3.5 3.5 0 0 0-1.53 1.53c-.146.288-.257.686-.318 1.427-.062.759-.063 1.737-.063 3.162 0 1.425.001 2.403.063 3.162.06.74.172 1.139.318 1.427a3.5 3.5 0 0 0 1.53 1.53c.288.146.686.257 1.427.318.759.062 1.737.063 3.162.063 1.425 0 2.403-.001 3.162-.063.74-.06 1.139-.172 1.427-.319a3.5 3.5 0 0 0 1.53-1.53c.146-.287.257-.685.318-1.426.027-.337.043-.718.052-1.162H15c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C7 13.2 7 11.8 7 9v-.489Z" clip-rule="evenodd"/></svg>`,RETRY_ICON:Lt`<svg width="15" height="16" viewBox="0 0 15 16"><path d="M6.464 2.03A.75.75 0 0 0 5.403.97L2.08 4.293a1 1 0 0 0 0 1.414L5.403 9.03a.75.75 0 0 0 1.06-1.06L4.672 6.177a.25.25 0 0 1 .177-.427h2.085a4 4 0 1 1-3.93 4.746c-.077-.407-.405-.746-.82-.746-.414 0-.755.338-.7.748a5.501 5.501 0 1 0 5.45-6.248H4.848a.25.25 0 0 1-.177-.427L6.464 2.03Z" fill="#fff"/></svg>`,DESKTOP_ICON:Lt`<svg width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 5.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C2.204 1 3.13 1 4.98 1h6.04c1.85 0 2.775 0 3.466.394a3 3 0 0 1 1.12 1.12C16 3.204 16 4.13 16 5.98v1.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C13.796 12 12.87 12 11.02 12H4.98c-1.85 0-2.775 0-3.466-.394a3 3 0 0 1-1.12-1.12C0 9.796 0 8.87 0 7.02V5.98ZM4.98 2.5h6.04c.953 0 1.568.001 2.034.043.446.04.608.108.69.154a1.5 1.5 0 0 1 .559.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033v1.04c0 .952-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.046-.243.114-.69.154-.466.042-1.08.043-2.033.043H4.98c-.952 0-1.568-.001-2.034-.043-.446-.04-.608-.108-.69-.154a1.5 1.5 0 0 1-.559-.56c-.046-.08-.114-.243-.154-.69-.042-.465-.043-1.08-.043-2.033V5.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.046.243-.114.69-.154.465-.042 1.08-.043 2.033-.043Z" fill="#fff"/><path d="M4 14.25a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,MOBILE_ICON:Lt`<svg width="16" height="16" viewBox="0 0 16 16"><path d="M6.75 5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M3 4.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C5.204 0 6.136 0 8 0s2.795 0 3.486.394a3 3 0 0 1 1.12 1.12C13 2.204 13 3.13 13 4.98v6.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C10.796 16 9.864 16 8 16s-2.795 0-3.486-.394a3 3 0 0 1-1.12-1.12C3 13.796 3 12.87 3 11.02V4.98Zm8.5 0v6.04c0 .953-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.045-.242.113-.693.154-.47.042-1.091.043-2.05.043-.959 0-1.58-.001-2.05-.043-.45-.04-.613-.109-.693-.154a1.5 1.5 0 0 1-.56-.56c-.046-.08-.114-.243-.154-.69-.042-.466-.043-1.08-.043-2.033V4.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.045.243-.113.693-.154C6.42 1.501 7.041 1.5 8 1.5c.959 0 1.58.001 2.05.043.45.04.613.109.693.154a1.5 1.5 0 0 1 .56.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033Z" fill="#fff"/></svg>`,ARROW_DOWN_ICON:Lt`<svg width="14" height="14" viewBox="0 0 14 14"><path d="M2.28 7.47a.75.75 0 0 0-1.06 1.06l5.25 5.25a.75.75 0 0 0 1.06 0l5.25-5.25a.75.75 0 0 0-1.06-1.06l-3.544 3.543a.25.25 0 0 1-.426-.177V.75a.75.75 0 0 0-1.5 0v10.086a.25.25 0 0 1-.427.176L2.28 7.47Z" fill="#fff"/></svg>`,ARROW_UP_RIGHT_ICON:Lt`<svg width="15" height="14" fill="none"><path d="M4.5 1.75A.75.75 0 0 1 5.25 1H12a1.5 1.5 0 0 1 1.5 1.5v6.75a.75.75 0 0 1-1.5 0V4.164a.25.25 0 0 0-.427-.176L4.061 11.5A.75.75 0 0 1 3 10.44l7.513-7.513a.25.25 0 0 0-.177-.427H5.25a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,ARROW_RIGHT_ICON:Lt`<svg width="6" height="14" viewBox="0 0 6 14"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.181 1.099a.75.75 0 0 1 1.024.279l2.433 4.258a2.75 2.75 0 0 1 0 2.729l-2.433 4.257a.75.75 0 1 1-1.303-.744L4.335 7.62a1.25 1.25 0 0 0 0-1.24L1.902 2.122a.75.75 0 0 1 .28-1.023Z" fill="#fff"/></svg>`,QRCODE_ICON:Lt`<svg width="25" height="24" viewBox="0 0 25 24"><path d="M23.748 9a.748.748 0 0 0 .748-.752c-.018-2.596-.128-4.07-.784-5.22a6 6 0 0 0-2.24-2.24c-1.15-.656-2.624-.766-5.22-.784a.748.748 0 0 0-.752.748c0 .414.335.749.748.752 1.015.007 1.82.028 2.494.088.995.09 1.561.256 1.988.5.7.398 1.28.978 1.679 1.678.243.427.41.993.498 1.988.061.675.082 1.479.09 2.493a.753.753 0 0 0 .75.749ZM3.527.788C4.677.132 6.152.022 8.747.004A.748.748 0 0 1 9.5.752a.753.753 0 0 1-.749.752c-1.014.007-1.818.028-2.493.088-.995.09-1.561.256-1.988.5-.7.398-1.28.978-1.679 1.678-.243.427-.41.993-.499 1.988-.06.675-.081 1.479-.088 2.493A.753.753 0 0 1 1.252 9a.748.748 0 0 1-.748-.752c.018-2.596.128-4.07.784-5.22a6 6 0 0 1 2.24-2.24ZM1.252 15a.748.748 0 0 0-.748.752c.018 2.596.128 4.07.784 5.22a6 6 0 0 0 2.24 2.24c1.15.656 2.624.766 5.22.784a.748.748 0 0 0 .752-.748.753.753 0 0 0-.749-.752c-1.014-.007-1.818-.028-2.493-.089-.995-.089-1.561-.255-1.988-.498a4.5 4.5 0 0 1-1.679-1.68c-.243-.426-.41-.992-.499-1.987-.06-.675-.081-1.479-.088-2.493A.753.753 0 0 0 1.252 15ZM22.996 15.749a.753.753 0 0 1 .752-.749c.415 0 .751.338.748.752-.018 2.596-.128 4.07-.784 5.22a6 6 0 0 1-2.24 2.24c-1.15.656-2.624.766-5.22.784a.748.748 0 0 1-.752-.748c0-.414.335-.749.748-.752 1.015-.007 1.82-.028 2.494-.089.995-.089 1.561-.255 1.988-.498a4.5 4.5 0 0 0 1.679-1.68c.243-.426.41-.992.498-1.987.061-.675.082-1.479.09-2.493Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7 4a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 11h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 4H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1ZM13.5 6.5A2.5 2.5 0 0 1 16 4h2a2.5 2.5 0 0 1 2.5 2.5v2A2.5 2.5 0 0 1 18 11h-2a2.5 2.5 0 0 1-2.5-2.5v-2Zm2.5-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1ZM7 13a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 20h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 13H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1Z" fill="#fff"/><path d="M13.5 15.5c0-.465 0-.697.038-.89a2 2 0 0 1 1.572-1.572C15.303 13 15.535 13 16 13v2.5h-2.5ZM18 13c.465 0 .697 0 .89.038a2 2 0 0 1 1.572 1.572c.038.193.038.425.038.89H18V13ZM18 17.5h2.5c0 .465 0 .697-.038.89a2 2 0 0 1-1.572 1.572C18.697 20 18.465 20 18 20v-2.5ZM13.5 17.5H16V20c-.465 0-.697 0-.89-.038a2 2 0 0 1-1.572-1.572c-.038-.193-.038-.425-.038-.89Z" fill="#fff"/></svg>`,SCAN_ICON:Lt`<svg width="16" height="16" fill="none"><path fill="#fff" d="M10 15.216c0 .422.347.763.768.74 1.202-.064 2.025-.222 2.71-.613a5.001 5.001 0 0 0 1.865-1.866c.39-.684.549-1.507.613-2.709a.735.735 0 0 0-.74-.768.768.768 0 0 0-.76.732c-.009.157-.02.306-.032.447-.073.812-.206 1.244-.384 1.555-.31.545-.761.996-1.306 1.306-.311.178-.743.311-1.555.384-.141.013-.29.023-.447.032a.768.768 0 0 0-.732.76ZM10 .784c0 .407.325.737.732.76.157.009.306.02.447.032.812.073 1.244.206 1.555.384a3.5 3.5 0 0 1 1.306 1.306c.178.311.311.743.384 1.555.013.142.023.29.032.447a.768.768 0 0 0 .76.732.734.734 0 0 0 .74-.768c-.064-1.202-.222-2.025-.613-2.71A5 5 0 0 0 13.477.658c-.684-.39-1.507-.549-2.709-.613a.735.735 0 0 0-.768.74ZM5.232.044A.735.735 0 0 1 6 .784a.768.768 0 0 1-.732.76c-.157.009-.305.02-.447.032-.812.073-1.244.206-1.555.384A3.5 3.5 0 0 0 1.96 3.266c-.178.311-.311.743-.384 1.555-.013.142-.023.29-.032.447A.768.768 0 0 1 .784 6a.735.735 0 0 1-.74-.768c.064-1.202.222-2.025.613-2.71A5 5 0 0 1 2.523.658C3.207.267 4.03.108 5.233.044ZM5.268 14.456a.768.768 0 0 1 .732.76.734.734 0 0 1-.768.74c-1.202-.064-2.025-.222-2.71-.613a5 5 0 0 1-1.865-1.866c-.39-.684-.549-1.507-.613-2.709A.735.735 0 0 1 .784 10c.407 0 .737.325.76.732.009.157.02.306.032.447.073.812.206 1.244.384 1.555a3.5 3.5 0 0 0 1.306 1.306c.311.178.743.311 1.555.384.142.013.29.023.447.032Z"/></svg>`,CHECKMARK_ICON:Lt`<svg width="13" height="12" viewBox="0 0 13 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.155.132a.75.75 0 0 1 .232 1.035L5.821 11.535a1 1 0 0 1-1.626.09L.665 7.21a.75.75 0 1 1 1.17-.937L4.71 9.867a.25.25 0 0 0 .406-.023L11.12.364a.75.75 0 0 1 1.035-.232Z" fill="#fff"/></svg>`,SEARCH_ICON:Lt`<svg width="20" height="21"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.432 13.992c-.354-.353-.91-.382-1.35-.146a5.5 5.5 0 1 1 2.265-2.265c-.237.441-.208.997.145 1.35l3.296 3.296a.75.75 0 1 1-1.06 1.061l-3.296-3.296Zm.06-5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z" fill="#949E9E"/></svg>`,WALLET_PLACEHOLDER:Lt`<svg width="60" height="60" fill="none" viewBox="0 0 60 60"><g clip-path="url(#q)"><path id="wallet-placeholder-fill" fill="#fff" d="M0 24.9c0-9.251 0-13.877 1.97-17.332a15 15 0 0 1 5.598-5.597C11.023 0 15.648 0 24.9 0h10.2c9.252 0 13.877 0 17.332 1.97a15 15 0 0 1 5.597 5.598C60 11.023 60 15.648 60 24.9v10.2c0 9.252 0 13.877-1.97 17.332a15.001 15.001 0 0 1-5.598 5.597C48.977 60 44.352 60 35.1 60H24.9c-9.251 0-13.877 0-17.332-1.97a15 15 0 0 1-5.597-5.598C0 48.977 0 44.352 0 35.1V24.9Z"/><path id="wallet-placeholder-dash" stroke="#000" stroke-dasharray="4 4" stroke-width="1.5" d="M.04 41.708a231.598 231.598 0 0 1-.039-4.403l.75-.001L.75 35.1v-2.55H0v-5.1h.75V24.9l.001-2.204h-.75c.003-1.617.011-3.077.039-4.404l.75.016c.034-1.65.099-3.08.218-4.343l-.746-.07c.158-1.678.412-3.083.82-4.316l.713.236c.224-.679.497-1.296.827-1.875a14.25 14.25 0 0 1 1.05-1.585L3.076 5.9A15 15 0 0 1 5.9 3.076l.455.596a14.25 14.25 0 0 1 1.585-1.05c.579-.33 1.196-.603 1.875-.827l-.236-.712C10.812.674 12.217.42 13.895.262l.07.746C15.23.89 16.66.824 18.308.79l-.016-.75C19.62.012 21.08.004 22.695.001l.001.75L24.9.75h2.55V0h5.1v.75h2.55l2.204.001v-.75c1.617.003 3.077.011 4.404.039l-.016.75c1.65.034 3.08.099 4.343.218l.07-.746c1.678.158 3.083.412 4.316.82l-.236.713c.679.224 1.296.497 1.875.827a14.24 14.24 0 0 1 1.585 1.05l.455-.596A14.999 14.999 0 0 1 56.924 5.9l-.596.455c.384.502.735 1.032 1.05 1.585.33.579.602 1.196.827 1.875l.712-.236c.409 1.233.663 2.638.822 4.316l-.747.07c.119 1.264.184 2.694.218 4.343l.75-.016c.028 1.327.036 2.787.039 4.403l-.75.001.001 2.204v2.55H60v5.1h-.75v2.55l-.001 2.204h.75a231.431 231.431 0 0 1-.039 4.404l-.75-.016c-.034 1.65-.099 3.08-.218 4.343l.747.07c-.159 1.678-.413 3.083-.822 4.316l-.712-.236a10.255 10.255 0 0 1-.827 1.875 14.242 14.242 0 0 1-1.05 1.585l.596.455a14.997 14.997 0 0 1-2.824 2.824l-.455-.596c-.502.384-1.032.735-1.585 1.05-.579.33-1.196.602-1.875.827l.236.712c-1.233.409-2.638.663-4.316.822l-.07-.747c-1.264.119-2.694.184-4.343.218l.016.75c-1.327.028-2.787.036-4.403.039l-.001-.75-2.204.001h-2.55V60h-5.1v-.75H24.9l-2.204-.001v.75a231.431 231.431 0 0 1-4.404-.039l.016-.75c-1.65-.034-3.08-.099-4.343-.218l-.07.747c-1.678-.159-3.083-.413-4.316-.822l.236-.712a10.258 10.258 0 0 1-1.875-.827 14.252 14.252 0 0 1-1.585-1.05l-.455.596A14.999 14.999 0 0 1 3.076 54.1l.596-.455a14.24 14.24 0 0 1-1.05-1.585 10.259 10.259 0 0 1-.827-1.875l-.712.236C.674 49.188.42 47.783.262 46.105l.746-.07C.89 44.77.824 43.34.79 41.692l-.75.016Z"/><path fill="#fff" fill-rule="evenodd" d="M35.643 32.145c-.297-.743-.445-1.114-.401-1.275a.42.42 0 0 1 .182-.27c.134-.1.463-.1 1.123-.1.742 0 1.499.046 2.236-.05a6 6 0 0 0 5.166-5.166c.051-.39.051-.855.051-1.784 0-.928 0-1.393-.051-1.783a6 6 0 0 0-5.166-5.165c-.39-.052-.854-.052-1.783-.052h-7.72c-4.934 0-7.401 0-9.244 1.051a8 8 0 0 0-2.985 2.986C16.057 22.28 16.003 24.58 16 29 15.998 31.075 16 33.15 16 35.224A7.778 7.778 0 0 0 23.778 43H28.5c1.394 0 2.09 0 2.67-.116a6 6 0 0 0 4.715-4.714c.115-.58.115-1.301.115-2.744 0-1.31 0-1.964-.114-2.49a4.998 4.998 0 0 0-.243-.792Z" clip-rule="evenodd"/><path fill="#9EA9A9" fill-rule="evenodd" d="M37 18h-7.72c-2.494 0-4.266.002-5.647.126-1.361.122-2.197.354-2.854.728a6.5 6.5 0 0 0-2.425 2.426c-.375.657-.607 1.492-.729 2.853-.11 1.233-.123 2.777-.125 4.867 0 .7 0 1.05.097 1.181.096.13.182.181.343.2.163.02.518-.18 1.229-.581a6.195 6.195 0 0 1 3.053-.8H37c.977 0 1.32-.003 1.587-.038a4.5 4.5 0 0 0 3.874-3.874c.036-.268.039-.611.039-1.588 0-.976-.003-1.319-.038-1.587a4.5 4.5 0 0 0-3.875-3.874C38.32 18.004 37.977 18 37 18Zm-7.364 12.5h-7.414a4.722 4.722 0 0 0-4.722 4.723 6.278 6.278 0 0 0 6.278 6.278H28.5c1.466 0 1.98-.008 2.378-.087a4.5 4.5 0 0 0 3.535-3.536c.08-.397.087-.933.087-2.451 0-1.391-.009-1.843-.08-2.17a3.5 3.5 0 0 0-2.676-2.676c-.328-.072-.762-.08-2.108-.08Z" clip-rule="evenodd"/></g><defs><clipPath id="q"><path fill="#fff" d="M0 0h60v60H0z"/></clipPath></defs></svg>`,GLOBE_ICON:Lt`<svg width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="#fff" fill-rule="evenodd" d="M15.5 8a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Zm-2.113.75c.301 0 .535.264.47.558a6.01 6.01 0 0 1-2.867 3.896c-.203.116-.42-.103-.334-.32.409-1.018.691-2.274.797-3.657a.512.512 0 0 1 .507-.477h1.427Zm.47-2.058c.065.294-.169.558-.47.558H11.96a.512.512 0 0 1-.507-.477c-.106-1.383-.389-2.638-.797-3.656-.087-.217.13-.437.333-.32a6.01 6.01 0 0 1 2.868 3.895Zm-4.402.558c.286 0 .515-.24.49-.525-.121-1.361-.429-2.534-.83-3.393-.279-.6-.549-.93-.753-1.112a.535.535 0 0 0-.724 0c-.204.182-.474.513-.754 1.112-.4.859-.708 2.032-.828 3.393a.486.486 0 0 0 .49.525h2.909Zm-5.415 0c.267 0 .486-.21.507-.477.106-1.383.389-2.638.797-3.656.087-.217-.13-.437-.333-.32a6.01 6.01 0 0 0-2.868 3.895c-.065.294.169.558.47.558H4.04ZM2.143 9.308c-.065-.294.169-.558.47-.558H4.04c.267 0 .486.21.507.477.106 1.383.389 2.639.797 3.657.087.217-.13.436-.333.32a6.01 6.01 0 0 1-2.868-3.896Zm3.913-.033a.486.486 0 0 1 .49-.525h2.909c.286 0 .515.24.49.525-.121 1.361-.428 2.535-.83 3.394-.279.6-.549.93-.753 1.112a.535.535 0 0 1-.724 0c-.204-.182-.474-.513-.754-1.112-.4-.859-.708-2.033-.828-3.394Z" clip-rule="evenodd"/></svg>`},hS=lt`.wcm-toolbar-placeholder{top:0;bottom:0;left:0;right:0;width:100%;position:absolute;display:block;pointer-events:none;height:100px;border-radius:calc(var(--wcm-background-border-radius) * .9);background-color:var(--wcm-background-color);background-position:center;background-size:cover}.wcm-toolbar{height:38px;display:flex;position:relative;margin:5px 15px 5px 5px;justify-content:space-between;align-items:center}.wcm-toolbar img,.wcm-toolbar svg{height:28px;object-position:left center;object-fit:contain}#wcm-wc-logo path{fill:var(--wcm-accent-fill-color)}button{width:28px;height:28px;border-radius:var(--wcm-icon-button-border-radius);border:0;display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--wcm-color-bg-1);box-shadow:0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-bg-2)}button svg{display:block;object-position:center}button path{fill:var(--wcm-color-fg-1)}.wcm-toolbar div{display:flex}@media(hover:hover){button:hover{background-color:var(--wcm-color-bg-2)}}`;var fS=Object.defineProperty,dS=Object.getOwnPropertyDescriptor,pS=(r,e,t,n)=>{for(var i=n>1?void 0:n?dS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&fS(e,t,i),i};let Hh=class extends Ye{render(){return he`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${ht.WALLET_CONNECT_LOGO} <button @click="${Ki.close}">${ht.CROSS_ICON}</button></div>`}};Hh.styles=[rt.globalCss,hS],Hh=pS([ot("wcm-modal-backcard")],Hh);const gS=lt`main{padding:20px;padding-top:0;width:100%}`;var mS=Object.defineProperty,vS=Object.getOwnPropertyDescriptor,yS=(r,e,t,n)=>{for(var i=n>1?void 0:n?vS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&mS(e,t,i),i};let Wh=class extends Ye{render(){return he`<main><slot></slot></main>`}};Wh.styles=[rt.globalCss,gS],Wh=yS([ot("wcm-modal-content")],Wh);const wS=lt`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var bS=Object.defineProperty,_S=Object.getOwnPropertyDescriptor,ES=(r,e,t,n)=>{for(var i=n>1?void 0:n?_S(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&bS(e,t,i),i};let Kh=class extends Ye{render(){return he`<footer><slot></slot></footer>`}};Kh.styles=[rt.globalCss,wS],Kh=ES([ot("wcm-modal-footer")],Kh);const xS=lt`header{display:flex;justify-content:center;align-items:center;padding:20px;position:relative}.wcm-border{border-bottom:1px solid var(--wcm-color-bg-2);margin-bottom:20px}header button{padding:15px 20px}header button:active{opacity:.5}@media(hover:hover){header button:hover{opacity:.5}}.wcm-back-btn{position:absolute;left:0}.wcm-action-btn{position:absolute;right:0}path{fill:var(--wcm-accent-color)}`;var IS=Object.defineProperty,DS=Object.getOwnPropertyDescriptor,ra=(r,e,t,n)=>{for(var i=n>1?void 0:n?DS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&IS(e,t,i),i};let es=class extends Ye{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return he`<button class="wcm-back-btn" @click="${Tt.goBack}">${ht.BACK_ICON}</button>`}actionBtnTemplate(){return he`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const r={"wcm-border":this.border},e=Tt.state.history.length>1,t=this.title?he`<wcm-text variant="big-bold">${this.title}</wcm-text>`:he`<slot></slot>`;return he`<header class="${qn(r)}">${e?this.backBtnTemplate():null} ${t} ${this.onAction?this.actionBtnTemplate():null}</header>`}};es.styles=[rt.globalCss,xS],ra([Be()],es.prototype,"title",2),ra([Be()],es.prototype,"onAction",2),ra([Be()],es.prototype,"actionIcon",2),ra([Be({type:Boolean})],es.prototype,"border",2),es=ra([ot("wcm-modal-header")],es);const Pe={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(r,e){const t=r.renderRoot.querySelector(e);if(!t)throw new Error(`${e} not found`);return t},getWalletIcon({id:r,image_id:e}){const{walletImages:t}=Kr.state;return t!=null&&t[r]?t[r]:e?Nr.getWalletImageUrl(e):""},getWalletName(r,e=!1){return e&&r.length>8?`${r.substring(0,8)}..`:r},isMobileAnimation(){return window.innerWidth<=Pe.MOBILE_BREAKPOINT},async preloadImage(r){const e=new Promise((t,n)=>{const i=new Image;i.onload=t,i.onerror=n,i.crossOrigin="anonymous",i.src=r});return Promise.race([e,we.wait(3e3)])},getErrorMessage(r){return r instanceof Error?r.message:"Unknown Error"},debounce(r,e=500){let t;return(...n)=>{function i(){r(...n)}t&&clearTimeout(t),t=setTimeout(i,e)}},handleMobileLinking(r){const{walletConnectUri:e}=zt.state,{mobile:t,name:n}=r,i=t?.native,a=t?.universal;Pe.setRecentWallet(r);function c(u){let f="";i?f=we.formatUniversalUrl(i,u,n):a&&(f=we.formatNativeUrl(a,u,n)),we.openHref(f,"_self")}e&&c(e)},handleAndroidLinking(){const{walletConnectUri:r}=zt.state;r&&(we.setWalletConnectAndroidDeepLink(r),we.openHref(r,"_self"))},async handleUriCopy(){const{walletConnectUri:r}=zt.state;if(r)try{await navigator.clipboard.writeText(r),hi.openToast("Link copied","success")}catch{hi.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:r}=Kr.state,e=Object.values(r??{});return Object.values(e)},truncate(r,e=8){return r.length<=e?r:`${r.substring(0,4)}...${r.substring(r.length-4)}`},setRecentWallet(r){try{localStorage.setItem(Pe.WCM_RECENT_WALLET_DATA,JSON.stringify(r))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const r=localStorage.getItem(Pe.WCM_RECENT_WALLET_DATA);return r?JSON.parse(r):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes(r,e){return r.toUpperCase().includes(e.toUpperCase())},openWalletExplorerUrl(){we.openHref(Pe.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:r,mobile:e}=we.getWalletRouterData(),t=!!r?.native,n=!!r?.universal,i=!!e?.native||!!e?.universal;return{isDesktop:t,isMobile:i,isWeb:n}},goToConnectingView(r){Tt.setData({Wallet:r});const e=we.isMobile(),{isDesktop:t,isWeb:n,isMobile:i}=Pe.getCachedRouterWalletPlatforms();e?i?Tt.push("MobileConnecting"):n?Tt.push("WebConnecting"):Tt.push("InstallWallet"):t?Tt.push("DesktopConnecting"):n?Tt.push("WebConnecting"):i?Tt.push("MobileQrcodeConnecting"):Tt.push("InstallWallet")}},SS=lt`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var OS=Object.defineProperty,CS=Object.getOwnPropertyDescriptor,Vh=(r,e,t,n)=>{for(var i=n>1?void 0:n?CS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&OS(e,t,i),i};let na=class extends Ye{constructor(){super(),this.view=Tt.state.view,this.prevView=Tt.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=Tt.subscribe(r=>{this.view!==r.view&&this.onChangeRoute()})}firstUpdated(){this.resizeObserver=new ResizeObserver(([r])=>{const e=`${r.contentRect.height}px`;this.oldHeight!=="0px"&&Xi(this.routerEl,{height:[this.oldHeight,e]},{duration:.2}),this.oldHeight=e}),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var r,e;(r=this.unsubscribe)==null||r.call(this),(e=this.resizeObserver)==null||e.disconnect()}get routerEl(){return Pe.getShadowRootElement(this,".wcm-router")}get contentEl(){return Pe.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return he`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return he`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return he`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return he`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return he`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return he`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return he`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return he`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return he`<div>Not Found</div>`}}async onChangeRoute(){await Xi(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=Tt.state.view,Xi(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return he`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};na.styles=[rt.globalCss,SS],Vh([Lr()],na.prototype,"view",2),Vh([Lr()],na.prototype,"prevView",2),na=Vh([ot("wcm-modal-router")],na);const $S=lt`div{height:36px;width:max-content;display:flex;justify-content:center;align-items:center;padding:9px 15px 11px;position:absolute;top:12px;box-shadow:0 6px 14px -6px rgba(10,16,31,.3),0 10px 32px -4px rgba(10,16,31,.15);z-index:2;left:50%;transform:translateX(-50%);pointer-events:none;backdrop-filter:blur(20px) saturate(1.8);-webkit-backdrop-filter:blur(20px) saturate(1.8);border-radius:var(--wcm-notification-border-radius);border:1px solid var(--wcm-color-overlay);background-color:var(--wcm-color-overlay)}svg{margin-right:5px}@-moz-document url-prefix(){div{background-color:var(--wcm-color-bg-3)}}.wcm-success path{fill:var(--wcm-accent-color)}.wcm-error path{fill:var(--wcm-error-color)}`;var AS=Object.defineProperty,PS=Object.getOwnPropertyDescriptor,_m=(r,e,t,n)=>{for(var i=n>1?void 0:n?PS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&AS(e,t,i),i};let xc=class extends Ye{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=hi.subscribe(r=>{r.open?(this.open=!0,this.timeout=setTimeout(()=>hi.closeToast(),2200)):(this.open=!1,clearTimeout(this.timeout))})}disconnectedCallback(){var r;(r=this.unsubscribe)==null||r.call(this),clearTimeout(this.timeout),hi.closeToast()}render(){const{message:r,variant:e}=hi.state,t={"wcm-success":e==="success","wcm-error":e==="error"};return this.open?he`<div class="${qn(t)}">${e==="success"?ht.CHECKMARK_ICON:null} ${e==="error"?ht.CROSS_ICON:null}<wcm-text variant="small-regular">${r}</wcm-text></div>`:null}};xc.styles=[rt.globalCss,$S],_m([Lr()],xc.prototype,"open",2),xc=_m([ot("wcm-modal-toast")],xc);const TS=.1,Em=2.5,zn=7;function Gh(r,e,t){return r===e?!1:(r-e<0?e-r:r-e)<=t+TS}function RS(r,e){const t=Array.prototype.slice.call(Jo.create(r,{errorCorrectionLevel:e}).modules.data,0),n=Math.sqrt(t.length);return t.reduce((i,a,c)=>(c%n===0?i.push([a]):i[i.length-1].push(a))&&i,[])}const NS={generate(r,e,t){const n="#141414",i="#ffffff",a=[],c=RS(r,"Q"),u=e/c.length,f=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];f.forEach(({x:S,y:P})=>{const j=(c.length-zn)*u*S,U=(c.length-zn)*u*P,A=.45;for(let T=0;T<f.length;T+=1){const O=u*(zn-T*2);a.push(Lt`<rect fill="${T%2===0?n:i}" height="${O}" rx="${O*A}" ry="${O*A}" width="${O}" x="${j+u*T}" y="${U+u*T}">`)}});const h=Math.floor((t+25)/u),m=c.length/2-h/2,w=c.length/2+h/2-1,y=[];c.forEach((S,P)=>{S.forEach((j,U)=>{if(c[P][U]&&!(P<zn&&U<zn||P>c.length-(zn+1)&&U<zn||P<zn&&U>c.length-(zn+1))&&!(P>m&&P<w&&U>m&&U<w)){const A=P*u+u/2,T=U*u+u/2;y.push([A,T])}})});const _={};return y.forEach(([S,P])=>{_[S]?_[S].push(P):_[S]=[P]}),Object.entries(_).map(([S,P])=>{const j=P.filter(U=>P.every(A=>!Gh(U,A,u)));return[Number(S),j]}).forEach(([S,P])=>{P.forEach(j=>{a.push(Lt`<circle cx="${S}" cy="${j}" fill="${n}" r="${u/Em}">`)})}),Object.entries(_).filter(([S,P])=>P.length>1).map(([S,P])=>{const j=P.filter(U=>P.some(A=>Gh(U,A,u)));return[Number(S),j]}).map(([S,P])=>{P.sort((U,A)=>U<A?-1:1);const j=[];for(const U of P){const A=j.find(T=>T.some(O=>Gh(U,O,u)));A?A.push(U):j.push([U])}return[S,j.map(U=>[U[0],U[U.length-1]])]}).forEach(([S,P])=>{P.forEach(([j,U])=>{a.push(Lt`<line x1="${S}" x2="${S}" y1="${j}" y2="${U}" stroke="${n}" stroke-width="${u/(Em/2)}" stroke-linecap="round">`)})}),a}},LS=lt`@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}div{position:relative;user-select:none;display:block;overflow:hidden;aspect-ratio:1/1;animation:fadeIn ease .2s}.wcm-dark{background-color:#fff;border-radius:var(--wcm-container-border-radius);padding:18px;box-shadow:0 2px 5px #000}svg:first-child,wcm-wallet-image{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{width:25%;height:25%;border-radius:var(--wcm-wallet-icon-border-radius)}svg:first-child{transform:translateY(-50%) translateX(-50%) scale(.9)}svg:first-child path:first-child{fill:var(--wcm-accent-color)}svg:first-child path:last-child{stroke:var(--wcm-color-overlay)}`;var MS=Object.defineProperty,US=Object.getOwnPropertyDescriptor,zs=(r,e,t,n)=>{for(var i=n>1?void 0:n?US(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&MS(e,t,i),i};let Hn=class extends Ye{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const r=ui.state.themeMode==="light"?this.size:this.size-36;return Lt`<svg height="${r}" width="${r}">${NS.generate(this.uri,r,r/4)}</svg>`}render(){const r={"wcm-dark":ui.state.themeMode==="dark"};return he`<div style="${`width: ${this.size}px`}" class="${qn(r)}">${this.walletId||this.imageUrl?he`<wcm-wallet-image walletId="${Ir(this.walletId)}" imageId="${Ir(this.imageId)}" imageUrl="${Ir(this.imageUrl)}"></wcm-wallet-image>`:ht.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};Hn.styles=[rt.globalCss,LS],zs([Be()],Hn.prototype,"uri",2),zs([Be({type:Number})],Hn.prototype,"size",2),zs([Be()],Hn.prototype,"imageId",2),zs([Be()],Hn.prototype,"walletId",2),zs([Be()],Hn.prototype,"imageUrl",2),Hn=zs([ot("wcm-qrcode")],Hn);const jS=lt`:host{position:relative;height:28px;width:80%}input{width:100%;height:100%;line-height:28px!important;border-radius:var(--wcm-input-border-radius);font-style:normal;font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',Roboto,Ubuntu,'Helvetica Neue',sans-serif;font-feature-settings:'case' on;font-weight:500;font-size:16px;letter-spacing:-.03em;padding:0 10px 0 34px;transition:.2s all ease;color:var(--wcm-color-fg-1);background-color:var(--wcm-color-bg-3);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay);caret-color:var(--wcm-accent-color)}input::placeholder{color:var(--wcm-color-fg-2)}svg{left:10px;top:4px;pointer-events:none;position:absolute;width:20px;height:20px}input:focus-within{box-shadow:inset 0 0 0 1px var(--wcm-accent-color)}path{fill:var(--wcm-color-fg-2)}`;var FS=Object.defineProperty,BS=Object.getOwnPropertyDescriptor,xm=(r,e,t,n)=>{for(var i=n>1?void 0:n?BS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&FS(e,t,i),i};let Ic=class extends Ye{constructor(){super(...arguments),this.onChange=()=>null}render(){return he`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${ht.SEARCH_ICON}`}};Ic.styles=[rt.globalCss,jS],xm([Be()],Ic.prototype,"onChange",2),Ic=xm([ot("wcm-search-input")],Ic);const kS=lt`@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}svg{animation:rotate 2s linear infinite;display:flex;justify-content:center;align-items:center}svg circle{stroke-linecap:round;animation:dash 1.5s ease infinite;stroke:var(--wcm-accent-color)}`;var qS=Object.defineProperty,zS=Object.getOwnPropertyDescriptor,HS=(r,e,t,n)=>{for(var i=n>1?void 0:n?zS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&qS(e,t,i),i};let Yh=class extends Ye{render(){return he`<svg viewBox="0 0 50 50" width="24" height="24"><circle cx="25" cy="25" r="20" fill="none" stroke-width="4" stroke="#fff"/></svg>`}};Yh.styles=[rt.globalCss,kS],Yh=HS([ot("wcm-spinner")],Yh);const WS=lt`span{font-style:normal;font-family:var(--wcm-font-family);font-feature-settings:var(--wcm-font-feature-settings)}.wcm-xsmall-bold{font-family:var(--wcm-text-xsmall-bold-font-family);font-weight:var(--wcm-text-xsmall-bold-weight);font-size:var(--wcm-text-xsmall-bold-size);line-height:var(--wcm-text-xsmall-bold-line-height);letter-spacing:var(--wcm-text-xsmall-bold-letter-spacing);text-transform:var(--wcm-text-xsmall-bold-text-transform)}.wcm-xsmall-regular{font-family:var(--wcm-text-xsmall-regular-font-family);font-weight:var(--wcm-text-xsmall-regular-weight);font-size:var(--wcm-text-xsmall-regular-size);line-height:var(--wcm-text-xsmall-regular-line-height);letter-spacing:var(--wcm-text-xsmall-regular-letter-spacing);text-transform:var(--wcm-text-xsmall-regular-text-transform)}.wcm-small-thin{font-family:var(--wcm-text-small-thin-font-family);font-weight:var(--wcm-text-small-thin-weight);font-size:var(--wcm-text-small-thin-size);line-height:var(--wcm-text-small-thin-line-height);letter-spacing:var(--wcm-text-small-thin-letter-spacing);text-transform:var(--wcm-text-small-thin-text-transform)}.wcm-small-regular{font-family:var(--wcm-text-small-regular-font-family);font-weight:var(--wcm-text-small-regular-weight);font-size:var(--wcm-text-small-regular-size);line-height:var(--wcm-text-small-regular-line-height);letter-spacing:var(--wcm-text-small-regular-letter-spacing);text-transform:var(--wcm-text-small-regular-text-transform)}.wcm-medium-regular{font-family:var(--wcm-text-medium-regular-font-family);font-weight:var(--wcm-text-medium-regular-weight);font-size:var(--wcm-text-medium-regular-size);line-height:var(--wcm-text-medium-regular-line-height);letter-spacing:var(--wcm-text-medium-regular-letter-spacing);text-transform:var(--wcm-text-medium-regular-text-transform)}.wcm-big-bold{font-family:var(--wcm-text-big-bold-font-family);font-weight:var(--wcm-text-big-bold-weight);font-size:var(--wcm-text-big-bold-size);line-height:var(--wcm-text-big-bold-line-height);letter-spacing:var(--wcm-text-big-bold-letter-spacing);text-transform:var(--wcm-text-big-bold-text-transform)}:host(*){color:var(--wcm-color-fg-1)}.wcm-color-primary{color:var(--wcm-color-fg-1)}.wcm-color-secondary{color:var(--wcm-color-fg-2)}.wcm-color-tertiary{color:var(--wcm-color-fg-3)}.wcm-color-inverse{color:var(--wcm-accent-fill-color)}.wcm-color-accnt{color:var(--wcm-accent-color)}.wcm-color-error{color:var(--wcm-error-color)}`;var KS=Object.defineProperty,VS=Object.getOwnPropertyDescriptor,Zh=(r,e,t,n)=>{for(var i=n>1?void 0:n?VS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&KS(e,t,i),i};let ia=class extends Ye{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const r={"wcm-big-bold":this.variant==="big-bold","wcm-medium-regular":this.variant==="medium-regular","wcm-small-regular":this.variant==="small-regular","wcm-small-thin":this.variant==="small-thin","wcm-xsmall-regular":this.variant==="xsmall-regular","wcm-xsmall-bold":this.variant==="xsmall-bold","wcm-color-primary":this.color==="primary","wcm-color-secondary":this.color==="secondary","wcm-color-tertiary":this.color==="tertiary","wcm-color-inverse":this.color==="inverse","wcm-color-accnt":this.color==="accent","wcm-color-error":this.color==="error"};return he`<span><slot class="${qn(r)}"></slot></span>`}};ia.styles=[rt.globalCss,WS],Zh([Be()],ia.prototype,"variant",2),Zh([Be()],ia.prototype,"color",2),ia=Zh([ot("wcm-text")],ia);const GS=lt`button{width:100%;height:100%;border-radius:var(--wcm-button-hover-highlight-border-radius);display:flex;align-items:flex-start}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}button>div{width:80px;padding:5px 0;display:flex;flex-direction:column;align-items:center}wcm-text{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}wcm-wallet-image{height:60px;width:60px;transition:all .2s ease;border-radius:var(--wcm-wallet-icon-border-radius);margin-bottom:5px}.wcm-sublabel{margin-top:2px}`;var YS=Object.defineProperty,ZS=Object.getOwnPropertyDescriptor,vi=(r,e,t,n)=>{for(var i=n>1?void 0:n?ZS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&YS(e,t,i),i};let Cn=class extends Ye{constructor(){super(...arguments),this.onClick=()=>null,this.name="",this.walletId="",this.label=void 0,this.imageId=void 0,this.installed=!1,this.recent=!1}sublabelTemplate(){return this.recent?he`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?he`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){og.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var r;return he`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${Ir(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${(r=this.label)!=null?r:Pe.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};Cn.styles=[rt.globalCss,GS],vi([Be()],Cn.prototype,"onClick",2),vi([Be()],Cn.prototype,"name",2),vi([Be()],Cn.prototype,"walletId",2),vi([Be()],Cn.prototype,"label",2),vi([Be()],Cn.prototype,"imageId",2),vi([Be({type:Boolean})],Cn.prototype,"installed",2),vi([Be({type:Boolean})],Cn.prototype,"recent",2),Cn=vi([ot("wcm-wallet-button")],Cn);const JS=lt`:host{display:block}div{overflow:hidden;position:relative;border-radius:inherit;width:100%;height:100%;background-color:var(--wcm-color-overlay)}svg{position:relative;width:100%;height:100%}div::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;border-radius:inherit;border:1px solid var(--wcm-color-overlay)}div img{width:100%;height:100%;object-fit:cover;object-position:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var QS=Object.defineProperty,XS=Object.getOwnPropertyDescriptor,Dc=(r,e,t,n)=>{for(var i=n>1?void 0:n?XS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&QS(e,t,i),i};let Hs=class extends Ye{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var r;const e=(r=this.imageUrl)!=null&&r.length?this.imageUrl:Pe.getWalletIcon({id:this.walletId,image_id:this.imageId});return he`${e.length?he`<div><img crossorigin="anonymous" src="${e}" alt="${this.id}"></div>`:ht.WALLET_PLACEHOLDER}`}};Hs.styles=[rt.globalCss,JS],Dc([Be()],Hs.prototype,"walletId",2),Dc([Be()],Hs.prototype,"imageId",2),Dc([Be()],Hs.prototype,"imageUrl",2),Hs=Dc([ot("wcm-wallet-image")],Hs);var eO=Object.defineProperty,tO=Object.getOwnPropertyDescriptor,Im=(r,e,t,n)=>{for(var i=n>1?void 0:n?tO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&eO(e,t,i),i};let Jh=class extends Ye{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(r){try{r!=null&&r.length&&await Promise.all(r.map(async e=>Pe.preloadImage(e)))}catch{console.info("Unsuccessful attempt at preloading some images",r)}}async preloadListings(){if(Kr.state.enableExplorer){await Nr.getRecomendedWallets(),zt.setIsDataLoaded(!0);const{recomendedWallets:r}=Nr.state,e=r.map(t=>Pe.getWalletIcon(t));await this.loadImages(e)}else zt.setIsDataLoaded(!0)}async preloadCustomImages(){const r=Pe.getCustomImageUrls();await this.loadImages(r)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(r){console.error(r),hi.openToast("Failed preloading","error")}}};Im([Lr()],Jh.prototype,"preload",2),Jh=Im([ot("wcm-explorer-context")],Jh);var rO=Object.defineProperty,nO=Object.getOwnPropertyDescriptor,iO=(r,e,t,n)=>{for(var i=n>1?void 0:n?nO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&rO(e,t,i),i};let Dm=class extends Ye{constructor(){super(),this.unsubscribeTheme=void 0,rt.setTheme(),this.unsubscribeTheme=ui.subscribe(rt.setTheme)}disconnectedCallback(){var r;(r=this.unsubscribeTheme)==null||r.call(this)}};Dm=iO([ot("wcm-theme-context")],Dm);const sO=lt`@keyframes scroll{0%{transform:translate3d(0,0,0)}100%{transform:translate3d(calc(-70px * 9),0,0)}}.wcm-slider{position:relative;overflow-x:hidden;padding:10px 0;margin:0 -20px;width:calc(100% + 40px)}.wcm-track{display:flex;width:calc(70px * 18);animation:scroll 20s linear infinite;opacity:.7}.wcm-track svg{margin:0 5px}wcm-wallet-image{width:60px;height:60px;margin:0 5px;border-radius:var(--wcm-wallet-icon-border-radius)}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-title{display:flex;align-items:center;margin-bottom:10px}.wcm-title svg{margin-right:6px}.wcm-title path{fill:var(--wcm-accent-color)}wcm-modal-footer .wcm-title{padding:0 10px}wcm-button-big{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);filter:drop-shadow(0 0 17px var(--wcm-color-bg-1))}wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-info-footer wcm-text{text-align:center;margin-bottom:15px}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var oO=Object.defineProperty,aO=Object.getOwnPropertyDescriptor,cO=(r,e,t,n)=>{for(var i=n>1?void 0:n?aO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&oO(e,t,i),i};let Qh=class extends Ye{onGoToQrcode(){Tt.push("Qrcode")}render(){const{recomendedWallets:r}=Nr.state,e=[...r,...r],t=we.RECOMMENDED_WALLET_AMOUNT*2;return he`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${ht.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${ht.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(t)].map((n,i)=>{const a=e[i%e.length];return a?he`<wcm-wallet-image walletId="${a.id}" imageId="${a.image_id}"></wcm-wallet-image>`:ht.WALLET_PLACEHOLDER})}</div><wcm-button-big @click="${Pe.handleAndroidLinking}"><wcm-text variant="medium-regular" color="inverse">Select Wallet</wcm-text></wcm-button-big></div></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">Choose WalletConnect to see supported apps on your device</wcm-text></wcm-info-footer>`}};Qh.styles=[rt.globalCss,sO],Qh=cO([ot("wcm-android-wallet-selection")],Qh);const lO=lt`@keyframes loading{to{stroke-dashoffset:0}}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(1px,0,0)}30%,50%,70%{transform:translate3d(-2px,0,0)}40%,60%{transform:translate3d(2px,0,0)}}:host{display:flex;flex-direction:column;align-items:center}div{position:relative;width:110px;height:110px;display:flex;justify-content:center;align-items:center;margin:40px 0 20px 0;transform:translate3d(0,0,0)}svg{position:absolute;width:110px;height:110px;fill:none;stroke:transparent;stroke-linecap:round;stroke-width:2px;top:0;left:0}use{stroke:var(--wcm-accent-color);animation:loading 1s linear infinite}wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:90px;height:90px}wcm-text{margin-bottom:40px}.wcm-error svg{stroke:var(--wcm-error-color)}.wcm-error use{display:none}.wcm-error{animation:shake .4s cubic-bezier(.36,.07,.19,.97) both}.wcm-stale svg,.wcm-stale use{display:none}`;var uO=Object.defineProperty,hO=Object.getOwnPropertyDescriptor,Ws=(r,e,t,n)=>{for(var i=n>1?void 0:n?hO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&uO(e,t,i),i};let yi=class extends Ye{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var r,e;const t=(e=(r=ui.state.themeVariables)==null?void 0:r["--wcm-wallet-icon-large-border-radius"])!=null?e:rt.getPreset("--wcm-wallet-icon-large-border-radius");let n=0;t.includes("%")?n=88/100*parseInt(t,10):n=parseInt(t,10),n*=1.17;const i=317-n*1.57,a=425-n*1.8;return he`<svg viewBox="0 0 110 110" width="110" height="110"><rect id="wcm-loader" x="2" y="2" width="106" height="106" rx="${n}"/><use xlink:href="#wcm-loader" stroke-dasharray="106 ${i}" stroke-dashoffset="${a}"></use></svg>`}render(){const r={"wcm-error":this.isError,"wcm-stale":this.isStale};return he`<div class="${qn(r)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${Ir(this.walletId)}" imageId="${Ir(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};yi.styles=[rt.globalCss,lO],Ws([Be()],yi.prototype,"walletId",2),Ws([Be()],yi.prototype,"imageId",2),Ws([Be({type:Boolean})],yi.prototype,"isError",2),Ws([Be({type:Boolean})],yi.prototype,"isStale",2),Ws([Be()],yi.prototype,"label",2),yi=Ws([ot("wcm-connector-waiting")],yi);const Ks={manualWallets(){var r,e;const{mobileWallets:t,desktopWallets:n}=Kr.state,i=(r=Ks.recentWallet())==null?void 0:r.id,a=we.isMobile()?t:n,c=a?.filter(u=>i!==u.id);return(e=we.isMobile()?c?.map(({id:u,name:f,links:h})=>({id:u,name:f,mobile:h,links:h})):c?.map(({id:u,name:f,links:h})=>({id:u,name:f,desktop:h,links:h})))!=null?e:[]},recentWallet(){return Pe.getRecentWallet()},recomendedWallets(r=!1){var e;const t=r||(e=Ks.recentWallet())==null?void 0:e.id,{recomendedWallets:n}=Nr.state;return n.filter(i=>t!==i.id)}},wi={onConnecting(r){Pe.goToConnectingView(r)},manualWalletsTemplate(){return Ks.manualWallets().map(r=>he`<wcm-wallet-button walletId="${r.id}" name="${r.name}" .onClick="${()=>this.onConnecting(r)}"></wcm-wallet-button>`)},recomendedWalletsTemplate(r=!1){return Ks.recomendedWallets(r).map(e=>he`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${e.image_id}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`)},recentWalletTemplate(){const r=Ks.recentWallet();if(r)return he`<wcm-wallet-button name="${r.name}" walletId="${r.id}" imageId="${Ir(r.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(r)}"></wcm-wallet-button>`}},fO=lt`.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-desktop-title,.wcm-mobile-title{display:flex;align-items:center}.wcm-mobile-title{justify-content:space-between;margin-bottom:20px;margin-top:-10px}.wcm-desktop-title{margin-bottom:10px;padding:0 10px}.wcm-subtitle{display:flex;align-items:center}.wcm-subtitle:last-child path{fill:var(--wcm-color-fg-3)}.wcm-desktop-title svg,.wcm-mobile-title svg{margin-right:6px}.wcm-desktop-title path,.wcm-mobile-title path{fill:var(--wcm-accent-color)}`;var dO=Object.defineProperty,pO=Object.getOwnPropertyDescriptor,gO=(r,e,t,n)=>{for(var i=n>1?void 0:n?pO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&dO(e,t,i),i};let Xh=class extends Ye{render(){const{explorerExcludedWalletIds:r,enableExplorer:e}=Kr.state,t=r!=="ALL"&&e,n=wi.manualWalletsTemplate(),i=wi.recomendedWalletsTemplate();let a=[wi.recentWalletTemplate(),...n,...i];a=a.filter(Boolean);const c=a.length>4||t;let u=[];c?u=a.slice(0,3):u=a;const f=!!u.length;return he`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${Pe.handleUriCopy}" .actionIcon="${ht.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${ht.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${ht.SCAN_ICON}<wcm-text variant="small-regular" color="secondary">Scan with your wallet</wcm-text></div></div><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>${f?he`<wcm-modal-footer><div class="wcm-desktop-title">${ht.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${u} ${c?he`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};Xh.styles=[rt.globalCss,fO],Xh=gO([ot("wcm-desktop-wallet-selection")],Xh);const mO=lt`div{background-color:var(--wcm-color-bg-2);padding:10px 20px 15px 20px;border-top:1px solid var(--wcm-color-bg-3);text-align:center}a{color:var(--wcm-accent-color);text-decoration:none;transition:opacity .2s ease-in-out;display:inline}a:active{opacity:.8}@media(hover:hover){a:hover{opacity:.8}}`;var vO=Object.defineProperty,yO=Object.getOwnPropertyDescriptor,wO=(r,e,t,n)=>{for(var i=n>1?void 0:n?yO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&vO(e,t,i),i};let ef=class extends Ye{render(){const{termsOfServiceUrl:r,privacyPolicyUrl:e}=Kr.state;return r??e?he`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${r?he`<a href="${r}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${r&&e?"and":null} ${e?he`<a href="${e}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};ef.styles=[rt.globalCss,mO],ef=wO([ot("wcm-legal-notice")],ef);const bO=lt`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var _O=Object.defineProperty,EO=Object.getOwnPropertyDescriptor,xO=(r,e,t,n)=>{for(var i=n>1?void 0:n?EO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&_O(e,t,i),i};let tf=class extends Ye{onQrcode(){Tt.push("Qrcode")}render(){const{explorerExcludedWalletIds:r,enableExplorer:e}=Kr.state,t=r!=="ALL"&&e,n=wi.manualWalletsTemplate(),i=wi.recomendedWalletsTemplate();let a=[wi.recentWalletTemplate(),...n,...i];a=a.filter(Boolean);const c=a.length>8||t;let u=[];c?u=a.slice(0,7):u=a;const f=!!u.length;return he`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${ht.QRCODE_ICON}"></wcm-modal-header>${f?he`<wcm-modal-content><div>${u} ${c?he`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};tf.styles=[rt.globalCss,bO],tf=xO([ot("wcm-mobile-wallet-selection")],tf);const IO=lt`:host{all:initial}.wcm-overlay{top:0;bottom:0;left:0;right:0;position:fixed;z-index:var(--wcm-z-index);overflow:hidden;display:flex;justify-content:center;align-items:center;opacity:0;pointer-events:none;background-color:var(--wcm-overlay-background-color);backdrop-filter:var(--wcm-overlay-backdrop-filter)}@media(max-height:720px) and (orientation:landscape){.wcm-overlay{overflow:scroll;align-items:flex-start;padding:20px 0}}.wcm-active{pointer-events:auto}.wcm-container{position:relative;max-width:360px;width:100%;outline:0;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) var(--wcm-container-border-radius) var(--wcm-container-border-radius);border:1px solid var(--wcm-color-overlay);overflow:hidden}.wcm-card{width:100%;position:relative;border-radius:var(--wcm-container-border-radius);overflow:hidden;box-shadow:0 6px 14px -6px rgba(10,16,31,.12),0 10px 32px -4px rgba(10,16,31,.1),0 0 0 1px var(--wcm-color-overlay);background-color:var(--wcm-color-bg-1);color:var(--wcm-color-fg-1)}@media(max-width:600px){.wcm-container{max-width:440px;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) 0 0}.wcm-card{border-radius:var(--wcm-container-border-radius) var(--wcm-container-border-radius) 0 0}.wcm-overlay{align-items:flex-end}}@media(max-width:440px){.wcm-container{border:0}}`;var DO=Object.defineProperty,SO=Object.getOwnPropertyDescriptor,rf=(r,e,t,n)=>{for(var i=n>1?void 0:n?SO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&DO(e,t,i),i};let Vs=class extends Ye{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=Ki.subscribe(r=>{r.open?this.onOpenModalEvent():this.onCloseModalEvent()})}disconnectedCallback(){var r;(r=this.unsubscribeModal)==null||r.call(this)}get overlayEl(){return Pe.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return Pe.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(r){document.querySelector("body")&&(r?document.getElementById("wcm-styles")?.remove():document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>'))}onCloseModal(r){r.target===r.currentTarget&&Ki.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout(async()=>{const r=Pe.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]},e=.1,t=.2;await Promise.all([Xi(this.overlayEl,{opacity:[0,1]},{delay:e,duration:t}).finished,Xi(this.containerEl,r,{delay:e,duration:t}).finished]),this.active=!0},0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const r=Pe.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]},e=.2;await Promise.all([Xi(this.overlayEl,{opacity:[1,0]},{duration:e}).finished,Xi(this.containerEl,r,{duration:e}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",r=>{var e;r.key==="Escape"?Ki.close():r.key==="Tab"&&((e=r.target)!=null&&e.tagName.includes("wcm-")||this.containerEl.focus())},this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var r;(r=this.abortController)==null||r.abort(),this.abortController=void 0}render(){const r={"wcm-overlay":!0,"wcm-active":this.active};return he`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${qn(r)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?he`<wcm-modal-backcard></wcm-modal-backcard><div class="wcm-card"><wcm-modal-router></wcm-modal-router><wcm-modal-toast></wcm-modal-toast></div>`:null}</div></div>`}};Vs.styles=[rt.globalCss,IO],rf([Lr()],Vs.prototype,"open",2),rf([Lr()],Vs.prototype,"active",2),Vs=rf([ot("wcm-modal")],Vs);const OO=lt`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var CO=Object.defineProperty,$O=Object.getOwnPropertyDescriptor,sa=(r,e,t,n)=>{for(var i=n>1?void 0:n?$O(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&CO(e,t,i),i};let ts=class extends Ye{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){we.isMobile()?Tt.replace("MobileConnecting"):Tt.replace("MobileQrcodeConnecting")}onDesktop(){Tt.replace("DesktopConnecting")}onWeb(){Tt.replace("WebConnecting")}render(){return he`<div>${this.isRetry?he`<slot></slot>`:null} ${this.isMobile?he`<wcm-button .onClick="${this.onMobile}" .iconLeft="${ht.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?he`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${ht.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?he`<wcm-button .onClick="${this.onWeb}" .iconLeft="${ht.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};ts.styles=[rt.globalCss,OO],sa([Be({type:Boolean})],ts.prototype,"isMobile",2),sa([Be({type:Boolean})],ts.prototype,"isDesktop",2),sa([Be({type:Boolean})],ts.prototype,"isWeb",2),sa([Be({type:Boolean})],ts.prototype,"isRetry",2),ts=sa([ot("wcm-platform-selection")],ts);const AO=lt`button{display:flex;flex-direction:column;padding:5px 10px;border-radius:var(--wcm-button-hover-highlight-border-radius);height:100%;justify-content:flex-start}.wcm-icons{width:60px;height:60px;display:flex;flex-wrap:wrap;padding:7px;border-radius:var(--wcm-wallet-icon-border-radius);justify-content:space-between;align-items:center;margin-bottom:5px;background-color:var(--wcm-color-bg-2);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}.wcm-icons img{width:21px;height:21px;object-fit:cover;object-position:center;border-radius:calc(var(--wcm-wallet-icon-border-radius)/ 2);border:1px solid var(--wcm-color-overlay)}.wcm-icons svg{width:21px;height:21px}.wcm-icons img:nth-child(1),.wcm-icons img:nth-child(2),.wcm-icons svg:nth-child(1),.wcm-icons svg:nth-child(2){margin-bottom:4px}wcm-text{width:100%;text-align:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var PO=Object.defineProperty,TO=Object.getOwnPropertyDescriptor,RO=(r,e,t,n)=>{for(var i=n>1?void 0:n?TO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&PO(e,t,i),i};let nf=class extends Ye{onClick(){Tt.push("WalletExplorer")}render(){const{recomendedWallets:r}=Nr.state,e=Ks.manualWallets(),t=[...r,...e].reverse().slice(0,4);return he`<button @click="${this.onClick}"><div class="wcm-icons">${t.map(n=>{const i=Pe.getWalletIcon(n);if(i)return he`<img crossorigin="anonymous" src="${i}">`;const a=Pe.getWalletIcon({id:n.id});return a?he`<img crossorigin="anonymous" src="${a}">`:ht.WALLET_PLACEHOLDER})} ${[...Array(4-t.length)].map(()=>ht.WALLET_PLACEHOLDER)}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};nf.styles=[rt.globalCss,AO],nf=RO([ot("wcm-view-all-wallets-button")],nf);const NO=lt`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var LO=Object.defineProperty,MO=Object.getOwnPropertyDescriptor,Sc=(r,e,t,n)=>{for(var i=n>1?void 0:n?MO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&LO(e,t,i),i};let Gs=class extends Ye{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout(()=>{const{walletConnectUri:r}=zt.state;this.uri=r},0)}get overlayEl(){return Pe.getShadowRootElement(this,".wcm-qr-container")}render(){return he`<div class="wcm-qr-container">${this.uri?he`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${Ir(this.walletId)}" imageId="${Ir(this.imageId)}"></wcm-qrcode>`:he`<wcm-spinner></wcm-spinner>`}</div>`}};Gs.styles=[rt.globalCss,NO],Sc([Be()],Gs.prototype,"walletId",2),Sc([Be()],Gs.prototype,"imageId",2),Sc([Lr()],Gs.prototype,"uri",2),Gs=Sc([ot("wcm-walletconnect-qr")],Gs);var UO=Object.defineProperty,jO=Object.getOwnPropertyDescriptor,FO=(r,e,t,n)=>{for(var i=n>1?void 0:n?jO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&UO(e,t,i),i};let sf=class extends Ye{viewTemplate(){return we.isAndroid()?he`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:we.isMobile()?he`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:he`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return he`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};sf.styles=[rt.globalCss],sf=FO([ot("wcm-connect-wallet-view")],sf);const BO=lt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var kO=Object.defineProperty,qO=Object.getOwnPropertyDescriptor,Sm=(r,e,t,n)=>{for(var i=n>1?void 0:n?qO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&kO(e,t,i),i};let Oc=class extends Ye{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(r){const{desktop:e,name:t}=we.getWalletRouterData(),n=e?.native;if(n){const i=we.formatNativeUrl(n,r,t);we.openHref(i,"_self")}}openDesktopApp(){const{walletConnectUri:r}=zt.state,e=we.getWalletRouterData();Pe.setRecentWallet(e),r&&this.onFormatAndRedirect(r)}render(){const{name:r,id:e,image_id:t}=we.getWalletRouterData(),{isMobile:n,isWeb:i}=Pe.getCachedRouterWalletPlatforms();return he`<wcm-modal-header title="${r}" .onAction="${Pe.handleUriCopy}" .actionIcon="${ht.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Ir(t)}" label="${`Continue in ${r}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${r} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isWeb="${i}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${ht.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Oc.styles=[rt.globalCss,BO],Sm([Lr()],Oc.prototype,"isError",2),Oc=Sm([ot("wcm-desktop-connecting-view")],Oc);const zO=lt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}wcm-button{margin-top:15px}`;var HO=Object.defineProperty,WO=Object.getOwnPropertyDescriptor,KO=(r,e,t,n)=>{for(var i=n>1?void 0:n?WO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&HO(e,t,i),i};let of=class extends Ye{onInstall(r){r&&we.openHref(r,"_blank")}render(){const{name:r,id:e,image_id:t,homepage:n}=we.getWalletRouterData();return he`<wcm-modal-header title="${r}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Ir(t)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${r} to continue. If multiple browser extensions are installed, disable non ${r} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(n)}" .iconLeft="${ht.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};of.styles=[rt.globalCss,zO],of=KO([ot("wcm-install-wallet-view")],of);const VO=lt`wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:96px;height:96px;margin-bottom:20px}wcm-info-footer{display:flex;width:100%}.wcm-app-store{justify-content:space-between}.wcm-app-store wcm-wallet-image{margin-right:10px;margin-bottom:0;width:28px;height:28px;border-radius:var(--wcm-wallet-icon-small-border-radius)}.wcm-app-store div{display:flex;align-items:center}.wcm-app-store wcm-button{margin-right:-10px}.wcm-note{flex-direction:column;align-items:center;padding:5px 0}.wcm-note wcm-text{text-align:center}wcm-platform-selection{margin-top:-15px}.wcm-note wcm-text{margin-top:15px}.wcm-note wcm-text span{color:var(--wcm-accent-color)}`;var GO=Object.defineProperty,YO=Object.getOwnPropertyDescriptor,Om=(r,e,t,n)=>{for(var i=n>1?void 0:n?YO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&GO(e,t,i),i};let Cc=class extends Ye{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(r,e=!1){const{mobile:t,name:n}=we.getWalletRouterData(),i=t?.native,a=t?.universal;if(i&&!e){const c=we.formatNativeUrl(i,r,n);we.openHref(c,"_self")}else if(a){const c=we.formatUniversalUrl(a,r,n);we.openHref(c,"_self")}}openMobileApp(r=!1){const{walletConnectUri:e}=zt.state,t=we.getWalletRouterData();Pe.setRecentWallet(t),e&&this.onFormatAndRedirect(e,r)}onGoToAppStore(r){r&&we.openHref(r,"_blank")}render(){const{name:r,id:e,image_id:t,app:n,mobile:i}=we.getWalletRouterData(),{isWeb:a}=Pe.getCachedRouterWalletPlatforms(),c=n?.ios,u=i?.universal;return he`<wcm-modal-header title="${r}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Ir(t)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${a}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${ht.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${u?he`<wcm-text color="secondary" variant="small-thin">Still doesn't work? <span tabindex="0" @click="${()=>this.openMobileApp(!0)}">Try this alternate link</span></wcm-text>`:null}</wcm-info-footer><wcm-info-footer class="wcm-app-store"><div><wcm-wallet-image walletId="${e}" imageId="${Ir(t)}"></wcm-wallet-image><wcm-text>${`Get ${r}`}</wcm-text></div><wcm-button .iconRight="${ht.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(c)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};Cc.styles=[rt.globalCss,VO],Om([Lr()],Cc.prototype,"isError",2),Cc=Om([ot("wcm-mobile-connecting-view")],Cc);const ZO=lt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var JO=Object.defineProperty,QO=Object.getOwnPropertyDescriptor,XO=(r,e,t,n)=>{for(var i=n>1?void 0:n?QO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&JO(e,t,i),i};let af=class extends Ye{render(){const{name:r,id:e,image_id:t}=we.getWalletRouterData(),{isDesktop:n,isWeb:i}=Pe.getCachedRouterWalletPlatforms();return he`<wcm-modal-header title="${r}" .onAction="${Pe.handleUriCopy}" .actionIcon="${ht.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${e}" imageId="${Ir(t)}"></wcm-walletconnect-qr></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Scan this QR Code with your phone's camera or inside ${r} app`}</wcm-text><wcm-platform-selection .isDesktop="${n}" .isWeb="${i}"></wcm-platform-selection></wcm-info-footer>`}};af.styles=[rt.globalCss,ZO],af=XO([ot("wcm-mobile-qr-connecting-view")],af);var eC=Object.defineProperty,tC=Object.getOwnPropertyDescriptor,rC=(r,e,t,n)=>{for(var i=n>1?void 0:n?tC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&eC(e,t,i),i};let cf=class extends Ye{render(){return he`<wcm-modal-header title="Scan the code" .onAction="${Pe.handleUriCopy}" .actionIcon="${ht.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};cf.styles=[rt.globalCss],cf=rC([ot("wcm-qrcode-view")],cf);const nC=lt`wcm-modal-content{height:clamp(200px,60vh,600px);display:block;overflow:scroll;scrollbar-width:none;position:relative;margin-top:1px}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between;margin:-15px -10px;padding-top:20px}wcm-modal-content::after,wcm-modal-content::before{content:'';position:fixed;pointer-events:none;z-index:1;width:100%;height:20px;opacity:1}wcm-modal-content::before{box-shadow:0 -1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(var(--wcm-color-bg-1),rgba(255,255,255,0))}wcm-modal-content::after{box-shadow:0 1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(rgba(255,255,255,0),var(--wcm-color-bg-1));top:calc(100% - 20px)}wcm-modal-content::-webkit-scrollbar{display:none}.wcm-placeholder-block{display:flex;justify-content:center;align-items:center;height:100px;overflow:hidden}.wcm-empty,.wcm-loading{display:flex}.wcm-loading .wcm-placeholder-block{height:100%}.wcm-end-reached .wcm-placeholder-block{height:0;opacity:0}.wcm-empty .wcm-placeholder-block{opacity:1;height:100%}wcm-wallet-button{margin:calc((100% - 60px)/ 3) 0}`;var iC=Object.defineProperty,sC=Object.getOwnPropertyDescriptor,oa=(r,e,t,n)=>{for(var i=n>1?void 0:n?sC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&iC(e,t,i),i};const lf=40;let rs=class extends Ye{constructor(){super(...arguments),this.loading=!Nr.state.wallets.listings.length,this.firstFetch=!Nr.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=Pe.debounce(r=>{r.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=r,Nr.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),Nr.resetSearch())})}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var r;(r=this.intersectionObserver)==null||r.disconnect()}get placeholderEl(){return Pe.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver(([r])=>{r.isIntersecting&&!(this.search&&this.firstFetch)&&this.fetchWallets()}),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:r,search:e}=Nr.state,{listings:t,total:n}=this.search?e:r;return n<=lf||t.length>=n}async fetchWallets(){var r;const{wallets:e,search:t}=Nr.state,{listings:n,total:i,page:a}=this.search?t:e;if(!this.endReached&&(this.firstFetch||i>lf&&n.length<i))try{this.loading=!0;const c=(r=zt.state.chains)==null?void 0:r.join(","),{listings:u}=await Nr.getWallets({page:this.firstFetch?1:a+1,entries:lf,search:this.search,version:2,chains:c}),f=u.map(h=>Pe.getWalletIcon(h));await Promise.all([...f.map(async h=>Pe.preloadImage(h)),we.wait(300)]),this.endReached=this.isLastPage()}catch(c){console.error(c),hi.openToast(Pe.getErrorMessage(c),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(r){we.isAndroid()?Pe.handleMobileLinking(r):Pe.goToConnectingView(r)}onSearchChange(r){const{value:e}=r.target;this.searchDebounce(e)}render(){const{wallets:r,search:e}=Nr.state,{listings:t}=this.search?e:r,n=this.loading&&!t.length,i=this.search.length>=3;let a=wi.manualWalletsTemplate(),c=wi.recomendedWalletsTemplate(!0);i&&(a=a.filter(({values:h})=>Pe.caseSafeIncludes(h[0],this.search)),c=c.filter(({values:h})=>Pe.caseSafeIncludes(h[0],this.search)));const u=!this.loading&&!t.length&&!c.length,f={"wcm-loading":n,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":u};return he`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${qn(f)}"><div class="wcm-grid">${n?null:a} ${n?null:c} ${n?null:t.map(h=>he`${h?he`<wcm-wallet-button imageId="${h.image_id}" name="${h.name}" walletId="${h.id}" .onClick="${()=>this.onConnect(h)}"></wcm-wallet-button>`:null}`)}</div><div class="wcm-placeholder-block">${u?he`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!u&&this.loading?he`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};rs.styles=[rt.globalCss,nC],oa([Lr()],rs.prototype,"loading",2),oa([Lr()],rs.prototype,"firstFetch",2),oa([Lr()],rs.prototype,"search",2),oa([Lr()],rs.prototype,"endReached",2),rs=oa([ot("wcm-wallet-explorer-view")],rs);const oC=lt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var aC=Object.defineProperty,cC=Object.getOwnPropertyDescriptor,Cm=(r,e,t,n)=>{for(var i=n>1?void 0:n?cC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&aC(e,t,i),i};let $c=class extends Ye{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(r){const{desktop:e,name:t}=we.getWalletRouterData(),n=e?.universal;if(n){const i=we.formatUniversalUrl(n,r,t);we.openHref(i,"_blank")}}openWebWallet(){const{walletConnectUri:r}=zt.state,e=we.getWalletRouterData();Pe.setRecentWallet(e),r&&this.onFormatAndRedirect(r)}render(){const{name:r,id:e,image_id:t}=we.getWalletRouterData(),{isMobile:n,isDesktop:i}=Pe.getCachedRouterWalletPlatforms(),a=we.isMobile();return he`<wcm-modal-header title="${r}" .onAction="${Pe.handleUriCopy}" .actionIcon="${ht.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Ir(t)}" label="${`Continue in ${r}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${r} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isDesktop="${a?!1:i}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${ht.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};$c.styles=[rt.globalCss,oC],Cm([Lr()],$c.prototype,"isError",2),$c=Cm([ot("wcm-web-connecting-view")],$c);var lC=Object.freeze({__proto__:null,get WcmModal(){return Vs},get WcmQrCode(){return Hn}});dn.EthereumProvider=Rx,dn.OPTIONAL_EVENTS=eg,dn.OPTIONAL_METHODS=X1,dn.REQUIRED_EVENTS=tc,dn.REQUIRED_METHODS=ec,dn.default=nc,Object.defineProperty(dn,"__esModule",{value:!0})});
146
+ Minimum version required to store current data is: `+s+`.
147
+ `);const c=FP(e,r,i),l=Au.getSymbolSize(e),f=new CP(l);return NP(f,e),RP(f),LP(f,e),ld(f,r,0),e>=7&&BP(f,e),UP(f,c),isNaN(n)&&(n=od.getBestMask(f,ld.bind(null,f,r))),od.applyMask(n,f),ld(f,r,n),{modules:f,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}Pw.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=sd.M,i,s;return typeof r<"u"&&(n=sd.from(r.errorCorrectionLevel,sd.M),i=xu.from(r.version),s=od.from(r.maskPattern),r.toSJISFunc&&Au.setToSJISFunction(r.toSJISFunc)),kP(e,i,n,s)};var Kw={},ud={};(function(t){function e(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let n=r.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+r);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(s){return[s,s]}))),n.length===6&&n.push("F","F");const i=parseInt(n.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+n.slice(0,6).join("")}}t.getOptions=function(n){n||(n={}),n.color||(n.color={});const i=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,s=n.width&&n.width>=21?n.width:void 0,c=n.scale||4;return{width:s,scale:s?4:c,margin:i,color:{dark:e(n.color.dark||"#000000ff"),light:e(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},t.getScale=function(n,i){return i.width&&i.width>=n+i.margin*2?i.width/(n+i.margin*2):i.scale},t.getImageWidth=function(n,i){const s=t.getScale(n,i);return Math.floor((n+i.margin*2)*s)},t.qrToImageData=function(n,i,s){const c=i.modules.size,l=i.modules.data,f=t.getScale(c,s),h=Math.floor((c+s.margin*2)*f),m=s.margin*f,_=[s.color.light,s.color.dark];for(let E=0;E<h;E++)for(let A=0;A<h;A++){let I=(E*h+A)*4,R=s.color.light;if(E>=m&&A>=m&&E<h-m&&A<h-m){const W=Math.floor((E-m)/f),Y=Math.floor((A-m)/f);R=_[l[W*c+Y]?1:0]}n[I++]=R.r,n[I++]=R.g,n[I++]=R.b,n[I]=R.a}}})(ud),function(t){const e=ud;function r(i,s,c){i.clearRect(0,0,s.width,s.height),s.style||(s.style={}),s.height=c,s.width=c,s.style.height=c+"px",s.style.width=c+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}t.render=function(s,c,l){let f=l,h=c;typeof f>"u"&&(!c||!c.getContext)&&(f=c,c=void 0),c||(h=n()),f=e.getOptions(f);const m=e.getImageWidth(s.modules.size,f),_=h.getContext("2d"),E=_.createImageData(m,m);return e.qrToImageData(E.data,s,f),r(_,h,m),_.putImageData(E,0,0),h},t.renderToDataURL=function(s,c,l){let f=l;typeof f>"u"&&(!c||!c.getContext)&&(f=c,c=void 0),f||(f={});const h=t.render(s,c,f),m=f.type||"image/png",_=f.rendererOpts||{};return h.toDataURL(m,_.quality)}}(Kw);var Ww={};const qP=ud;function Vw(t,e){const r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function hd(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function zP(t,e,r){let n="",i=0,s=!1,c=0;for(let l=0;l<t.length;l++){const f=Math.floor(l%e),h=Math.floor(l/e);!f&&!s&&(s=!0),t[l]?(c++,l>0&&f>0&&t[l-1]||(n+=s?hd("M",f+r,.5+h+r):hd("m",i,0),i=0,s=!1),f+1<e&&t[l+1]||(n+=hd("h",c),c=0)):i++}return n}Ww.render=function(e,r,n){const i=qP.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+i.margin*2,f=i.color.light.a?"<path "+Vw(i.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",h="<path "+Vw(i.color.dark,"stroke")+' d="'+zP(c,s,i.margin)+'"/>',m='viewBox="0 0 '+l+" "+l+'"',E='<svg xmlns="http://www.w3.org/2000/svg" '+(i.width?'width="'+i.width+'" height="'+i.width+'" ':"")+m+' shape-rendering="crispEdges">'+f+h+`</svg>
148
+ `;return typeof n=="function"&&n(null,E),E};const HP=iP,fd=Pw,Gw=Kw,KP=Ww;function dd(t,e,r,n,i){const s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]=="function";if(!l&&!HP())throw new Error("Callback required as last argument");if(l){if(c<2)throw new Error("Too few arguments provided");c===2?(i=r,r=e,e=n=void 0):c===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(c<1)throw new Error("Too few arguments provided");return c===1?(r=e,e=n=void 0):c===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(f,h){try{const m=fd.create(r,n);f(t(m,e,n))}catch(m){h(m)}})}try{const f=fd.create(r,n);i(null,t(f,e,n))}catch(f){i(f)}}Tc.create=fd.create,Tc.toCanvas=dd.bind(null,Gw.render),Tc.toDataURL=dd.bind(null,Gw.renderToDataURL),Tc.toString=dd.bind(null,function(t,e,r){return KP.render(t,r)});var WP=Object.defineProperty,Yw=Object.getOwnPropertySymbols,VP=Object.prototype.hasOwnProperty,GP=Object.prototype.propertyIsEnumerable,Jw=(t,e,r)=>e in t?WP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pd=(t,e)=>{for(var r in e||(e={}))VP.call(e,r)&&Jw(t,r,e[r]);if(Yw)for(var r of Yw(e))GP.call(e,r)&&Jw(t,r,e[r]);return t};function YP(){var t;const e=(t=ms.state.themeMode)!=null?t:"dark",r={light:{foreground:{1:"rgb(20,20,20)",2:"rgb(121,134,134)",3:"rgb(158,169,169)"},background:{1:"rgb(255,255,255)",2:"rgb(241,243,243)",3:"rgb(228,231,231)"},overlay:"rgba(0,0,0,0.1)"},dark:{foreground:{1:"rgb(228,231,231)",2:"rgb(148,158,158)",3:"rgb(110,119,119)"},background:{1:"rgb(20,20,20)",2:"rgb(39,42,42)",3:"rgb(59,64,64)"},overlay:"rgba(255,255,255,0.1)"}}[e];return{"--wcm-color-fg-1":r.foreground[1],"--wcm-color-fg-2":r.foreground[2],"--wcm-color-fg-3":r.foreground[3],"--wcm-color-bg-1":r.background[1],"--wcm-color-bg-2":r.background[2],"--wcm-color-bg-3":r.background[3],"--wcm-color-overlay":r.overlay}}function Qw(){return{"--wcm-accent-color":"#3396FF","--wcm-accent-fill-color":"#FFFFFF","--wcm-z-index":"89","--wcm-background-color":"#3396FF","--wcm-background-border-radius":"8px","--wcm-container-border-radius":"30px","--wcm-wallet-icon-border-radius":"15px","--wcm-wallet-icon-large-border-radius":"30px","--wcm-wallet-icon-small-border-radius":"7px","--wcm-input-border-radius":"28px","--wcm-button-border-radius":"10px","--wcm-notification-border-radius":"36px","--wcm-secondary-button-border-radius":"28px","--wcm-icon-button-border-radius":"50%","--wcm-button-hover-highlight-border-radius":"10px","--wcm-text-big-bold-size":"20px","--wcm-text-big-bold-weight":"600","--wcm-text-big-bold-line-height":"24px","--wcm-text-big-bold-letter-spacing":"-0.03em","--wcm-text-big-bold-text-transform":"none","--wcm-text-xsmall-bold-size":"10px","--wcm-text-xsmall-bold-weight":"700","--wcm-text-xsmall-bold-line-height":"12px","--wcm-text-xsmall-bold-letter-spacing":"0.02em","--wcm-text-xsmall-bold-text-transform":"uppercase","--wcm-text-xsmall-regular-size":"12px","--wcm-text-xsmall-regular-weight":"600","--wcm-text-xsmall-regular-line-height":"14px","--wcm-text-xsmall-regular-letter-spacing":"-0.03em","--wcm-text-xsmall-regular-text-transform":"none","--wcm-text-small-thin-size":"14px","--wcm-text-small-thin-weight":"500","--wcm-text-small-thin-line-height":"16px","--wcm-text-small-thin-letter-spacing":"-0.03em","--wcm-text-small-thin-text-transform":"none","--wcm-text-small-regular-size":"14px","--wcm-text-small-regular-weight":"600","--wcm-text-small-regular-line-height":"16px","--wcm-text-small-regular-letter-spacing":"-0.03em","--wcm-text-small-regular-text-transform":"none","--wcm-text-medium-regular-size":"16px","--wcm-text-medium-regular-weight":"600","--wcm-text-medium-regular-line-height":"20px","--wcm-text-medium-regular-letter-spacing":"-0.03em","--wcm-text-medium-regular-text-transform":"none","--wcm-font-family":"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif","--wcm-font-feature-settings":"'tnum' on, 'lnum' on, 'case' on","--wcm-success-color":"rgb(38,181,98)","--wcm-error-color":"rgb(242, 90, 103)","--wcm-overlay-background-color":"rgba(0, 0, 0, 0.3)","--wcm-overlay-backdrop-filter":"none"}}const xt={getPreset(t){return Qw()[t]},setTheme(){const t=document.querySelector(":root"),{themeVariables:e}=ms.state;if(t){const r=pd(pd(pd({},YP()),Qw()),e);Object.entries(r).forEach(([n,i])=>t.style.setProperty(n,i))}},globalCss:Tt`*,::after,::before{margin:0;padding:0;box-sizing:border-box;font-style:normal;text-rendering:optimizeSpeed;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent;backface-visibility:hidden}button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:relative;border:none;background-color:transparent;transition:all .2s ease}@media (hover:hover) and (pointer:fine){button:active{transition:all .1s ease;transform:scale(.93)}}button::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;transition:background-color,.2s ease}button:disabled{cursor:not-allowed}button svg,button wcm-text{position:relative;z-index:1}input{border:none;outline:0;appearance:none}img{display:block}::selection{color:var(--wcm-accent-fill-color);background:var(--wcm-accent-color)}`},JP=Tt`button{border-radius:var(--wcm-secondary-button-border-radius);height:28px;padding:0 10px;background-color:var(--wcm-accent-color)}button path{fill:var(--wcm-accent-fill-color)}button::after{border-radius:inherit;border:1px solid var(--wcm-color-overlay)}button:disabled::after{background-color:transparent}.wcm-icon-left svg{margin-right:5px}.wcm-icon-right svg{margin-left:5px}button:active::after{background-color:var(--wcm-color-overlay)}.wcm-ghost,.wcm-ghost:active::after,.wcm-outline{background-color:transparent}.wcm-ghost:active{opacity:.5}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}.wcm-ghost:hover::after{background-color:transparent}.wcm-ghost:hover{opacity:.5}}button:disabled{background-color:var(--wcm-color-bg-3);pointer-events:none}.wcm-ghost::after{border-color:transparent}.wcm-ghost path{fill:var(--wcm-color-fg-2)}.wcm-outline path{fill:var(--wcm-accent-color)}.wcm-outline:disabled{background-color:transparent;opacity:.5}`;var QP=Object.defineProperty,ZP=Object.getOwnPropertyDescriptor,va=(t,e,r,n)=>{for(var i=n>1?void 0:n?ZP(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&QP(e,r,i),i};let Es=class extends mt{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const t={"wcm-icon-left":this.iconLeft!==void 0,"wcm-icon-right":this.iconRight!==void 0,"wcm-ghost":this.variant==="ghost","wcm-outline":this.variant==="outline"};let e="inverse";return this.variant==="ghost"&&(e="secondary"),this.variant==="outline"&&(e="accent"),ve`<button class="${Hi(t)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${e}"><slot></slot></wcm-text>${this.iconRight}</button>`}};Es.styles=[xt.globalCss,JP],va([ht({type:Boolean})],Es.prototype,"disabled",2),va([ht()],Es.prototype,"iconLeft",2),va([ht()],Es.prototype,"iconRight",2),va([ht()],Es.prototype,"onClick",2),va([ht()],Es.prototype,"variant",2),Es=va([Ct("wcm-button")],Es);const XP=Tt`:host{display:inline-block}button{padding:0 15px 1px;height:40px;border-radius:var(--wcm-button-border-radius);color:var(--wcm-accent-fill-color);background-color:var(--wcm-accent-color)}button::after{content:'';top:0;bottom:0;left:0;right:0;position:absolute;background-color:transparent;border-radius:inherit;transition:background-color .2s ease;border:1px solid var(--wcm-color-overlay)}button:active::after{background-color:var(--wcm-color-overlay)}button:disabled{padding-bottom:0;background-color:var(--wcm-color-bg-3);color:var(--wcm-color-fg-3)}.wcm-secondary{color:var(--wcm-accent-color);background-color:transparent}.wcm-secondary::after{display:none}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}}`;var eM=Object.defineProperty,tM=Object.getOwnPropertyDescriptor,gd=(t,e,r,n)=>{for(var i=n>1?void 0:n?tM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&eM(e,r,i),i};let Lc=class extends mt{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const t={"wcm-secondary":this.variant==="secondary"};return ve`<button ?disabled="${this.disabled}" class="${Hi(t)}"><slot></slot></button>`}};Lc.styles=[xt.globalCss,XP],gd([ht({type:Boolean})],Lc.prototype,"disabled",2),gd([ht()],Lc.prototype,"variant",2),Lc=gd([Ct("wcm-button-big")],Lc);const rM=Tt`:host{background-color:var(--wcm-color-bg-2);border-top:1px solid var(--wcm-color-bg-3)}div{padding:10px 20px;display:inherit;flex-direction:inherit;align-items:inherit;width:inherit;justify-content:inherit}`;var nM=Object.defineProperty,iM=Object.getOwnPropertyDescriptor,sM=(t,e,r,n)=>{for(var i=n>1?void 0:n?iM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&nM(e,r,i),i};let md=class extends mt{render(){return ve`<div><slot></slot></div>`}};md.styles=[xt.globalCss,rM],md=sM([Ct("wcm-info-footer")],md);const Nt={CROSS_ICON:ar`<svg width="12" height="12" viewBox="0 0 12 12"><path d="M9.94 11A.75.75 0 1 0 11 9.94L7.414 6.353a.5.5 0 0 1 0-.708L11 2.061A.75.75 0 1 0 9.94 1L6.353 4.586a.5.5 0 0 1-.708 0L2.061 1A.75.75 0 0 0 1 2.06l3.586 3.586a.5.5 0 0 1 0 .708L1 9.939A.75.75 0 1 0 2.06 11l3.586-3.586a.5.5 0 0 1 .708 0L9.939 11Z" fill="#fff"/></svg>`,WALLET_CONNECT_LOGO:ar`<svg width="178" height="29" viewBox="0 0 178 29" id="wcm-wc-logo"><path d="M10.683 7.926c5.284-5.17 13.85-5.17 19.134 0l.636.623a.652.652 0 0 1 0 .936l-2.176 2.129a.343.343 0 0 1-.478 0l-.875-.857c-3.686-3.607-9.662-3.607-13.348 0l-.937.918a.343.343 0 0 1-.479 0l-2.175-2.13a.652.652 0 0 1 0-.936l.698-.683Zm23.633 4.403 1.935 1.895a.652.652 0 0 1 0 .936l-8.73 8.543a.687.687 0 0 1-.956 0L20.37 17.64a.172.172 0 0 0-.239 0l-6.195 6.063a.687.687 0 0 1-.957 0l-8.73-8.543a.652.652 0 0 1 0-.936l1.936-1.895a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .239 0l6.195-6.064a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .24 0l6.195-6.064a.687.687 0 0 1 .956 0ZM48.093 20.948l2.338-9.355c.139-.515.258-1.07.416-1.942.12.872.258 1.427.357 1.942l2.022 9.355h4.181l3.528-13.874h-3.21l-1.943 8.523a24.825 24.825 0 0 0-.456 2.457c-.158-.931-.317-1.625-.495-2.438l-1.883-8.542h-4.201l-2.042 8.542a41.204 41.204 0 0 0-.475 2.438 41.208 41.208 0 0 0-.476-2.438l-1.903-8.542h-3.349l3.508 13.874h4.083ZM63.33 21.304c1.585 0 2.596-.654 3.11-1.605-.059.297-.078.595-.078.892v.357h2.655V15.22c0-2.735-1.248-4.32-4.3-4.32-2.636 0-4.36 1.466-4.52 3.487h2.914c.1-.891.734-1.426 1.705-1.426.911 0 1.407.515 1.407 1.11 0 .435-.258.693-1.03.792l-1.388.159c-2.061.257-3.825 1.01-3.825 3.19 0 1.982 1.645 3.092 3.35 3.092Zm.891-2.041c-.773 0-1.348-.436-1.348-1.19 0-.733.655-1.09 1.645-1.268l.674-.119c.575-.118.892-.218 1.09-.396v.912c0 1.228-.892 2.06-2.06 2.06ZM70.398 7.074v13.874h2.874V7.074h-2.874ZM74.934 7.074v13.874h2.874V7.074h-2.874ZM84.08 21.304c2.735 0 4.5-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922H81.92ZM94.92 21.146c.633 0 1.248-.1 1.525-.179v-2.18c-.218.04-.475.06-.693.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.338v-2.24h-2.338V7.788H91.47v3.448H89.37v2.24h2.1v4.201c0 2.3 1.15 3.469 3.45 3.469ZM104.62 21.304c3.924 0 6.302-2.299 6.599-5.608h-3.111c-.238 1.803-1.506 3.032-3.369 3.032-2.2 0-3.746-1.784-3.746-4.796 0-2.953 1.605-4.638 3.805-4.638 1.883 0 2.953 1.15 3.171 2.834h3.191c-.317-3.448-2.854-5.41-6.342-5.41-3.984 0-7.036 2.695-7.036 7.214 0 4.677 2.676 7.372 6.838 7.372ZM117.449 21.304c2.993 0 5.114-1.882 5.114-5.172 0-3.23-2.121-5.233-5.114-5.233-2.972 0-5.093 2.002-5.093 5.233 0 3.29 2.101 5.172 5.093 5.172Zm0-2.22c-1.327 0-2.18-1.09-2.18-2.952 0-1.903.892-2.973 2.18-2.973 1.308 0 2.2 1.07 2.2 2.973 0 1.862-.872 2.953-2.2 2.953ZM126.569 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.229-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM137.464 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.228-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM149.949 21.304c2.735 0 4.499-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922h-3.984ZM160.876 21.304c3.013 0 4.658-1.645 4.975-4.201h-2.874c-.099 1.07-.713 1.982-2.001 1.982-1.309 0-2.2-1.21-2.2-2.993 0-1.942 1.03-2.933 2.259-2.933 1.209 0 1.803.872 1.883 1.882h2.873c-.218-2.358-1.823-4.142-4.776-4.142-2.874 0-5.153 1.903-5.153 5.193 0 3.25 1.923 5.212 5.014 5.212ZM172.067 21.146c.634 0 1.248-.1 1.526-.179v-2.18c-.218.04-.476.06-.694.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.339v-2.24h-2.339V7.788h-2.854v3.448h-2.1v2.24h2.1v4.201c0 2.3 1.15 3.469 3.449 3.469Z" fill="#fff"/></svg>`,WALLET_CONNECT_ICON:ar`<svg width="28" height="20" viewBox="0 0 28 20"><g clip-path="url(#a)"><path d="M7.386 6.482c3.653-3.576 9.575-3.576 13.228 0l.44.43a.451.451 0 0 1 0 .648L19.55 9.033a.237.237 0 0 1-.33 0l-.606-.592c-2.548-2.496-6.68-2.496-9.228 0l-.648.634a.237.237 0 0 1-.33 0L6.902 7.602a.451.451 0 0 1 0-.647l.483-.473Zm16.338 3.046 1.339 1.31a.451.451 0 0 1 0 .648l-6.035 5.909a.475.475 0 0 1-.662 0L14.083 13.2a.119.119 0 0 0-.166 0l-4.283 4.194a.475.475 0 0 1-.662 0l-6.035-5.91a.451.451 0 0 1 0-.647l1.338-1.31a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0Z" fill="#000000"/></g><defs><clipPath id="a"><path fill="#ffffff" d="M0 0h28v20H0z"/></clipPath></defs></svg>`,WALLET_CONNECT_ICON_COLORED:ar`<svg width="96" height="96" fill="none"><path fill="#fff" d="M25.322 33.597c12.525-12.263 32.83-12.263 45.355 0l1.507 1.476a1.547 1.547 0 0 1 0 2.22l-5.156 5.048a.814.814 0 0 1-1.134 0l-2.074-2.03c-8.737-8.555-22.903-8.555-31.64 0l-2.222 2.175a.814.814 0 0 1-1.134 0l-5.156-5.049a1.547 1.547 0 0 1 0-2.22l1.654-1.62Zm56.019 10.44 4.589 4.494a1.547 1.547 0 0 1 0 2.22l-20.693 20.26a1.628 1.628 0 0 1-2.267 0L48.283 56.632a.407.407 0 0 0-.567 0L33.03 71.012a1.628 1.628 0 0 1-2.268 0L10.07 50.75a1.547 1.547 0 0 1 0-2.22l4.59-4.494a1.628 1.628 0 0 1 2.267 0l14.687 14.38c.156.153.41.153.567 0l14.685-14.38a1.628 1.628 0 0 1 2.268 0l14.687 14.38c.156.153.41.153.567 0l14.686-14.38a1.628 1.628 0 0 1 2.268 0Z"/><path stroke="#000" d="M25.672 33.954c12.33-12.072 32.325-12.072 44.655 0l1.508 1.476a1.047 1.047 0 0 1 0 1.506l-5.157 5.048a.314.314 0 0 1-.434 0l-2.074-2.03c-8.932-8.746-23.409-8.746-32.34 0l-2.222 2.174a.314.314 0 0 1-.434 0l-5.157-5.048a1.047 1.047 0 0 1 0-1.506l1.655-1.62Zm55.319 10.44 4.59 4.494a1.047 1.047 0 0 1 0 1.506l-20.694 20.26a1.128 1.128 0 0 1-1.568 0l-14.686-14.38a.907.907 0 0 0-1.267 0L32.68 70.655a1.128 1.128 0 0 1-1.568 0L10.42 50.394a1.047 1.047 0 0 1 0-1.506l4.59-4.493a1.128 1.128 0 0 1 1.567 0l14.687 14.379a.907.907 0 0 0 1.266 0l-.35-.357.35.357 14.686-14.38a1.128 1.128 0 0 1 1.568 0l14.687 14.38a.907.907 0 0 0 1.267 0l14.686-14.38a1.128 1.128 0 0 1 1.568 0Z"/></svg>`,BACK_ICON:ar`<svg width="10" height="18" viewBox="0 0 10 18"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.735.179a.75.75 0 0 1 .087 1.057L2.92 8.192a1.25 1.25 0 0 0 0 1.617l5.902 6.956a.75.75 0 1 1-1.144.97L1.776 10.78a2.75 2.75 0 0 1 0-3.559L7.678.265A.75.75 0 0 1 8.735.18Z" fill="#fff"/></svg>`,COPY_ICON:ar`<svg width="24" height="24" fill="none"><path fill="#fff" fill-rule="evenodd" d="M7.01 7.01c.03-1.545.138-2.5.535-3.28A5 5 0 0 1 9.73 1.545C10.8 1 12.2 1 15 1c2.8 0 4.2 0 5.27.545a5 5 0 0 1 2.185 2.185C23 4.8 23 6.2 23 9c0 2.8 0 4.2-.545 5.27a5 5 0 0 1-2.185 2.185c-.78.397-1.735.505-3.28.534l-.001.01c-.03 1.54-.138 2.493-.534 3.27a5 5 0 0 1-2.185 2.186C13.2 23 11.8 23 9 23c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C1 19.2 1 17.8 1 15c0-2.8 0-4.2.545-5.27A5 5 0 0 1 3.73 7.545C4.508 7.149 5.46 7.04 7 7.01h.01ZM15 15.5c-1.425 0-2.403-.001-3.162-.063-.74-.06-1.139-.172-1.427-.319a3.5 3.5 0 0 1-1.53-1.529c-.146-.288-.257-.686-.318-1.427C8.501 11.403 8.5 10.425 8.5 9c0-1.425.001-2.403.063-3.162.06-.74.172-1.139.318-1.427a3.5 3.5 0 0 1 1.53-1.53c.288-.146.686-.257 1.427-.318.759-.062 1.737-.063 3.162-.063 1.425 0 2.403.001 3.162.063.74.06 1.139.172 1.427.318a3.5 3.5 0 0 1 1.53 1.53c.146.288.257.686.318 1.427.062.759.063 1.737.063 3.162 0 1.425-.001 2.403-.063 3.162-.06.74-.172 1.139-.319 1.427a3.5 3.5 0 0 1-1.529 1.53c-.288.146-.686.257-1.427.318-.759.062-1.737.063-3.162.063ZM7 8.511c-.444.009-.825.025-1.162.052-.74.06-1.139.172-1.427.318a3.5 3.5 0 0 0-1.53 1.53c-.146.288-.257.686-.318 1.427-.062.759-.063 1.737-.063 3.162 0 1.425.001 2.403.063 3.162.06.74.172 1.139.318 1.427a3.5 3.5 0 0 0 1.53 1.53c.288.146.686.257 1.427.318.759.062 1.737.063 3.162.063 1.425 0 2.403-.001 3.162-.063.74-.06 1.139-.172 1.427-.319a3.5 3.5 0 0 0 1.53-1.53c.146-.287.257-.685.318-1.426.027-.337.043-.718.052-1.162H15c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C7 13.2 7 11.8 7 9v-.489Z" clip-rule="evenodd"/></svg>`,RETRY_ICON:ar`<svg width="15" height="16" viewBox="0 0 15 16"><path d="M6.464 2.03A.75.75 0 0 0 5.403.97L2.08 4.293a1 1 0 0 0 0 1.414L5.403 9.03a.75.75 0 0 0 1.06-1.06L4.672 6.177a.25.25 0 0 1 .177-.427h2.085a4 4 0 1 1-3.93 4.746c-.077-.407-.405-.746-.82-.746-.414 0-.755.338-.7.748a5.501 5.501 0 1 0 5.45-6.248H4.848a.25.25 0 0 1-.177-.427L6.464 2.03Z" fill="#fff"/></svg>`,DESKTOP_ICON:ar`<svg width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 5.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C2.204 1 3.13 1 4.98 1h6.04c1.85 0 2.775 0 3.466.394a3 3 0 0 1 1.12 1.12C16 3.204 16 4.13 16 5.98v1.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C13.796 12 12.87 12 11.02 12H4.98c-1.85 0-2.775 0-3.466-.394a3 3 0 0 1-1.12-1.12C0 9.796 0 8.87 0 7.02V5.98ZM4.98 2.5h6.04c.953 0 1.568.001 2.034.043.446.04.608.108.69.154a1.5 1.5 0 0 1 .559.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033v1.04c0 .952-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.046-.243.114-.69.154-.466.042-1.08.043-2.033.043H4.98c-.952 0-1.568-.001-2.034-.043-.446-.04-.608-.108-.69-.154a1.5 1.5 0 0 1-.559-.56c-.046-.08-.114-.243-.154-.69-.042-.465-.043-1.08-.043-2.033V5.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.046.243-.114.69-.154.465-.042 1.08-.043 2.033-.043Z" fill="#fff"/><path d="M4 14.25a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,MOBILE_ICON:ar`<svg width="16" height="16" viewBox="0 0 16 16"><path d="M6.75 5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M3 4.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C5.204 0 6.136 0 8 0s2.795 0 3.486.394a3 3 0 0 1 1.12 1.12C13 2.204 13 3.13 13 4.98v6.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C10.796 16 9.864 16 8 16s-2.795 0-3.486-.394a3 3 0 0 1-1.12-1.12C3 13.796 3 12.87 3 11.02V4.98Zm8.5 0v6.04c0 .953-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.045-.242.113-.693.154-.47.042-1.091.043-2.05.043-.959 0-1.58-.001-2.05-.043-.45-.04-.613-.109-.693-.154a1.5 1.5 0 0 1-.56-.56c-.046-.08-.114-.243-.154-.69-.042-.466-.043-1.08-.043-2.033V4.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.045.243-.113.693-.154C6.42 1.501 7.041 1.5 8 1.5c.959 0 1.58.001 2.05.043.45.04.613.109.693.154a1.5 1.5 0 0 1 .56.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033Z" fill="#fff"/></svg>`,ARROW_DOWN_ICON:ar`<svg width="14" height="14" viewBox="0 0 14 14"><path d="M2.28 7.47a.75.75 0 0 0-1.06 1.06l5.25 5.25a.75.75 0 0 0 1.06 0l5.25-5.25a.75.75 0 0 0-1.06-1.06l-3.544 3.543a.25.25 0 0 1-.426-.177V.75a.75.75 0 0 0-1.5 0v10.086a.25.25 0 0 1-.427.176L2.28 7.47Z" fill="#fff"/></svg>`,ARROW_UP_RIGHT_ICON:ar`<svg width="15" height="14" fill="none"><path d="M4.5 1.75A.75.75 0 0 1 5.25 1H12a1.5 1.5 0 0 1 1.5 1.5v6.75a.75.75 0 0 1-1.5 0V4.164a.25.25 0 0 0-.427-.176L4.061 11.5A.75.75 0 0 1 3 10.44l7.513-7.513a.25.25 0 0 0-.177-.427H5.25a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,ARROW_RIGHT_ICON:ar`<svg width="6" height="14" viewBox="0 0 6 14"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.181 1.099a.75.75 0 0 1 1.024.279l2.433 4.258a2.75 2.75 0 0 1 0 2.729l-2.433 4.257a.75.75 0 1 1-1.303-.744L4.335 7.62a1.25 1.25 0 0 0 0-1.24L1.902 2.122a.75.75 0 0 1 .28-1.023Z" fill="#fff"/></svg>`,QRCODE_ICON:ar`<svg width="25" height="24" viewBox="0 0 25 24"><path d="M23.748 9a.748.748 0 0 0 .748-.752c-.018-2.596-.128-4.07-.784-5.22a6 6 0 0 0-2.24-2.24c-1.15-.656-2.624-.766-5.22-.784a.748.748 0 0 0-.752.748c0 .414.335.749.748.752 1.015.007 1.82.028 2.494.088.995.09 1.561.256 1.988.5.7.398 1.28.978 1.679 1.678.243.427.41.993.498 1.988.061.675.082 1.479.09 2.493a.753.753 0 0 0 .75.749ZM3.527.788C4.677.132 6.152.022 8.747.004A.748.748 0 0 1 9.5.752a.753.753 0 0 1-.749.752c-1.014.007-1.818.028-2.493.088-.995.09-1.561.256-1.988.5-.7.398-1.28.978-1.679 1.678-.243.427-.41.993-.499 1.988-.06.675-.081 1.479-.088 2.493A.753.753 0 0 1 1.252 9a.748.748 0 0 1-.748-.752c.018-2.596.128-4.07.784-5.22a6 6 0 0 1 2.24-2.24ZM1.252 15a.748.748 0 0 0-.748.752c.018 2.596.128 4.07.784 5.22a6 6 0 0 0 2.24 2.24c1.15.656 2.624.766 5.22.784a.748.748 0 0 0 .752-.748.753.753 0 0 0-.749-.752c-1.014-.007-1.818-.028-2.493-.089-.995-.089-1.561-.255-1.988-.498a4.5 4.5 0 0 1-1.679-1.68c-.243-.426-.41-.992-.499-1.987-.06-.675-.081-1.479-.088-2.493A.753.753 0 0 0 1.252 15ZM22.996 15.749a.753.753 0 0 1 .752-.749c.415 0 .751.338.748.752-.018 2.596-.128 4.07-.784 5.22a6 6 0 0 1-2.24 2.24c-1.15.656-2.624.766-5.22.784a.748.748 0 0 1-.752-.748c0-.414.335-.749.748-.752 1.015-.007 1.82-.028 2.494-.089.995-.089 1.561-.255 1.988-.498a4.5 4.5 0 0 0 1.679-1.68c.243-.426.41-.992.498-1.987.061-.675.082-1.479.09-2.493Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7 4a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 11h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 4H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1ZM13.5 6.5A2.5 2.5 0 0 1 16 4h2a2.5 2.5 0 0 1 2.5 2.5v2A2.5 2.5 0 0 1 18 11h-2a2.5 2.5 0 0 1-2.5-2.5v-2Zm2.5-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1ZM7 13a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 20h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 13H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1Z" fill="#fff"/><path d="M13.5 15.5c0-.465 0-.697.038-.89a2 2 0 0 1 1.572-1.572C15.303 13 15.535 13 16 13v2.5h-2.5ZM18 13c.465 0 .697 0 .89.038a2 2 0 0 1 1.572 1.572c.038.193.038.425.038.89H18V13ZM18 17.5h2.5c0 .465 0 .697-.038.89a2 2 0 0 1-1.572 1.572C18.697 20 18.465 20 18 20v-2.5ZM13.5 17.5H16V20c-.465 0-.697 0-.89-.038a2 2 0 0 1-1.572-1.572c-.038-.193-.038-.425-.038-.89Z" fill="#fff"/></svg>`,SCAN_ICON:ar`<svg width="16" height="16" fill="none"><path fill="#fff" d="M10 15.216c0 .422.347.763.768.74 1.202-.064 2.025-.222 2.71-.613a5.001 5.001 0 0 0 1.865-1.866c.39-.684.549-1.507.613-2.709a.735.735 0 0 0-.74-.768.768.768 0 0 0-.76.732c-.009.157-.02.306-.032.447-.073.812-.206 1.244-.384 1.555-.31.545-.761.996-1.306 1.306-.311.178-.743.311-1.555.384-.141.013-.29.023-.447.032a.768.768 0 0 0-.732.76ZM10 .784c0 .407.325.737.732.76.157.009.306.02.447.032.812.073 1.244.206 1.555.384a3.5 3.5 0 0 1 1.306 1.306c.178.311.311.743.384 1.555.013.142.023.29.032.447a.768.768 0 0 0 .76.732.734.734 0 0 0 .74-.768c-.064-1.202-.222-2.025-.613-2.71A5 5 0 0 0 13.477.658c-.684-.39-1.507-.549-2.709-.613a.735.735 0 0 0-.768.74ZM5.232.044A.735.735 0 0 1 6 .784a.768.768 0 0 1-.732.76c-.157.009-.305.02-.447.032-.812.073-1.244.206-1.555.384A3.5 3.5 0 0 0 1.96 3.266c-.178.311-.311.743-.384 1.555-.013.142-.023.29-.032.447A.768.768 0 0 1 .784 6a.735.735 0 0 1-.74-.768c.064-1.202.222-2.025.613-2.71A5 5 0 0 1 2.523.658C3.207.267 4.03.108 5.233.044ZM5.268 14.456a.768.768 0 0 1 .732.76.734.734 0 0 1-.768.74c-1.202-.064-2.025-.222-2.71-.613a5 5 0 0 1-1.865-1.866c-.39-.684-.549-1.507-.613-2.709A.735.735 0 0 1 .784 10c.407 0 .737.325.76.732.009.157.02.306.032.447.073.812.206 1.244.384 1.555a3.5 3.5 0 0 0 1.306 1.306c.311.178.743.311 1.555.384.142.013.29.023.447.032Z"/></svg>`,CHECKMARK_ICON:ar`<svg width="13" height="12" viewBox="0 0 13 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.155.132a.75.75 0 0 1 .232 1.035L5.821 11.535a1 1 0 0 1-1.626.09L.665 7.21a.75.75 0 1 1 1.17-.937L4.71 9.867a.25.25 0 0 0 .406-.023L11.12.364a.75.75 0 0 1 1.035-.232Z" fill="#fff"/></svg>`,SEARCH_ICON:ar`<svg width="20" height="21"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.432 13.992c-.354-.353-.91-.382-1.35-.146a5.5 5.5 0 1 1 2.265-2.265c-.237.441-.208.997.145 1.35l3.296 3.296a.75.75 0 1 1-1.06 1.061l-3.296-3.296Zm.06-5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z" fill="#949E9E"/></svg>`,WALLET_PLACEHOLDER:ar`<svg width="60" height="60" fill="none" viewBox="0 0 60 60"><g clip-path="url(#q)"><path id="wallet-placeholder-fill" fill="#fff" d="M0 24.9c0-9.251 0-13.877 1.97-17.332a15 15 0 0 1 5.598-5.597C11.023 0 15.648 0 24.9 0h10.2c9.252 0 13.877 0 17.332 1.97a15 15 0 0 1 5.597 5.598C60 11.023 60 15.648 60 24.9v10.2c0 9.252 0 13.877-1.97 17.332a15.001 15.001 0 0 1-5.598 5.597C48.977 60 44.352 60 35.1 60H24.9c-9.251 0-13.877 0-17.332-1.97a15 15 0 0 1-5.597-5.598C0 48.977 0 44.352 0 35.1V24.9Z"/><path id="wallet-placeholder-dash" stroke="#000" stroke-dasharray="4 4" stroke-width="1.5" d="M.04 41.708a231.598 231.598 0 0 1-.039-4.403l.75-.001L.75 35.1v-2.55H0v-5.1h.75V24.9l.001-2.204h-.75c.003-1.617.011-3.077.039-4.404l.75.016c.034-1.65.099-3.08.218-4.343l-.746-.07c.158-1.678.412-3.083.82-4.316l.713.236c.224-.679.497-1.296.827-1.875a14.25 14.25 0 0 1 1.05-1.585L3.076 5.9A15 15 0 0 1 5.9 3.076l.455.596a14.25 14.25 0 0 1 1.585-1.05c.579-.33 1.196-.603 1.875-.827l-.236-.712C10.812.674 12.217.42 13.895.262l.07.746C15.23.89 16.66.824 18.308.79l-.016-.75C19.62.012 21.08.004 22.695.001l.001.75L24.9.75h2.55V0h5.1v.75h2.55l2.204.001v-.75c1.617.003 3.077.011 4.404.039l-.016.75c1.65.034 3.08.099 4.343.218l.07-.746c1.678.158 3.083.412 4.316.82l-.236.713c.679.224 1.296.497 1.875.827a14.24 14.24 0 0 1 1.585 1.05l.455-.596A14.999 14.999 0 0 1 56.924 5.9l-.596.455c.384.502.735 1.032 1.05 1.585.33.579.602 1.196.827 1.875l.712-.236c.409 1.233.663 2.638.822 4.316l-.747.07c.119 1.264.184 2.694.218 4.343l.75-.016c.028 1.327.036 2.787.039 4.403l-.75.001.001 2.204v2.55H60v5.1h-.75v2.55l-.001 2.204h.75a231.431 231.431 0 0 1-.039 4.404l-.75-.016c-.034 1.65-.099 3.08-.218 4.343l.747.07c-.159 1.678-.413 3.083-.822 4.316l-.712-.236a10.255 10.255 0 0 1-.827 1.875 14.242 14.242 0 0 1-1.05 1.585l.596.455a14.997 14.997 0 0 1-2.824 2.824l-.455-.596c-.502.384-1.032.735-1.585 1.05-.579.33-1.196.602-1.875.827l.236.712c-1.233.409-2.638.663-4.316.822l-.07-.747c-1.264.119-2.694.184-4.343.218l.016.75c-1.327.028-2.787.036-4.403.039l-.001-.75-2.204.001h-2.55V60h-5.1v-.75H24.9l-2.204-.001v.75a231.431 231.431 0 0 1-4.404-.039l.016-.75c-1.65-.034-3.08-.099-4.343-.218l-.07.747c-1.678-.159-3.083-.413-4.316-.822l.236-.712a10.258 10.258 0 0 1-1.875-.827 14.252 14.252 0 0 1-1.585-1.05l-.455.596A14.999 14.999 0 0 1 3.076 54.1l.596-.455a14.24 14.24 0 0 1-1.05-1.585 10.259 10.259 0 0 1-.827-1.875l-.712.236C.674 49.188.42 47.783.262 46.105l.746-.07C.89 44.77.824 43.34.79 41.692l-.75.016Z"/><path fill="#fff" fill-rule="evenodd" d="M35.643 32.145c-.297-.743-.445-1.114-.401-1.275a.42.42 0 0 1 .182-.27c.134-.1.463-.1 1.123-.1.742 0 1.499.046 2.236-.05a6 6 0 0 0 5.166-5.166c.051-.39.051-.855.051-1.784 0-.928 0-1.393-.051-1.783a6 6 0 0 0-5.166-5.165c-.39-.052-.854-.052-1.783-.052h-7.72c-4.934 0-7.401 0-9.244 1.051a8 8 0 0 0-2.985 2.986C16.057 22.28 16.003 24.58 16 29 15.998 31.075 16 33.15 16 35.224A7.778 7.778 0 0 0 23.778 43H28.5c1.394 0 2.09 0 2.67-.116a6 6 0 0 0 4.715-4.714c.115-.58.115-1.301.115-2.744 0-1.31 0-1.964-.114-2.49a4.998 4.998 0 0 0-.243-.792Z" clip-rule="evenodd"/><path fill="#9EA9A9" fill-rule="evenodd" d="M37 18h-7.72c-2.494 0-4.266.002-5.647.126-1.361.122-2.197.354-2.854.728a6.5 6.5 0 0 0-2.425 2.426c-.375.657-.607 1.492-.729 2.853-.11 1.233-.123 2.777-.125 4.867 0 .7 0 1.05.097 1.181.096.13.182.181.343.2.163.02.518-.18 1.229-.581a6.195 6.195 0 0 1 3.053-.8H37c.977 0 1.32-.003 1.587-.038a4.5 4.5 0 0 0 3.874-3.874c.036-.268.039-.611.039-1.588 0-.976-.003-1.319-.038-1.587a4.5 4.5 0 0 0-3.875-3.874C38.32 18.004 37.977 18 37 18Zm-7.364 12.5h-7.414a4.722 4.722 0 0 0-4.722 4.723 6.278 6.278 0 0 0 6.278 6.278H28.5c1.466 0 1.98-.008 2.378-.087a4.5 4.5 0 0 0 3.535-3.536c.08-.397.087-.933.087-2.451 0-1.391-.009-1.843-.08-2.17a3.5 3.5 0 0 0-2.676-2.676c-.328-.072-.762-.08-2.108-.08Z" clip-rule="evenodd"/></g><defs><clipPath id="q"><path fill="#fff" d="M0 0h60v60H0z"/></clipPath></defs></svg>`,GLOBE_ICON:ar`<svg width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="#fff" fill-rule="evenodd" d="M15.5 8a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Zm-2.113.75c.301 0 .535.264.47.558a6.01 6.01 0 0 1-2.867 3.896c-.203.116-.42-.103-.334-.32.409-1.018.691-2.274.797-3.657a.512.512 0 0 1 .507-.477h1.427Zm.47-2.058c.065.294-.169.558-.47.558H11.96a.512.512 0 0 1-.507-.477c-.106-1.383-.389-2.638-.797-3.656-.087-.217.13-.437.333-.32a6.01 6.01 0 0 1 2.868 3.895Zm-4.402.558c.286 0 .515-.24.49-.525-.121-1.361-.429-2.534-.83-3.393-.279-.6-.549-.93-.753-1.112a.535.535 0 0 0-.724 0c-.204.182-.474.513-.754 1.112-.4.859-.708 2.032-.828 3.393a.486.486 0 0 0 .49.525h2.909Zm-5.415 0c.267 0 .486-.21.507-.477.106-1.383.389-2.638.797-3.656.087-.217-.13-.437-.333-.32a6.01 6.01 0 0 0-2.868 3.895c-.065.294.169.558.47.558H4.04ZM2.143 9.308c-.065-.294.169-.558.47-.558H4.04c.267 0 .486.21.507.477.106 1.383.389 2.639.797 3.657.087.217-.13.436-.333.32a6.01 6.01 0 0 1-2.868-3.896Zm3.913-.033a.486.486 0 0 1 .49-.525h2.909c.286 0 .515.24.49.525-.121 1.361-.428 2.535-.83 3.394-.279.6-.549.93-.753 1.112a.535.535 0 0 1-.724 0c-.204-.182-.474-.513-.754-1.112-.4-.859-.708-2.033-.828-3.394Z" clip-rule="evenodd"/></svg>`},oM=Tt`.wcm-toolbar-placeholder{top:0;bottom:0;left:0;right:0;width:100%;position:absolute;display:block;pointer-events:none;height:100px;border-radius:calc(var(--wcm-background-border-radius) * .9);background-color:var(--wcm-background-color);background-position:center;background-size:cover}.wcm-toolbar{height:38px;display:flex;position:relative;margin:5px 15px 5px 5px;justify-content:space-between;align-items:center}.wcm-toolbar img,.wcm-toolbar svg{height:28px;object-position:left center;object-fit:contain}#wcm-wc-logo path{fill:var(--wcm-accent-fill-color)}button{width:28px;height:28px;border-radius:var(--wcm-icon-button-border-radius);border:0;display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--wcm-color-bg-1);box-shadow:0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-bg-2)}button svg{display:block;object-position:center}button path{fill:var(--wcm-color-fg-1)}.wcm-toolbar div{display:flex}@media(hover:hover){button:hover{background-color:var(--wcm-color-bg-2)}}`;var aM=Object.defineProperty,cM=Object.getOwnPropertyDescriptor,lM=(t,e,r,n)=>{for(var i=n>1?void 0:n?cM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&aM(e,r,i),i};let vd=class extends mt{render(){return ve`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${Nt.WALLET_CONNECT_LOGO} <button @click="${io.close}">${Nt.CROSS_ICON}</button></div>`}};vd.styles=[xt.globalCss,oM],vd=lM([Ct("wcm-modal-backcard")],vd);const uM=Tt`main{padding:20px;padding-top:0;width:100%}`;var hM=Object.defineProperty,fM=Object.getOwnPropertyDescriptor,dM=(t,e,r,n)=>{for(var i=n>1?void 0:n?fM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&hM(e,r,i),i};let yd=class extends mt{render(){return ve`<main><slot></slot></main>`}};yd.styles=[xt.globalCss,uM],yd=dM([Ct("wcm-modal-content")],yd);const pM=Tt`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var gM=Object.defineProperty,mM=Object.getOwnPropertyDescriptor,vM=(t,e,r,n)=>{for(var i=n>1?void 0:n?mM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&gM(e,r,i),i};let wd=class extends mt{render(){return ve`<footer><slot></slot></footer>`}};wd.styles=[xt.globalCss,pM],wd=vM([Ct("wcm-modal-footer")],wd);const yM=Tt`header{display:flex;justify-content:center;align-items:center;padding:20px;position:relative}.wcm-border{border-bottom:1px solid var(--wcm-color-bg-2);margin-bottom:20px}header button{padding:15px 20px}header button:active{opacity:.5}@media(hover:hover){header button:hover{opacity:.5}}.wcm-back-btn{position:absolute;left:0}.wcm-action-btn{position:absolute;right:0}path{fill:var(--wcm-accent-color)}`;var wM=Object.defineProperty,bM=Object.getOwnPropertyDescriptor,Bc=(t,e,r,n)=>{for(var i=n>1?void 0:n?bM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&wM(e,r,i),i};let fo=class extends mt{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return ve`<button class="wcm-back-btn" @click="${rr.goBack}">${Nt.BACK_ICON}</button>`}actionBtnTemplate(){return ve`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const t={"wcm-border":this.border},e=rr.state.history.length>1,r=this.title?ve`<wcm-text variant="big-bold">${this.title}</wcm-text>`:ve`<slot></slot>`;return ve`<header class="${Hi(t)}">${e?this.backBtnTemplate():null} ${r} ${this.onAction?this.actionBtnTemplate():null}</header>`}};fo.styles=[xt.globalCss,yM],Bc([ht()],fo.prototype,"title",2),Bc([ht()],fo.prototype,"onAction",2),Bc([ht()],fo.prototype,"actionIcon",2),Bc([ht({type:Boolean})],fo.prototype,"border",2),fo=Bc([Ct("wcm-modal-header")],fo);const nt={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(t,e){const r=t.renderRoot.querySelector(e);if(!r)throw new Error(`${e} not found`);return r},getWalletIcon({id:t,image_id:e}){const{walletImages:r}=wn.state;return r!=null&&r[t]?r[t]:e?sn.getWalletImageUrl(e):""},getWalletName(t,e=!1){return e&&t.length>8?`${t.substring(0,8)}..`:t},isMobileAnimation(){return window.innerWidth<=nt.MOBILE_BREAKPOINT},async preloadImage(t){const e=new Promise((r,n)=>{const i=new Image;i.onload=r,i.onerror=n,i.crossOrigin="anonymous",i.src=t});return Promise.race([e,Ue.wait(3e3)])},getErrorMessage(t){return t instanceof Error?t.message:"Unknown Error"},debounce(t,e=500){let r;return(...n)=>{function i(){t(...n)}r&&clearTimeout(r),r=setTimeout(i,e)}},handleMobileLinking(t){const{walletConnectUri:e}=hr.state,{mobile:r,name:n}=t,i=r?.native,s=r?.universal;nt.setRecentWallet(t);function c(l){let f="";i?f=Ue.formatUniversalUrl(i,l,n):s&&(f=Ue.formatNativeUrl(s,l,n)),Ue.openHref(f,"_self")}e&&c(e)},handleAndroidLinking(){const{walletConnectUri:t}=hr.state;t&&(Ue.setWalletConnectAndroidDeepLink(t),Ue.openHref(t,"_self"))},async handleUriCopy(){const{walletConnectUri:t}=hr.state;if(t)try{await navigator.clipboard.writeText(t),vs.openToast("Link copied","success")}catch{vs.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:t}=wn.state,e=Object.values(t??{});return Object.values(e)},truncate(t,e=8){return t.length<=e?t:`${t.substring(0,4)}...${t.substring(t.length-4)}`},setRecentWallet(t){try{localStorage.setItem(nt.WCM_RECENT_WALLET_DATA,JSON.stringify(t))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const t=localStorage.getItem(nt.WCM_RECENT_WALLET_DATA);return t?JSON.parse(t):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes(t,e){return t.toUpperCase().includes(e.toUpperCase())},openWalletExplorerUrl(){Ue.openHref(nt.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:t,mobile:e}=Ue.getWalletRouterData(),r=!!t?.native,n=!!t?.universal,i=!!e?.native||!!e?.universal;return{isDesktop:r,isMobile:i,isWeb:n}},goToConnectingView(t){rr.setData({Wallet:t});const e=Ue.isMobile(),{isDesktop:r,isWeb:n,isMobile:i}=nt.getCachedRouterWalletPlatforms();e?i?rr.push("MobileConnecting"):n?rr.push("WebConnecting"):rr.push("InstallWallet"):r?rr.push("DesktopConnecting"):n?rr.push("WebConnecting"):i?rr.push("MobileQrcodeConnecting"):rr.push("InstallWallet")}},_M=Tt`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var EM=Object.defineProperty,AM=Object.getOwnPropertyDescriptor,bd=(t,e,r,n)=>{for(var i=n>1?void 0:n?AM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&EM(e,r,i),i};let Uc=class extends mt{constructor(){super(),this.view=rr.state.view,this.prevView=rr.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=rr.subscribe(t=>{this.view!==t.view&&this.onChangeRoute()})}firstUpdated(){this.resizeObserver=new ResizeObserver(([t])=>{const e=`${t.contentRect.height}px`;this.oldHeight!=="0px"&&ho(this.routerEl,{height:[this.oldHeight,e]},{duration:.2}),this.oldHeight=e}),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var t,e;(t=this.unsubscribe)==null||t.call(this),(e=this.resizeObserver)==null||e.disconnect()}get routerEl(){return nt.getShadowRootElement(this,".wcm-router")}get contentEl(){return nt.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return ve`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return ve`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return ve`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return ve`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return ve`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return ve`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return ve`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return ve`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return ve`<div>Not Found</div>`}}async onChangeRoute(){await ho(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=rr.state.view,ho(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return ve`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};Uc.styles=[xt.globalCss,_M],bd([on()],Uc.prototype,"view",2),bd([on()],Uc.prototype,"prevView",2),Uc=bd([Ct("wcm-modal-router")],Uc);const xM=Tt`div{height:36px;width:max-content;display:flex;justify-content:center;align-items:center;padding:9px 15px 11px;position:absolute;top:12px;box-shadow:0 6px 14px -6px rgba(10,16,31,.3),0 10px 32px -4px rgba(10,16,31,.15);z-index:2;left:50%;transform:translateX(-50%);pointer-events:none;backdrop-filter:blur(20px) saturate(1.8);-webkit-backdrop-filter:blur(20px) saturate(1.8);border-radius:var(--wcm-notification-border-radius);border:1px solid var(--wcm-color-overlay);background-color:var(--wcm-color-overlay)}svg{margin-right:5px}@-moz-document url-prefix(){div{background-color:var(--wcm-color-bg-3)}}.wcm-success path{fill:var(--wcm-accent-color)}.wcm-error path{fill:var(--wcm-error-color)}`;var SM=Object.defineProperty,IM=Object.getOwnPropertyDescriptor,Zw=(t,e,r,n)=>{for(var i=n>1?void 0:n?IM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&SM(e,r,i),i};let Su=class extends mt{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=vs.subscribe(t=>{t.open?(this.open=!0,this.timeout=setTimeout(()=>vs.closeToast(),2200)):(this.open=!1,clearTimeout(this.timeout))})}disconnectedCallback(){var t;(t=this.unsubscribe)==null||t.call(this),clearTimeout(this.timeout),vs.closeToast()}render(){const{message:t,variant:e}=vs.state,r={"wcm-success":e==="success","wcm-error":e==="error"};return this.open?ve`<div class="${Hi(r)}">${e==="success"?Nt.CHECKMARK_ICON:null} ${e==="error"?Nt.CROSS_ICON:null}<wcm-text variant="small-regular">${t}</wcm-text></div>`:null}};Su.styles=[xt.globalCss,xM],Zw([on()],Su.prototype,"open",2),Su=Zw([Ct("wcm-modal-toast")],Su);const DM=.1,Xw=2.5,Ki=7;function _d(t,e,r){return t===e?!1:(t-e<0?e-t:t-e)<=r+DM}function CM(t,e){const r=Array.prototype.slice.call(Tc.create(t,{errorCorrectionLevel:e}).modules.data,0),n=Math.sqrt(r.length);return r.reduce((i,s,c)=>(c%n===0?i.push([s]):i[i.length-1].push(s))&&i,[])}const OM={generate(t,e,r){const n="#141414",i="#ffffff",s=[],c=CM(t,"Q"),l=e/c.length,f=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];f.forEach(({x:I,y:R})=>{const W=(c.length-Ki)*l*I,Y=(c.length-Ki)*l*R,F=.45;for(let z=0;z<f.length;z+=1){const $=l*(Ki-z*2);s.push(ar`<rect fill="${z%2===0?n:i}" height="${$}" rx="${$*F}" ry="${$*F}" width="${$}" x="${W+l*z}" y="${Y+l*z}">`)}});const h=Math.floor((r+25)/l),m=c.length/2-h/2,_=c.length/2+h/2-1,E=[];c.forEach((I,R)=>{I.forEach((W,Y)=>{if(c[R][Y]&&!(R<Ki&&Y<Ki||R>c.length-(Ki+1)&&Y<Ki||R<Ki&&Y>c.length-(Ki+1))&&!(R>m&&R<_&&Y>m&&Y<_)){const F=R*l+l/2,z=Y*l+l/2;E.push([F,z])}})});const A={};return E.forEach(([I,R])=>{A[I]?A[I].push(R):A[I]=[R]}),Object.entries(A).map(([I,R])=>{const W=R.filter(Y=>R.every(F=>!_d(Y,F,l)));return[Number(I),W]}).forEach(([I,R])=>{R.forEach(W=>{s.push(ar`<circle cx="${I}" cy="${W}" fill="${n}" r="${l/Xw}">`)})}),Object.entries(A).filter(([I,R])=>R.length>1).map(([I,R])=>{const W=R.filter(Y=>R.some(F=>_d(Y,F,l)));return[Number(I),W]}).map(([I,R])=>{R.sort((Y,F)=>Y<F?-1:1);const W=[];for(const Y of R){const F=W.find(z=>z.some($=>_d(Y,$,l)));F?F.push(Y):W.push([Y])}return[I,W.map(Y=>[Y[0],Y[Y.length-1]])]}).forEach(([I,R])=>{R.forEach(([W,Y])=>{s.push(ar`<line x1="${I}" x2="${I}" y1="${W}" y2="${Y}" stroke="${n}" stroke-width="${l/(Xw/2)}" stroke-linecap="round">`)})}),s}},PM=Tt`@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}div{position:relative;user-select:none;display:block;overflow:hidden;aspect-ratio:1/1;animation:fadeIn ease .2s}.wcm-dark{background-color:#fff;border-radius:var(--wcm-container-border-radius);padding:18px;box-shadow:0 2px 5px #000}svg:first-child,wcm-wallet-image{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{width:25%;height:25%;border-radius:var(--wcm-wallet-icon-border-radius)}svg:first-child{transform:translateY(-50%) translateX(-50%) scale(.9)}svg:first-child path:first-child{fill:var(--wcm-accent-color)}svg:first-child path:last-child{stroke:var(--wcm-color-overlay)}`;var MM=Object.defineProperty,TM=Object.getOwnPropertyDescriptor,ya=(t,e,r,n)=>{for(var i=n>1?void 0:n?TM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&MM(e,r,i),i};let Wi=class extends mt{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const t=ms.state.themeMode==="light"?this.size:this.size-36;return ar`<svg height="${t}" width="${t}">${OM.generate(this.uri,t,t/4)}</svg>`}render(){const t={"wcm-dark":ms.state.themeMode==="dark"};return ve`<div style="${`width: ${this.size}px`}" class="${Hi(t)}">${this.walletId||this.imageUrl?ve`<wcm-wallet-image walletId="${Wr(this.walletId)}" imageId="${Wr(this.imageId)}" imageUrl="${Wr(this.imageUrl)}"></wcm-wallet-image>`:Nt.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};Wi.styles=[xt.globalCss,PM],ya([ht()],Wi.prototype,"uri",2),ya([ht({type:Number})],Wi.prototype,"size",2),ya([ht()],Wi.prototype,"imageId",2),ya([ht()],Wi.prototype,"walletId",2),ya([ht()],Wi.prototype,"imageUrl",2),Wi=ya([Ct("wcm-qrcode")],Wi);const $M=Tt`:host{position:relative;height:28px;width:80%}input{width:100%;height:100%;line-height:28px!important;border-radius:var(--wcm-input-border-radius);font-style:normal;font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',Roboto,Ubuntu,'Helvetica Neue',sans-serif;font-feature-settings:'case' on;font-weight:500;font-size:16px;letter-spacing:-.03em;padding:0 10px 0 34px;transition:.2s all ease;color:var(--wcm-color-fg-1);background-color:var(--wcm-color-bg-3);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay);caret-color:var(--wcm-accent-color)}input::placeholder{color:var(--wcm-color-fg-2)}svg{left:10px;top:4px;pointer-events:none;position:absolute;width:20px;height:20px}input:focus-within{box-shadow:inset 0 0 0 1px var(--wcm-accent-color)}path{fill:var(--wcm-color-fg-2)}`;var NM=Object.defineProperty,RM=Object.getOwnPropertyDescriptor,e2=(t,e,r,n)=>{for(var i=n>1?void 0:n?RM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&NM(e,r,i),i};let Iu=class extends mt{constructor(){super(...arguments),this.onChange=()=>null}render(){return ve`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${Nt.SEARCH_ICON}`}};Iu.styles=[xt.globalCss,$M],e2([ht()],Iu.prototype,"onChange",2),Iu=e2([Ct("wcm-search-input")],Iu);const LM=Tt`@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}svg{animation:rotate 2s linear infinite;display:flex;justify-content:center;align-items:center}svg circle{stroke-linecap:round;animation:dash 1.5s ease infinite;stroke:var(--wcm-accent-color)}`;var BM=Object.defineProperty,UM=Object.getOwnPropertyDescriptor,FM=(t,e,r,n)=>{for(var i=n>1?void 0:n?UM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&BM(e,r,i),i};let Ed=class extends mt{render(){return ve`<svg viewBox="0 0 50 50" width="24" height="24"><circle cx="25" cy="25" r="20" fill="none" stroke-width="4" stroke="#fff"/></svg>`}};Ed.styles=[xt.globalCss,LM],Ed=FM([Ct("wcm-spinner")],Ed);const jM=Tt`span{font-style:normal;font-family:var(--wcm-font-family);font-feature-settings:var(--wcm-font-feature-settings)}.wcm-xsmall-bold{font-family:var(--wcm-text-xsmall-bold-font-family);font-weight:var(--wcm-text-xsmall-bold-weight);font-size:var(--wcm-text-xsmall-bold-size);line-height:var(--wcm-text-xsmall-bold-line-height);letter-spacing:var(--wcm-text-xsmall-bold-letter-spacing);text-transform:var(--wcm-text-xsmall-bold-text-transform)}.wcm-xsmall-regular{font-family:var(--wcm-text-xsmall-regular-font-family);font-weight:var(--wcm-text-xsmall-regular-weight);font-size:var(--wcm-text-xsmall-regular-size);line-height:var(--wcm-text-xsmall-regular-line-height);letter-spacing:var(--wcm-text-xsmall-regular-letter-spacing);text-transform:var(--wcm-text-xsmall-regular-text-transform)}.wcm-small-thin{font-family:var(--wcm-text-small-thin-font-family);font-weight:var(--wcm-text-small-thin-weight);font-size:var(--wcm-text-small-thin-size);line-height:var(--wcm-text-small-thin-line-height);letter-spacing:var(--wcm-text-small-thin-letter-spacing);text-transform:var(--wcm-text-small-thin-text-transform)}.wcm-small-regular{font-family:var(--wcm-text-small-regular-font-family);font-weight:var(--wcm-text-small-regular-weight);font-size:var(--wcm-text-small-regular-size);line-height:var(--wcm-text-small-regular-line-height);letter-spacing:var(--wcm-text-small-regular-letter-spacing);text-transform:var(--wcm-text-small-regular-text-transform)}.wcm-medium-regular{font-family:var(--wcm-text-medium-regular-font-family);font-weight:var(--wcm-text-medium-regular-weight);font-size:var(--wcm-text-medium-regular-size);line-height:var(--wcm-text-medium-regular-line-height);letter-spacing:var(--wcm-text-medium-regular-letter-spacing);text-transform:var(--wcm-text-medium-regular-text-transform)}.wcm-big-bold{font-family:var(--wcm-text-big-bold-font-family);font-weight:var(--wcm-text-big-bold-weight);font-size:var(--wcm-text-big-bold-size);line-height:var(--wcm-text-big-bold-line-height);letter-spacing:var(--wcm-text-big-bold-letter-spacing);text-transform:var(--wcm-text-big-bold-text-transform)}:host(*){color:var(--wcm-color-fg-1)}.wcm-color-primary{color:var(--wcm-color-fg-1)}.wcm-color-secondary{color:var(--wcm-color-fg-2)}.wcm-color-tertiary{color:var(--wcm-color-fg-3)}.wcm-color-inverse{color:var(--wcm-accent-fill-color)}.wcm-color-accnt{color:var(--wcm-accent-color)}.wcm-color-error{color:var(--wcm-error-color)}`;var kM=Object.defineProperty,qM=Object.getOwnPropertyDescriptor,Ad=(t,e,r,n)=>{for(var i=n>1?void 0:n?qM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&kM(e,r,i),i};let Fc=class extends mt{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const t={"wcm-big-bold":this.variant==="big-bold","wcm-medium-regular":this.variant==="medium-regular","wcm-small-regular":this.variant==="small-regular","wcm-small-thin":this.variant==="small-thin","wcm-xsmall-regular":this.variant==="xsmall-regular","wcm-xsmall-bold":this.variant==="xsmall-bold","wcm-color-primary":this.color==="primary","wcm-color-secondary":this.color==="secondary","wcm-color-tertiary":this.color==="tertiary","wcm-color-inverse":this.color==="inverse","wcm-color-accnt":this.color==="accent","wcm-color-error":this.color==="error"};return ve`<span><slot class="${Hi(t)}"></slot></span>`}};Fc.styles=[xt.globalCss,jM],Ad([ht()],Fc.prototype,"variant",2),Ad([ht()],Fc.prototype,"color",2),Fc=Ad([Ct("wcm-text")],Fc);const zM=Tt`button{width:100%;height:100%;border-radius:var(--wcm-button-hover-highlight-border-radius);display:flex;align-items:flex-start}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}button>div{width:80px;padding:5px 0;display:flex;flex-direction:column;align-items:center}wcm-text{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}wcm-wallet-image{height:60px;width:60px;transition:all .2s ease;border-radius:var(--wcm-wallet-icon-border-radius);margin-bottom:5px}.wcm-sublabel{margin-top:2px}`;var HM=Object.defineProperty,KM=Object.getOwnPropertyDescriptor,As=(t,e,r,n)=>{for(var i=n>1?void 0:n?KM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&HM(e,r,i),i};let Si=class extends mt{constructor(){super(...arguments),this.onClick=()=>null,this.name="",this.walletId="",this.label=void 0,this.imageId=void 0,this.installed=!1,this.recent=!1}sublabelTemplate(){return this.recent?ve`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?ve`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){By.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var t;return ve`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${Wr(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${(t=this.label)!=null?t:nt.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};Si.styles=[xt.globalCss,zM],As([ht()],Si.prototype,"onClick",2),As([ht()],Si.prototype,"name",2),As([ht()],Si.prototype,"walletId",2),As([ht()],Si.prototype,"label",2),As([ht()],Si.prototype,"imageId",2),As([ht({type:Boolean})],Si.prototype,"installed",2),As([ht({type:Boolean})],Si.prototype,"recent",2),Si=As([Ct("wcm-wallet-button")],Si);const WM=Tt`:host{display:block}div{overflow:hidden;position:relative;border-radius:inherit;width:100%;height:100%;background-color:var(--wcm-color-overlay)}svg{position:relative;width:100%;height:100%}div::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;border-radius:inherit;border:1px solid var(--wcm-color-overlay)}div img{width:100%;height:100%;object-fit:cover;object-position:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var VM=Object.defineProperty,GM=Object.getOwnPropertyDescriptor,Du=(t,e,r,n)=>{for(var i=n>1?void 0:n?GM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&VM(e,r,i),i};let wa=class extends mt{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var t;const e=(t=this.imageUrl)!=null&&t.length?this.imageUrl:nt.getWalletIcon({id:this.walletId,image_id:this.imageId});return ve`${e.length?ve`<div><img crossorigin="anonymous" src="${e}" alt="${this.id}"></div>`:Nt.WALLET_PLACEHOLDER}`}};wa.styles=[xt.globalCss,WM],Du([ht()],wa.prototype,"walletId",2),Du([ht()],wa.prototype,"imageId",2),Du([ht()],wa.prototype,"imageUrl",2),wa=Du([Ct("wcm-wallet-image")],wa);var YM=Object.defineProperty,JM=Object.getOwnPropertyDescriptor,t2=(t,e,r,n)=>{for(var i=n>1?void 0:n?JM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&YM(e,r,i),i};let xd=class extends mt{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(t){try{t!=null&&t.length&&await Promise.all(t.map(async e=>nt.preloadImage(e)))}catch{console.info("Unsuccessful attempt at preloading some images",t)}}async preloadListings(){if(wn.state.enableExplorer){await sn.getRecomendedWallets(),hr.setIsDataLoaded(!0);const{recomendedWallets:t}=sn.state,e=t.map(r=>nt.getWalletIcon(r));await this.loadImages(e)}else hr.setIsDataLoaded(!0)}async preloadCustomImages(){const t=nt.getCustomImageUrls();await this.loadImages(t)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(t){console.error(t),vs.openToast("Failed preloading","error")}}};t2([on()],xd.prototype,"preload",2),xd=t2([Ct("wcm-explorer-context")],xd);var QM=Object.defineProperty,ZM=Object.getOwnPropertyDescriptor,XM=(t,e,r,n)=>{for(var i=n>1?void 0:n?ZM(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&QM(e,r,i),i};let r2=class extends mt{constructor(){super(),this.unsubscribeTheme=void 0,xt.setTheme(),this.unsubscribeTheme=ms.subscribe(xt.setTheme)}disconnectedCallback(){var t;(t=this.unsubscribeTheme)==null||t.call(this)}};r2=XM([Ct("wcm-theme-context")],r2);const eT=Tt`@keyframes scroll{0%{transform:translate3d(0,0,0)}100%{transform:translate3d(calc(-70px * 9),0,0)}}.wcm-slider{position:relative;overflow-x:hidden;padding:10px 0;margin:0 -20px;width:calc(100% + 40px)}.wcm-track{display:flex;width:calc(70px * 18);animation:scroll 20s linear infinite;opacity:.7}.wcm-track svg{margin:0 5px}wcm-wallet-image{width:60px;height:60px;margin:0 5px;border-radius:var(--wcm-wallet-icon-border-radius)}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-title{display:flex;align-items:center;margin-bottom:10px}.wcm-title svg{margin-right:6px}.wcm-title path{fill:var(--wcm-accent-color)}wcm-modal-footer .wcm-title{padding:0 10px}wcm-button-big{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);filter:drop-shadow(0 0 17px var(--wcm-color-bg-1))}wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-info-footer wcm-text{text-align:center;margin-bottom:15px}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var tT=Object.defineProperty,rT=Object.getOwnPropertyDescriptor,nT=(t,e,r,n)=>{for(var i=n>1?void 0:n?rT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&tT(e,r,i),i};let Sd=class extends mt{onGoToQrcode(){rr.push("Qrcode")}render(){const{recomendedWallets:t}=sn.state,e=[...t,...t],r=Ue.RECOMMENDED_WALLET_AMOUNT*2;return ve`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${Nt.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${Nt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(r)].map((n,i)=>{const s=e[i%e.length];return s?ve`<wcm-wallet-image walletId="${s.id}" imageId="${s.image_id}"></wcm-wallet-image>`:Nt.WALLET_PLACEHOLDER})}</div><wcm-button-big @click="${nt.handleAndroidLinking}"><wcm-text variant="medium-regular" color="inverse">Select Wallet</wcm-text></wcm-button-big></div></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">Choose WalletConnect to see supported apps on your device</wcm-text></wcm-info-footer>`}};Sd.styles=[xt.globalCss,eT],Sd=nT([Ct("wcm-android-wallet-selection")],Sd);const iT=Tt`@keyframes loading{to{stroke-dashoffset:0}}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(1px,0,0)}30%,50%,70%{transform:translate3d(-2px,0,0)}40%,60%{transform:translate3d(2px,0,0)}}:host{display:flex;flex-direction:column;align-items:center}div{position:relative;width:110px;height:110px;display:flex;justify-content:center;align-items:center;margin:40px 0 20px 0;transform:translate3d(0,0,0)}svg{position:absolute;width:110px;height:110px;fill:none;stroke:transparent;stroke-linecap:round;stroke-width:2px;top:0;left:0}use{stroke:var(--wcm-accent-color);animation:loading 1s linear infinite}wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:90px;height:90px}wcm-text{margin-bottom:40px}.wcm-error svg{stroke:var(--wcm-error-color)}.wcm-error use{display:none}.wcm-error{animation:shake .4s cubic-bezier(.36,.07,.19,.97) both}.wcm-stale svg,.wcm-stale use{display:none}`;var sT=Object.defineProperty,oT=Object.getOwnPropertyDescriptor,ba=(t,e,r,n)=>{for(var i=n>1?void 0:n?oT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&sT(e,r,i),i};let xs=class extends mt{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var t,e;const r=(e=(t=ms.state.themeVariables)==null?void 0:t["--wcm-wallet-icon-large-border-radius"])!=null?e:xt.getPreset("--wcm-wallet-icon-large-border-radius");let n=0;r.includes("%")?n=88/100*parseInt(r,10):n=parseInt(r,10),n*=1.17;const i=317-n*1.57,s=425-n*1.8;return ve`<svg viewBox="0 0 110 110" width="110" height="110"><rect id="wcm-loader" x="2" y="2" width="106" height="106" rx="${n}"/><use xlink:href="#wcm-loader" stroke-dasharray="106 ${i}" stroke-dashoffset="${s}"></use></svg>`}render(){const t={"wcm-error":this.isError,"wcm-stale":this.isStale};return ve`<div class="${Hi(t)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${Wr(this.walletId)}" imageId="${Wr(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};xs.styles=[xt.globalCss,iT],ba([ht()],xs.prototype,"walletId",2),ba([ht()],xs.prototype,"imageId",2),ba([ht({type:Boolean})],xs.prototype,"isError",2),ba([ht({type:Boolean})],xs.prototype,"isStale",2),ba([ht()],xs.prototype,"label",2),xs=ba([Ct("wcm-connector-waiting")],xs);const _a={manualWallets(){var t,e;const{mobileWallets:r,desktopWallets:n}=wn.state,i=(t=_a.recentWallet())==null?void 0:t.id,s=Ue.isMobile()?r:n,c=s?.filter(l=>i!==l.id);return(e=Ue.isMobile()?c?.map(({id:l,name:f,links:h})=>({id:l,name:f,mobile:h,links:h})):c?.map(({id:l,name:f,links:h})=>({id:l,name:f,desktop:h,links:h})))!=null?e:[]},recentWallet(){return nt.getRecentWallet()},recomendedWallets(t=!1){var e;const r=t||(e=_a.recentWallet())==null?void 0:e.id,{recomendedWallets:n}=sn.state;return n.filter(i=>r!==i.id)}},Ss={onConnecting(t){nt.goToConnectingView(t)},manualWalletsTemplate(){return _a.manualWallets().map(t=>ve`<wcm-wallet-button walletId="${t.id}" name="${t.name}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`)},recomendedWalletsTemplate(t=!1){return _a.recomendedWallets(t).map(e=>ve`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${e.image_id}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`)},recentWalletTemplate(){const t=_a.recentWallet();if(t)return ve`<wcm-wallet-button name="${t.name}" walletId="${t.id}" imageId="${Wr(t.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`}},aT=Tt`.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-desktop-title,.wcm-mobile-title{display:flex;align-items:center}.wcm-mobile-title{justify-content:space-between;margin-bottom:20px;margin-top:-10px}.wcm-desktop-title{margin-bottom:10px;padding:0 10px}.wcm-subtitle{display:flex;align-items:center}.wcm-subtitle:last-child path{fill:var(--wcm-color-fg-3)}.wcm-desktop-title svg,.wcm-mobile-title svg{margin-right:6px}.wcm-desktop-title path,.wcm-mobile-title path{fill:var(--wcm-accent-color)}`;var cT=Object.defineProperty,lT=Object.getOwnPropertyDescriptor,uT=(t,e,r,n)=>{for(var i=n>1?void 0:n?lT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&cT(e,r,i),i};let Id=class extends mt{render(){const{explorerExcludedWalletIds:t,enableExplorer:e}=wn.state,r=t!=="ALL"&&e,n=Ss.manualWalletsTemplate(),i=Ss.recomendedWalletsTemplate();let s=[Ss.recentWalletTemplate(),...n,...i];s=s.filter(Boolean);const c=s.length>4||r;let l=[];c?l=s.slice(0,3):l=s;const f=!!l.length;return ve`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${nt.handleUriCopy}" .actionIcon="${Nt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${Nt.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${Nt.SCAN_ICON}<wcm-text variant="small-regular" color="secondary">Scan with your wallet</wcm-text></div></div><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>${f?ve`<wcm-modal-footer><div class="wcm-desktop-title">${Nt.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${l} ${c?ve`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};Id.styles=[xt.globalCss,aT],Id=uT([Ct("wcm-desktop-wallet-selection")],Id);const hT=Tt`div{background-color:var(--wcm-color-bg-2);padding:10px 20px 15px 20px;border-top:1px solid var(--wcm-color-bg-3);text-align:center}a{color:var(--wcm-accent-color);text-decoration:none;transition:opacity .2s ease-in-out;display:inline}a:active{opacity:.8}@media(hover:hover){a:hover{opacity:.8}}`;var fT=Object.defineProperty,dT=Object.getOwnPropertyDescriptor,pT=(t,e,r,n)=>{for(var i=n>1?void 0:n?dT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&fT(e,r,i),i};let Dd=class extends mt{render(){const{termsOfServiceUrl:t,privacyPolicyUrl:e}=wn.state;return t??e?ve`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${t?ve`<a href="${t}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${t&&e?"and":null} ${e?ve`<a href="${e}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};Dd.styles=[xt.globalCss,hT],Dd=pT([Ct("wcm-legal-notice")],Dd);const gT=Tt`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var mT=Object.defineProperty,vT=Object.getOwnPropertyDescriptor,yT=(t,e,r,n)=>{for(var i=n>1?void 0:n?vT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&mT(e,r,i),i};let Cd=class extends mt{onQrcode(){rr.push("Qrcode")}render(){const{explorerExcludedWalletIds:t,enableExplorer:e}=wn.state,r=t!=="ALL"&&e,n=Ss.manualWalletsTemplate(),i=Ss.recomendedWalletsTemplate();let s=[Ss.recentWalletTemplate(),...n,...i];s=s.filter(Boolean);const c=s.length>8||r;let l=[];c?l=s.slice(0,7):l=s;const f=!!l.length;return ve`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${Nt.QRCODE_ICON}"></wcm-modal-header>${f?ve`<wcm-modal-content><div>${l} ${c?ve`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};Cd.styles=[xt.globalCss,gT],Cd=yT([Ct("wcm-mobile-wallet-selection")],Cd);const wT=Tt`:host{all:initial}.wcm-overlay{top:0;bottom:0;left:0;right:0;position:fixed;z-index:var(--wcm-z-index);overflow:hidden;display:flex;justify-content:center;align-items:center;opacity:0;pointer-events:none;background-color:var(--wcm-overlay-background-color);backdrop-filter:var(--wcm-overlay-backdrop-filter)}@media(max-height:720px) and (orientation:landscape){.wcm-overlay{overflow:scroll;align-items:flex-start;padding:20px 0}}.wcm-active{pointer-events:auto}.wcm-container{position:relative;max-width:360px;width:100%;outline:0;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) var(--wcm-container-border-radius) var(--wcm-container-border-radius);border:1px solid var(--wcm-color-overlay);overflow:hidden}.wcm-card{width:100%;position:relative;border-radius:var(--wcm-container-border-radius);overflow:hidden;box-shadow:0 6px 14px -6px rgba(10,16,31,.12),0 10px 32px -4px rgba(10,16,31,.1),0 0 0 1px var(--wcm-color-overlay);background-color:var(--wcm-color-bg-1);color:var(--wcm-color-fg-1)}@media(max-width:600px){.wcm-container{max-width:440px;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) 0 0}.wcm-card{border-radius:var(--wcm-container-border-radius) var(--wcm-container-border-radius) 0 0}.wcm-overlay{align-items:flex-end}}@media(max-width:440px){.wcm-container{border:0}}`;var bT=Object.defineProperty,_T=Object.getOwnPropertyDescriptor,Od=(t,e,r,n)=>{for(var i=n>1?void 0:n?_T(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&bT(e,r,i),i};let Ea=class extends mt{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=io.subscribe(t=>{t.open?this.onOpenModalEvent():this.onCloseModalEvent()})}disconnectedCallback(){var t;(t=this.unsubscribeModal)==null||t.call(this)}get overlayEl(){return nt.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return nt.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(t){document.querySelector("body")&&(t?document.getElementById("wcm-styles")?.remove():document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>'))}onCloseModal(t){t.target===t.currentTarget&&io.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout(async()=>{const t=nt.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]},e=.1,r=.2;await Promise.all([ho(this.overlayEl,{opacity:[0,1]},{delay:e,duration:r}).finished,ho(this.containerEl,t,{delay:e,duration:r}).finished]),this.active=!0},0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const t=nt.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]},e=.2;await Promise.all([ho(this.overlayEl,{opacity:[1,0]},{duration:e}).finished,ho(this.containerEl,t,{duration:e}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",t=>{var e;t.key==="Escape"?io.close():t.key==="Tab"&&((e=t.target)!=null&&e.tagName.includes("wcm-")||this.containerEl.focus())},this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var t;(t=this.abortController)==null||t.abort(),this.abortController=void 0}render(){const t={"wcm-overlay":!0,"wcm-active":this.active};return ve`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${Hi(t)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?ve`<wcm-modal-backcard></wcm-modal-backcard><div class="wcm-card"><wcm-modal-router></wcm-modal-router><wcm-modal-toast></wcm-modal-toast></div>`:null}</div></div>`}};Ea.styles=[xt.globalCss,wT],Od([on()],Ea.prototype,"open",2),Od([on()],Ea.prototype,"active",2),Ea=Od([Ct("wcm-modal")],Ea);const ET=Tt`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var AT=Object.defineProperty,xT=Object.getOwnPropertyDescriptor,jc=(t,e,r,n)=>{for(var i=n>1?void 0:n?xT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&AT(e,r,i),i};let po=class extends mt{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){Ue.isMobile()?rr.replace("MobileConnecting"):rr.replace("MobileQrcodeConnecting")}onDesktop(){rr.replace("DesktopConnecting")}onWeb(){rr.replace("WebConnecting")}render(){return ve`<div>${this.isRetry?ve`<slot></slot>`:null} ${this.isMobile?ve`<wcm-button .onClick="${this.onMobile}" .iconLeft="${Nt.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?ve`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${Nt.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?ve`<wcm-button .onClick="${this.onWeb}" .iconLeft="${Nt.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};po.styles=[xt.globalCss,ET],jc([ht({type:Boolean})],po.prototype,"isMobile",2),jc([ht({type:Boolean})],po.prototype,"isDesktop",2),jc([ht({type:Boolean})],po.prototype,"isWeb",2),jc([ht({type:Boolean})],po.prototype,"isRetry",2),po=jc([Ct("wcm-platform-selection")],po);const ST=Tt`button{display:flex;flex-direction:column;padding:5px 10px;border-radius:var(--wcm-button-hover-highlight-border-radius);height:100%;justify-content:flex-start}.wcm-icons{width:60px;height:60px;display:flex;flex-wrap:wrap;padding:7px;border-radius:var(--wcm-wallet-icon-border-radius);justify-content:space-between;align-items:center;margin-bottom:5px;background-color:var(--wcm-color-bg-2);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}.wcm-icons img{width:21px;height:21px;object-fit:cover;object-position:center;border-radius:calc(var(--wcm-wallet-icon-border-radius)/ 2);border:1px solid var(--wcm-color-overlay)}.wcm-icons svg{width:21px;height:21px}.wcm-icons img:nth-child(1),.wcm-icons img:nth-child(2),.wcm-icons svg:nth-child(1),.wcm-icons svg:nth-child(2){margin-bottom:4px}wcm-text{width:100%;text-align:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var IT=Object.defineProperty,DT=Object.getOwnPropertyDescriptor,CT=(t,e,r,n)=>{for(var i=n>1?void 0:n?DT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&IT(e,r,i),i};let Pd=class extends mt{onClick(){rr.push("WalletExplorer")}render(){const{recomendedWallets:t}=sn.state,e=_a.manualWallets(),r=[...t,...e].reverse().slice(0,4);return ve`<button @click="${this.onClick}"><div class="wcm-icons">${r.map(n=>{const i=nt.getWalletIcon(n);if(i)return ve`<img crossorigin="anonymous" src="${i}">`;const s=nt.getWalletIcon({id:n.id});return s?ve`<img crossorigin="anonymous" src="${s}">`:Nt.WALLET_PLACEHOLDER})} ${[...Array(4-r.length)].map(()=>Nt.WALLET_PLACEHOLDER)}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};Pd.styles=[xt.globalCss,ST],Pd=CT([Ct("wcm-view-all-wallets-button")],Pd);const OT=Tt`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var PT=Object.defineProperty,MT=Object.getOwnPropertyDescriptor,Cu=(t,e,r,n)=>{for(var i=n>1?void 0:n?MT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&PT(e,r,i),i};let Aa=class extends mt{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout(()=>{const{walletConnectUri:t}=hr.state;this.uri=t},0)}get overlayEl(){return nt.getShadowRootElement(this,".wcm-qr-container")}render(){return ve`<div class="wcm-qr-container">${this.uri?ve`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${Wr(this.walletId)}" imageId="${Wr(this.imageId)}"></wcm-qrcode>`:ve`<wcm-spinner></wcm-spinner>`}</div>`}};Aa.styles=[xt.globalCss,OT],Cu([ht()],Aa.prototype,"walletId",2),Cu([ht()],Aa.prototype,"imageId",2),Cu([on()],Aa.prototype,"uri",2),Aa=Cu([Ct("wcm-walletconnect-qr")],Aa);var TT=Object.defineProperty,$T=Object.getOwnPropertyDescriptor,NT=(t,e,r,n)=>{for(var i=n>1?void 0:n?$T(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&TT(e,r,i),i};let Md=class extends mt{viewTemplate(){return Ue.isAndroid()?ve`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:Ue.isMobile()?ve`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:ve`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return ve`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};Md.styles=[xt.globalCss],Md=NT([Ct("wcm-connect-wallet-view")],Md);const RT=Tt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var LT=Object.defineProperty,BT=Object.getOwnPropertyDescriptor,n2=(t,e,r,n)=>{for(var i=n>1?void 0:n?BT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&LT(e,r,i),i};let Ou=class extends mt{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(t){const{desktop:e,name:r}=Ue.getWalletRouterData(),n=e?.native;if(n){const i=Ue.formatNativeUrl(n,t,r);Ue.openHref(i,"_self")}}openDesktopApp(){const{walletConnectUri:t}=hr.state,e=Ue.getWalletRouterData();nt.setRecentWallet(e),t&&this.onFormatAndRedirect(t)}render(){const{name:t,id:e,image_id:r}=Ue.getWalletRouterData(),{isMobile:n,isWeb:i}=nt.getCachedRouterWalletPlatforms();return ve`<wcm-modal-header title="${t}" .onAction="${nt.handleUriCopy}" .actionIcon="${Nt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Wr(r)}" label="${`Continue in ${t}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${t} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isWeb="${i}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${Nt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Ou.styles=[xt.globalCss,RT],n2([on()],Ou.prototype,"isError",2),Ou=n2([Ct("wcm-desktop-connecting-view")],Ou);const UT=Tt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}wcm-button{margin-top:15px}`;var FT=Object.defineProperty,jT=Object.getOwnPropertyDescriptor,kT=(t,e,r,n)=>{for(var i=n>1?void 0:n?jT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&FT(e,r,i),i};let Td=class extends mt{onInstall(t){t&&Ue.openHref(t,"_blank")}render(){const{name:t,id:e,image_id:r,homepage:n}=Ue.getWalletRouterData();return ve`<wcm-modal-header title="${t}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Wr(r)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${t} to continue. If multiple browser extensions are installed, disable non ${t} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(n)}" .iconLeft="${Nt.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};Td.styles=[xt.globalCss,UT],Td=kT([Ct("wcm-install-wallet-view")],Td);const qT=Tt`wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:96px;height:96px;margin-bottom:20px}wcm-info-footer{display:flex;width:100%}.wcm-app-store{justify-content:space-between}.wcm-app-store wcm-wallet-image{margin-right:10px;margin-bottom:0;width:28px;height:28px;border-radius:var(--wcm-wallet-icon-small-border-radius)}.wcm-app-store div{display:flex;align-items:center}.wcm-app-store wcm-button{margin-right:-10px}.wcm-note{flex-direction:column;align-items:center;padding:5px 0}.wcm-note wcm-text{text-align:center}wcm-platform-selection{margin-top:-15px}.wcm-note wcm-text{margin-top:15px}.wcm-note wcm-text span{color:var(--wcm-accent-color)}`;var zT=Object.defineProperty,HT=Object.getOwnPropertyDescriptor,i2=(t,e,r,n)=>{for(var i=n>1?void 0:n?HT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&zT(e,r,i),i};let Pu=class extends mt{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(t,e=!1){const{mobile:r,name:n}=Ue.getWalletRouterData(),i=r?.native,s=r?.universal;if(i&&!e){const c=Ue.formatNativeUrl(i,t,n);Ue.openHref(c,"_self")}else if(s){const c=Ue.formatUniversalUrl(s,t,n);Ue.openHref(c,"_self")}}openMobileApp(t=!1){const{walletConnectUri:e}=hr.state,r=Ue.getWalletRouterData();nt.setRecentWallet(r),e&&this.onFormatAndRedirect(e,t)}onGoToAppStore(t){t&&Ue.openHref(t,"_blank")}render(){const{name:t,id:e,image_id:r,app:n,mobile:i}=Ue.getWalletRouterData(),{isWeb:s}=nt.getCachedRouterWalletPlatforms(),c=n?.ios,l=i?.universal;return ve`<wcm-modal-header title="${t}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Wr(r)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${s}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${Nt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${l?ve`<wcm-text color="secondary" variant="small-thin">Still doesn't work? <span tabindex="0" @click="${()=>this.openMobileApp(!0)}">Try this alternate link</span></wcm-text>`:null}</wcm-info-footer><wcm-info-footer class="wcm-app-store"><div><wcm-wallet-image walletId="${e}" imageId="${Wr(r)}"></wcm-wallet-image><wcm-text>${`Get ${t}`}</wcm-text></div><wcm-button .iconRight="${Nt.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(c)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};Pu.styles=[xt.globalCss,qT],i2([on()],Pu.prototype,"isError",2),Pu=i2([Ct("wcm-mobile-connecting-view")],Pu);const KT=Tt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var WT=Object.defineProperty,VT=Object.getOwnPropertyDescriptor,GT=(t,e,r,n)=>{for(var i=n>1?void 0:n?VT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&WT(e,r,i),i};let $d=class extends mt{render(){const{name:t,id:e,image_id:r}=Ue.getWalletRouterData(),{isDesktop:n,isWeb:i}=nt.getCachedRouterWalletPlatforms();return ve`<wcm-modal-header title="${t}" .onAction="${nt.handleUriCopy}" .actionIcon="${Nt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${e}" imageId="${Wr(r)}"></wcm-walletconnect-qr></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Scan this QR Code with your phone's camera or inside ${t} app`}</wcm-text><wcm-platform-selection .isDesktop="${n}" .isWeb="${i}"></wcm-platform-selection></wcm-info-footer>`}};$d.styles=[xt.globalCss,KT],$d=GT([Ct("wcm-mobile-qr-connecting-view")],$d);var YT=Object.defineProperty,JT=Object.getOwnPropertyDescriptor,QT=(t,e,r,n)=>{for(var i=n>1?void 0:n?JT(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&YT(e,r,i),i};let Nd=class extends mt{render(){return ve`<wcm-modal-header title="Scan the code" .onAction="${nt.handleUriCopy}" .actionIcon="${Nt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};Nd.styles=[xt.globalCss],Nd=QT([Ct("wcm-qrcode-view")],Nd);const ZT=Tt`wcm-modal-content{height:clamp(200px,60vh,600px);display:block;overflow:scroll;scrollbar-width:none;position:relative;margin-top:1px}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between;margin:-15px -10px;padding-top:20px}wcm-modal-content::after,wcm-modal-content::before{content:'';position:fixed;pointer-events:none;z-index:1;width:100%;height:20px;opacity:1}wcm-modal-content::before{box-shadow:0 -1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(var(--wcm-color-bg-1),rgba(255,255,255,0))}wcm-modal-content::after{box-shadow:0 1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(rgba(255,255,255,0),var(--wcm-color-bg-1));top:calc(100% - 20px)}wcm-modal-content::-webkit-scrollbar{display:none}.wcm-placeholder-block{display:flex;justify-content:center;align-items:center;height:100px;overflow:hidden}.wcm-empty,.wcm-loading{display:flex}.wcm-loading .wcm-placeholder-block{height:100%}.wcm-end-reached .wcm-placeholder-block{height:0;opacity:0}.wcm-empty .wcm-placeholder-block{opacity:1;height:100%}wcm-wallet-button{margin:calc((100% - 60px)/ 3) 0}`;var XT=Object.defineProperty,e$=Object.getOwnPropertyDescriptor,kc=(t,e,r,n)=>{for(var i=n>1?void 0:n?e$(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&XT(e,r,i),i};const Rd=40;let go=class extends mt{constructor(){super(...arguments),this.loading=!sn.state.wallets.listings.length,this.firstFetch=!sn.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=nt.debounce(t=>{t.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=t,sn.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),sn.resetSearch())})}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var t;(t=this.intersectionObserver)==null||t.disconnect()}get placeholderEl(){return nt.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver(([t])=>{t.isIntersecting&&!(this.search&&this.firstFetch)&&this.fetchWallets()}),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:t,search:e}=sn.state,{listings:r,total:n}=this.search?e:t;return n<=Rd||r.length>=n}async fetchWallets(){var t;const{wallets:e,search:r}=sn.state,{listings:n,total:i,page:s}=this.search?r:e;if(!this.endReached&&(this.firstFetch||i>Rd&&n.length<i))try{this.loading=!0;const c=(t=hr.state.chains)==null?void 0:t.join(","),{listings:l}=await sn.getWallets({page:this.firstFetch?1:s+1,entries:Rd,search:this.search,version:2,chains:c}),f=l.map(h=>nt.getWalletIcon(h));await Promise.all([...f.map(async h=>nt.preloadImage(h)),Ue.wait(300)]),this.endReached=this.isLastPage()}catch(c){console.error(c),vs.openToast(nt.getErrorMessage(c),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(t){Ue.isAndroid()?nt.handleMobileLinking(t):nt.goToConnectingView(t)}onSearchChange(t){const{value:e}=t.target;this.searchDebounce(e)}render(){const{wallets:t,search:e}=sn.state,{listings:r}=this.search?e:t,n=this.loading&&!r.length,i=this.search.length>=3;let s=Ss.manualWalletsTemplate(),c=Ss.recomendedWalletsTemplate(!0);i&&(s=s.filter(({values:h})=>nt.caseSafeIncludes(h[0],this.search)),c=c.filter(({values:h})=>nt.caseSafeIncludes(h[0],this.search)));const l=!this.loading&&!r.length&&!c.length,f={"wcm-loading":n,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":l};return ve`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${Hi(f)}"><div class="wcm-grid">${n?null:s} ${n?null:c} ${n?null:r.map(h=>ve`${h?ve`<wcm-wallet-button imageId="${h.image_id}" name="${h.name}" walletId="${h.id}" .onClick="${()=>this.onConnect(h)}"></wcm-wallet-button>`:null}`)}</div><div class="wcm-placeholder-block">${l?ve`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!l&&this.loading?ve`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};go.styles=[xt.globalCss,ZT],kc([on()],go.prototype,"loading",2),kc([on()],go.prototype,"firstFetch",2),kc([on()],go.prototype,"search",2),kc([on()],go.prototype,"endReached",2),go=kc([Ct("wcm-wallet-explorer-view")],go);const t$=Tt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var r$=Object.defineProperty,n$=Object.getOwnPropertyDescriptor,s2=(t,e,r,n)=>{for(var i=n>1?void 0:n?n$(e,r):e,s=t.length-1,c;s>=0;s--)(c=t[s])&&(i=(n?c(e,r,i):c(i))||i);return n&&i&&r$(e,r,i),i};let Mu=class extends mt{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(t){const{desktop:e,name:r}=Ue.getWalletRouterData(),n=e?.universal;if(n){const i=Ue.formatUniversalUrl(n,t,r);Ue.openHref(i,"_blank")}}openWebWallet(){const{walletConnectUri:t}=hr.state,e=Ue.getWalletRouterData();nt.setRecentWallet(e),t&&this.onFormatAndRedirect(t)}render(){const{name:t,id:e,image_id:r}=Ue.getWalletRouterData(),{isMobile:n,isDesktop:i}=nt.getCachedRouterWalletPlatforms(),s=Ue.isMobile();return ve`<wcm-modal-header title="${t}" .onAction="${nt.handleUriCopy}" .actionIcon="${Nt.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Wr(r)}" label="${`Continue in ${t}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${t} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isDesktop="${s?!1:i}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${Nt.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Mu.styles=[xt.globalCss,t$],s2([on()],Mu.prototype,"isError",2),Mu=s2([Ct("wcm-web-connecting-view")],Mu);var i$=Object.freeze({__proto__:null,get WcmModal(){return Ea},get WcmQrCode(){return Wi}});Dn.EthereumProvider=CC,Dn.OPTIONAL_EVENTS=Ty,Dn.OPTIONAL_METHODS=My,Dn.REQUIRED_EVENTS=ru,Dn.REQUIRED_METHODS=tu,Dn.default=su,Object.defineProperty(Dn,"__esModule",{value:!0})});
139
149
  //# sourceMappingURL=index.umd.js.map