@walletconnect/ethereum-provider 2.1.4 → 2.2.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 +6 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(Dt,We){typeof exports=="object"&&typeof module<"u"?We(exports):typeof define=="function"&&define.amd?define(["exports"],We):(Dt=typeof globalThis<"u"?globalThis:Dt||self,We(Dt["@walletconnect/ethereum-provider"]={}))})(this,function(Dt){"use strict";var We=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Jt(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 Kn={exports:{}},ur=typeof Reflect=="object"?Reflect:null,as=ur&&typeof ur.apply=="function"?ur.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},en;ur&&typeof ur.ownKeys=="function"?en=ur.ownKeys:Object.getOwnPropertySymbols?en=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:en=function(e){return Object.getOwnPropertyNames(e)};function wu(t){console&&console.warn&&console.warn(t)}var cs=Number.isNaN||function(e){return e!==e};function xe(){xe.init.call(this)}Kn.exports=xe,Kn.exports.once=Su,xe.EventEmitter=xe,xe.prototype._events=void 0,xe.prototype._eventsCount=0,xe.prototype._maxListeners=void 0;var us=10;function tn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(xe,"defaultMaxListeners",{enumerable:!0,get:function(){return us},set:function(t){if(typeof t!="number"||t<0||cs(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");us=t}}),xe.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},xe.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||cs(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 fs(t){return t._maxListeners===void 0?xe.defaultMaxListeners:t._maxListeners}xe.prototype.getMaxListeners=function(){return fs(this)},xe.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 o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")as(h,this,r);else for(var f=h.length,l=gs(h,f),n=0;n<f;++n)as(l[n],this,r);return!0};function hs(t,e,r,n){var i,s,o;if(tn(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),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=fs(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,wu(a)}return t}xe.prototype.addListener=function(e,r){return hs(this,e,r,!1)},xe.prototype.on=xe.prototype.addListener,xe.prototype.prependListener=function(e,r){return hs(this,e,r,!0)};function Eu(){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 ls(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Eu.bind(n);return i.listener=r,n.wrapFn=i,i}xe.prototype.once=function(e,r){return tn(r),this.on(e,ls(this,e,r)),this},xe.prototype.prependOnceListener=function(e,r){return tn(r),this.prependListener(e,ls(this,e,r)),this},xe.prototype.removeListener=function(e,r){var n,i,s,o,a;if(tn(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,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():Du(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},xe.prototype.off=xe.prototype.removeListener,xe.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),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);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 ds(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?xu(i):gs(i,i.length)}xe.prototype.listeners=function(e){return ds(this,e,!0)},xe.prototype.rawListeners=function(e){return ds(this,e,!1)},xe.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ps.call(t,e)},xe.prototype.listenerCount=ps;function ps(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}xe.prototype.eventNames=function(){return this._eventsCount>0?en(this._events):[]};function gs(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Du(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function xu(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Su(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}ys(t,e,s,{once:!0}),e!=="error"&&Ou(t,i,{once:!0})})}function Ou(t,e,r){typeof t.on=="function"&&ys(t,"error",e,r)}function ys(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)}function ke(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}var rn=ke;ke.EventEmitter=ke,ke.prototype._events=void 0,ke.prototype._maxListeners=void 0,ke.defaultMaxListeners=10,ke.prototype.setMaxListeners=function(t){if(!Iu(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},ke.prototype.emit=function(t){var e,r,n,i,s,o;if(this._events||(this._events={}),t==="error"&&(!this._events.error||Dr(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var a=new Error('Uncaught, unspecified "error" event. ('+e+")");throw a.context=e,a}if(r=this._events[t],_s(r))return!1;if(Nt(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:i=Array.prototype.slice.call(arguments,1),r.apply(this,i)}else if(Dr(r))for(i=Array.prototype.slice.call(arguments,1),o=r.slice(),n=o.length,s=0;s<n;s++)o[s].apply(this,i);return!0},ke.prototype.addListener=function(t,e){var r;if(!Nt(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,Nt(e.listener)?e.listener:e),this._events[t]?Dr(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,Dr(this._events[t])&&!this._events[t].warned&&(_s(this._maxListeners)?r=ke.defaultMaxListeners:r=this._maxListeners,r&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),typeof console.trace=="function"&&console.trace())),this},ke.prototype.on=ke.prototype.addListener,ke.prototype.once=function(t,e){if(!Nt(e))throw TypeError("listener must be a function");var r=!1;function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}return n.listener=e,this.on(t,n),this},ke.prototype.removeListener=function(t,e){var r,n,i,s;if(!Nt(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],i=r.length,n=-1,r===e||Nt(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(Dr(r)){for(s=i;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)return this;r.length===1?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},ke.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[t]&&delete this._events[t],this;if(arguments.length===0){for(e in this._events)e!=="removeListener"&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],Nt(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},ke.prototype.listeners=function(t){var e;return!this._events||!this._events[t]?e=[]:Nt(this._events[t])?e=[this._events[t]]:e=this._events[t].slice(),e},ke.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(Nt(e))return 1;if(e)return e.length}return 0},ke.listenerCount=function(t,e){return t.listenerCount(e)};function Nt(t){return typeof t=="function"}function Iu(t){return typeof t=="number"}function Dr(t){return typeof t=="object"&&t!==null}function _s(t){return t===void 0}const Lu="PARSE_ERROR",Au="INVALID_REQUEST",Tu="METHOD_NOT_FOUND",Cu="INVALID_PARAMS",vs="INTERNAL_ERROR",Hn="SERVER_ERROR",Ru=[-32700,-32600,-32601,-32602,-32603],xr={[Lu]:{code:-32700,message:"Parse error"},[Au]:{code:-32600,message:"Invalid Request"},[Tu]:{code:-32601,message:"Method not found"},[Cu]:{code:-32602,message:"Invalid params"},[vs]:{code:-32603,message:"Internal error"},[Hn]:{code:-32e3,message:"Server error"}},bs=Hn;function Nu(t){return Ru.includes(t)}function ms(t){return Object.keys(xr).includes(t)?xr[t]:xr[bs]}function Pu(t){const e=Object.values(xr).find(r=>r.code===t);return e||xr[bs]}function ws(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Es={};/*! *****************************************************************************
|
|
1
|
+
(function(St,ke){typeof exports=="object"&&typeof module<"u"?ke(exports):typeof define=="function"&&define.amd?define(["exports"],ke):(St=typeof globalThis<"u"?globalThis:St||self,ke(St["@walletconnect/ethereum-provider"]={}))})(this,function(St){"use strict";var ke=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Zt(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 Wn={exports:{}},hr=typeof Reflect=="object"?Reflect:null,gs=hr&&typeof hr.apply=="function"?hr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},rn;hr&&typeof hr.ownKeys=="function"?rn=hr.ownKeys:Object.getOwnPropertySymbols?rn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:rn=function(e){return Object.getOwnPropertyNames(e)};function Uu(t){console&&console.warn&&console.warn(t)}var ys=Number.isNaN||function(e){return e!==e};function xe(){xe.init.call(this)}Wn.exports=xe,Wn.exports.once=Ku,xe.EventEmitter=xe,xe.prototype._events=void 0,xe.prototype._eventsCount=0,xe.prototype._maxListeners=void 0;var vs=10;function nn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(xe,"defaultMaxListeners",{enumerable:!0,get:function(){return vs},set:function(t){if(typeof t!="number"||t<0||ys(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");vs=t}}),xe.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},xe.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ys(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 _s(t){return t._maxListeners===void 0?xe.defaultMaxListeners:t._maxListeners}xe.prototype.getMaxListeners=function(){return _s(this)},xe.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 o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")gs(h,this,r);else for(var f=h.length,l=Ds(h,f),n=0;n<f;++n)gs(l[n],this,r);return!0};function bs(t,e,r,n){var i,s,o;if(nn(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),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=_s(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,Uu(a)}return t}xe.prototype.addListener=function(e,r){return bs(this,e,r,!1)},xe.prototype.on=xe.prototype.addListener,xe.prototype.prependListener=function(e,r){return bs(this,e,r,!0)};function ju(){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 ms(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=ju.bind(n);return i.listener=r,n.wrapFn=i,i}xe.prototype.once=function(e,r){return nn(r),this.on(e,ms(this,e,r)),this},xe.prototype.prependOnceListener=function(e,r){return nn(r),this.prependListener(e,ms(this,e,r)),this},xe.prototype.removeListener=function(e,r){var n,i,s,o,a;if(nn(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,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():Bu(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},xe.prototype.off=xe.prototype.removeListener,xe.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),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);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 ws(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?zu(i):Ds(i,i.length)}xe.prototype.listeners=function(e){return ws(this,e,!0)},xe.prototype.rawListeners=function(e){return ws(this,e,!1)},xe.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Es.call(t,e)},xe.prototype.listenerCount=Es;function Es(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}xe.prototype.eventNames=function(){return this._eventsCount>0?rn(this._events):[]};function Ds(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Bu(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function zu(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Ku(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}xs(t,e,s,{once:!0}),e!=="error"&&qu(t,i,{once:!0})})}function qu(t,e,r){typeof t.on=="function"&&xs(t,"error",e,r)}function xs(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)}function Ye(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}var kn=Ye;Ye.EventEmitter=Ye,Ye.prototype._events=void 0,Ye.prototype._maxListeners=void 0,Ye.defaultMaxListeners=10,Ye.prototype.setMaxListeners=function(t){if(!Hu(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},Ye.prototype.emit=function(t){var e,r,n,i,s,o;if(this._events||(this._events={}),t==="error"&&(!this._events.error||xr(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;var a=new Error('Uncaught, unspecified "error" event. ('+e+")");throw a.context=e,a}if(r=this._events[t],Ss(r))return!1;if(Ft(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:i=Array.prototype.slice.call(arguments,1),r.apply(this,i)}else if(xr(r))for(i=Array.prototype.slice.call(arguments,1),o=r.slice(),n=o.length,s=0;s<n;s++)o[s].apply(this,i);return!0},Ye.prototype.addListener=function(t,e){var r;if(!Ft(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,Ft(e.listener)?e.listener:e),this._events[t]?xr(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,xr(this._events[t])&&!this._events[t].warned&&(Ss(this._maxListeners)?r=Ye.defaultMaxListeners:r=this._maxListeners,r&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),typeof console.trace=="function"&&console.trace())),this},Ye.prototype.on=Ye.prototype.addListener,Ye.prototype.once=function(t,e){if(!Ft(e))throw TypeError("listener must be a function");var r=!1;function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}return n.listener=e,this.on(t,n),this},Ye.prototype.removeListener=function(t,e){var r,n,i,s;if(!Ft(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],i=r.length,n=-1,r===e||Ft(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(xr(r)){for(s=i;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)return this;r.length===1?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},Ye.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[t]&&delete this._events[t],this;if(arguments.length===0){for(e in this._events)e!=="removeListener"&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],Ft(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},Ye.prototype.listeners=function(t){var e;return!this._events||!this._events[t]?e=[]:Ft(this._events[t])?e=[this._events[t]]:e=this._events[t].slice(),e},Ye.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(Ft(e))return 1;if(e)return e.length}return 0},Ye.listenerCount=function(t,e){return t.listenerCount(e)};function Ft(t){return typeof t=="function"}function Hu(t){return typeof t=="number"}function xr(t){return typeof t=="object"&&t!==null}function Ss(t){return t===void 0}const Vu="PARSE_ERROR",Gu="INVALID_REQUEST",Wu="METHOD_NOT_FOUND",ku="INVALID_PARAMS",Os="INTERNAL_ERROR",Yn="SERVER_ERROR",Yu=[-32700,-32600,-32601,-32602,-32603],Sr={[Vu]:{code:-32700,message:"Parse error"},[Gu]:{code:-32600,message:"Invalid Request"},[Wu]:{code:-32601,message:"Method not found"},[ku]:{code:-32602,message:"Invalid params"},[Os]:{code:-32603,message:"Internal error"},[Yn]:{code:-32e3,message:"Server error"}},Ls=Yn;function Ju(t){return Yu.includes(t)}function Is(t){return Object.keys(Sr).includes(t)?Sr[t]:Sr[Ls]}function Xu(t){const e=Object.values(Sr).find(r=>r.code===t);return e||Sr[Ls]}function As(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var Ts={};/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -11,7 +11,7 @@
|
|
|
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 qn=function(t,e){return qn=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])},qn(t,e)};function Fu(t,e){qn(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Vn=function(){return Vn=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},Vn.apply(this,arguments)};function $u(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 Mu(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function Uu(t,e){return function(r,n){e(r,n,t)}}function ju(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Bu(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{f(n.next(l))}catch(D){o(D)}}function h(l){try{f(n.throw(l))}catch(D){o(D)}}function f(l){l.done?s(l.value):i(l.value).then(a,h)}f((n=n.apply(t,e||[])).next())})}function zu(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(f){return function(l){return h([f,l])}}function h(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=f[0]&2?i.return:f[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,f[1])).done)return s;switch(i=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){r.label=f[1];break}if(f[0]===6&&r.label<s[1]){r.label=s[1],s=f;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(f);break}s[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(l){f=[6,l],i=0}finally{n=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Ku(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Hu(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Gn(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 Ds(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function qu(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Ds(arguments[e]));return t}function Vu(){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],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Sr(t){return this instanceof Sr?(this.v=t,this):new Sr(t)}function Gu(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(E){n[E]&&(i[E]=function(m){return new Promise(function(b,P){s.push([E,m,b,P])>1||a(E,m)})})}function a(E,m){try{h(n[E](m))}catch(b){D(s[0][3],b)}}function h(E){E.value instanceof Sr?Promise.resolve(E.value.v).then(f,l):D(s[0][2],E)}function f(E){a("next",E)}function l(E){a("throw",E)}function D(E,m){E(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Wu(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(o){return(r=!r)?{value:Sr(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function ku(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 Gn=="function"?Gn(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(o){return new Promise(function(a,h){o=t[s](o),i(a,h,o.done,o.value)})}}function i(s,o,a,h){Promise.resolve(h).then(function(f){s({value:f,done:a})},o)}}function Yu(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Ju(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 Xu(t){return t&&t.__esModule?t:{default:t}}function Zu(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Qu(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 ef=Object.freeze({__proto__:null,__extends:Fu,get __assign(){return Vn},__rest:$u,__decorate:Mu,__param:Uu,__metadata:ju,__awaiter:Bu,__generator:zu,__createBinding:Ku,__exportStar:Hu,__values:Gn,__read:Ds,__spread:qu,__spreadArrays:Vu,__await:Sr,__asyncGenerator:Gu,__asyncDelegator:Wu,__asyncValues:ku,__makeTemplateObject:Yu,__importStar:Ju,__importDefault:Xu,__classPrivateFieldGet:Zu,__classPrivateFieldSet:Qu}),tf=Jt(ef),Pt={},xs;function rf(){if(xs)return Pt;xs=1,Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.isBrowserCryptoAvailable=Pt.getSubtleCrypto=Pt.getBrowerCrypto=void 0;function t(){return We?.crypto||We?.msCrypto||{}}Pt.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Pt.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Pt.isBrowserCryptoAvailable=r,Pt}var Ft={},Ss;function nf(){if(Ss)return Ft;Ss=1,Object.defineProperty(Ft,"__esModule",{value:!0}),Ft.isBrowser=Ft.isNode=Ft.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Ft.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Ft.isNode=e;function r(){return!t()&&!e()}return Ft.isBrowser=r,Ft}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=tf;e.__exportStar(rf(),t),e.__exportStar(nf(),t)})(Es);function sf(){const t=Date.now()*Math.pow(10,3),e=Math.floor(Math.random()*Math.pow(10,3));return t+e}function nn(t,e,r){return{id:r||sf(),jsonrpc:"2.0",method:t,params:e}}function sn(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Or(t,e,r){return{id:t,jsonrpc:"2.0",error:of(e,r)}}function of(t,e){return typeof t>"u"?ms(vs):(typeof t=="string"&&(t=Object.assign(Object.assign({},ms(Hn)),{message:t})),typeof e<"u"&&(t.data=e),Nu(t.code)&&(t=Pu(t.code)),t)}class Os{}class af extends Os{constructor(e){super()}}class cf extends Os{constructor(){super()}}class uf extends cf{constructor(e){super()}}const ff="^https?:",hf="^wss?:";function lf(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Is(t,e){const r=lf(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function Ls(t){return Is(t,ff)}function As(t){return Is(t,hf)}function df(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function Ts(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function Wn(t){return Ts(t)&&"method"in t}function kn(t){return Ts(t)&&($t(t)||xt(t))}function $t(t){return"result"in t}function xt(t){return"error"in t}class Yn extends uf{constructor(e){super(e),this.events=new rn.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(nn(e.method,e.params||[]),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=>{xt(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),kn(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}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",()=>this.events.emit("disconnect")),this.connection.on("error",e=>this.events.emit("error",e)),this.hasRegisteredEventListeners=!0)}}var Jn={exports:{}};(function(t,e){var r=typeof self<"u"?self:We,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={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 h(g){return g&&DataView.prototype.isPrototypeOf(g)}if(a.arrayBuffer)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(g){return g&&f.indexOf(Object.prototype.toString.call(g))>-1};function D(g){if(typeof g!="string"&&(g=String(g)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(g))throw new TypeError("Invalid character in header field name");return g.toLowerCase()}function E(g){return typeof g!="string"&&(g=String(g)),g}function m(g){var _={next:function(){var $=g.shift();return{done:$===void 0,value:$}}};return a.iterable&&(_[Symbol.iterator]=function(){return _}),_}function b(g){this.map={},g instanceof b?g.forEach(function(_,$){this.append($,_)},this):Array.isArray(g)?g.forEach(function(_){this.append(_[0],_[1])},this):g&&Object.getOwnPropertyNames(g).forEach(function(_){this.append(_,g[_])},this)}b.prototype.append=function(g,_){g=D(g),_=E(_);var $=this.map[g];this.map[g]=$?$+", "+_:_},b.prototype.delete=function(g){delete this.map[D(g)]},b.prototype.get=function(g){return g=D(g),this.has(g)?this.map[g]:null},b.prototype.has=function(g){return this.map.hasOwnProperty(D(g))},b.prototype.set=function(g,_){this.map[D(g)]=E(_)},b.prototype.forEach=function(g,_){for(var $ in this.map)this.map.hasOwnProperty($)&&g.call(_,this.map[$],$,this)},b.prototype.keys=function(){var g=[];return this.forEach(function(_,$){g.push($)}),m(g)},b.prototype.values=function(){var g=[];return this.forEach(function(_){g.push(_)}),m(g)},b.prototype.entries=function(){var g=[];return this.forEach(function(_,$){g.push([$,_])}),m(g)},a.iterable&&(b.prototype[Symbol.iterator]=b.prototype.entries);function P(g){if(g.bodyUsed)return Promise.reject(new TypeError("Already read"));g.bodyUsed=!0}function R(g){return new Promise(function(_,$){g.onload=function(){_(g.result)},g.onerror=function(){$(g.error)}})}function B(g){var _=new FileReader,$=R(_);return _.readAsArrayBuffer(g),$}function S(g){var _=new FileReader,$=R(_);return _.readAsText(g),$}function L(g){for(var _=new Uint8Array(g),$=new Array(_.length),M=0;M<_.length;M++)$[M]=String.fromCharCode(_[M]);return $.join("")}function y(g){if(g.slice)return g.slice(0);var _=new Uint8Array(g.byteLength);return _.set(new Uint8Array(g)),_.buffer}function x(){return this.bodyUsed=!1,this._initBody=function(g){this._bodyInit=g,g?typeof g=="string"?this._bodyText=g:a.blob&&Blob.prototype.isPrototypeOf(g)?this._bodyBlob=g:a.formData&&FormData.prototype.isPrototypeOf(g)?this._bodyFormData=g:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(g)?this._bodyText=g.toString():a.arrayBuffer&&a.blob&&h(g)?(this._bodyArrayBuffer=y(g.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(g)||l(g))?this._bodyArrayBuffer=y(g):this._bodyText=g=Object.prototype.toString.call(g):this._bodyText="",this.headers.get("content-type")||(typeof g=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(g)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var g=P(this);if(g)return g;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(B)}),this.text=function(){var g=P(this);if(g)return g;if(this._bodyBlob)return S(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(L(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(U)}),this.json=function(){return this.text().then(JSON.parse)},this}var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function c(g){var _=g.toUpperCase();return w.indexOf(_)>-1?_:g}function d(g,_){_=_||{};var $=_.body;if(g instanceof d){if(g.bodyUsed)throw new TypeError("Already read");this.url=g.url,this.credentials=g.credentials,_.headers||(this.headers=new b(g.headers)),this.method=g.method,this.mode=g.mode,this.signal=g.signal,!$&&g._bodyInit!=null&&($=g._bodyInit,g.bodyUsed=!0)}else this.url=String(g);if(this.credentials=_.credentials||this.credentials||"same-origin",(_.headers||!this.headers)&&(this.headers=new b(_.headers)),this.method=c(_.method||this.method||"GET"),this.mode=_.mode||this.mode||null,this.signal=_.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&$)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody($)}d.prototype.clone=function(){return new d(this,{body:this._bodyInit})};function U(g){var _=new FormData;return g.trim().split("&").forEach(function($){if($){var M=$.split("="),N=M.shift().replace(/\+/g," "),C=M.join("=").replace(/\+/g," ");_.append(decodeURIComponent(N),decodeURIComponent(C))}}),_}function K(g){var _=new b,$=g.replace(/\r?\n[\t ]+/g," ");return $.split(/\r?\n/).forEach(function(M){var N=M.split(":"),C=N.shift().trim();if(C){var j=N.join(":").trim();_.append(C,j)}}),_}x.call(d.prototype);function G(g,_){_||(_={}),this.type="default",this.status=_.status===void 0?200:_.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in _?_.statusText:"OK",this.headers=new b(_.headers),this.url=_.url||"",this._initBody(g)}x.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new b(this.headers),url:this.url})},G.error=function(){var g=new G(null,{status:0,statusText:""});return g.type="error",g};var J=[301,302,303,307,308];G.redirect=function(g,_){if(J.indexOf(_)===-1)throw new RangeError("Invalid status code");return new G(null,{status:_,headers:{location:g}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(_,$){this.message=_,this.name=$;var M=Error(_);this.stack=M.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function X(g,_){return new Promise(function($,M){var N=new d(g,_);if(N.signal&&N.signal.aborted)return M(new o.DOMException("Aborted","AbortError"));var C=new XMLHttpRequest;function j(){C.abort()}C.onload=function(){var z={status:C.status,statusText:C.statusText,headers:K(C.getAllResponseHeaders()||"")};z.url="responseURL"in C?C.responseURL:z.headers.get("X-Request-URL");var Q="response"in C?C.response:C.responseText;$(new G(Q,z))},C.onerror=function(){M(new TypeError("Network request failed"))},C.ontimeout=function(){M(new TypeError("Network request failed"))},C.onabort=function(){M(new o.DOMException("Aborted","AbortError"))},C.open(N.method,N.url,!0),N.credentials==="include"?C.withCredentials=!0:N.credentials==="omit"&&(C.withCredentials=!1),"responseType"in C&&a.blob&&(C.responseType="blob"),N.headers.forEach(function(z,Q){C.setRequestHeader(Q,z)}),N.signal&&(N.signal.addEventListener("abort",j),C.onreadystatechange=function(){C.readyState===4&&N.signal.removeEventListener("abort",j)}),C.send(typeof N._bodyInit>"u"?null:N._bodyInit)})}return X.polyfill=!0,s.fetch||(s.fetch=X,s.Headers=b,s.Request=d,s.Response=G),o.Headers=b,o.Request=d,o.Response=G,o.fetch=X,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(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})(Jn,Jn.exports);var Cs=mu(Jn.exports);function Xn(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}function Ir(t){return typeof t=="string"?t:JSON.stringify(t)}const Rs={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},Ns=10;class pf{constructor(e){if(this.url=e,this.events=new rn.EventEmitter,this.isAvailable=!1,this.registering=!1,!Ls(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e}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=Ir(e),s=await(await Cs(this.url,Object.assign(Object.assign({},Rs),{body:n}))).json();this.onPayload({data:s})}catch(n){this.onError(e.id,n)}}async register(e=this.url){if(!Ls(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{const r=Ir({id:1,jsonrpc:"2.0",method:"test",params:[]});await Cs(e,Object.assign(Object.assign({},Rs),{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"?Xn(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Or(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return ws(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>Ns&&this.events.setMaxListeners(Ns)}}var Zn={},on={},re={},Ps={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(a,h){var f=a>>>16&65535,l=a&65535,D=h>>>16&65535,E=h&65535;return l*E+(f*E+l*D<<16>>>0)|0}t.mul=Math.imul||e;function r(a,h){return a+h|0}t.add=r;function n(a,h){return a-h|0}t.sub=n;function i(a,h){return a<<h|a>>>32-h}t.rotl=i;function s(a,h){return a<<32-h|a>>>h}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(Ps),Object.defineProperty(re,"__esModule",{value:!0});var Fs=Ps;function gf(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}re.readInt16BE=gf;function yf(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}re.readUint16BE=yf;function _f(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}re.readInt16LE=_f;function vf(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}re.readUint16LE=vf;function $s(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}re.writeUint16BE=$s,re.writeInt16BE=$s;function Ms(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}re.writeUint16LE=Ms,re.writeInt16LE=Ms;function Qn(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}re.readInt32BE=Qn;function ei(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}re.readUint32BE=ei;function ti(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}re.readInt32LE=ti;function ri(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}re.readUint32LE=ri;function an(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}re.writeUint32BE=an,re.writeInt32BE=an;function cn(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}re.writeUint32LE=cn,re.writeInt32LE=cn;function bf(t,e){e===void 0&&(e=0);var r=Qn(t,e),n=Qn(t,e+4);return r*4294967296+n-(n>>31)*4294967296}re.readInt64BE=bf;function mf(t,e){e===void 0&&(e=0);var r=ei(t,e),n=ei(t,e+4);return r*4294967296+n}re.readUint64BE=mf;function wf(t,e){e===void 0&&(e=0);var r=ti(t,e),n=ti(t,e+4);return n*4294967296+r-(r>>31)*4294967296}re.readInt64LE=wf;function Ef(t,e){e===void 0&&(e=0);var r=ri(t,e),n=ri(t,e+4);return n*4294967296+r}re.readUint64LE=Ef;function Us(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),an(t/4294967296>>>0,e,r),an(t>>>0,e,r+4),e}re.writeUint64BE=Us,re.writeInt64BE=Us;function js(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),cn(t>>>0,e,r),cn(t/4294967296>>>0,e,r+4),e}re.writeUint64LE=js,re.writeInt64LE=js;function Df(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}re.readUintBE=Df;function xf(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}re.readUintLE=xf;function Sf(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(!Fs.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}re.writeUintBE=Sf;function Of(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(!Fs.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}re.writeUintLE=Of;function If(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e)}re.readFloat32BE=If;function Lf(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e,!0)}re.readFloat32LE=Lf;function Af(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e)}re.readFloat64BE=Af;function Tf(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e,!0)}re.readFloat64LE=Tf;function Cf(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}re.writeFloat32BE=Cf;function Rf(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}re.writeFloat32LE=Rf;function Nf(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}re.writeFloat64BE=Nf;function Pf(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}re.writeFloat64LE=Pf;var yt={};Object.defineProperty(yt,"__esModule",{value:!0});function Ff(t){for(var e=0;e<t.length;e++)t[e]=0;return t}yt.wipe=Ff,Object.defineProperty(on,"__esModule",{value:!0});var at=re,ni=yt,$f=20;function Mf(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],h=r[7]<<24|r[6]<<16|r[5]<<8|r[4],f=r[11]<<24|r[10]<<16|r[9]<<8|r[8],l=r[15]<<24|r[14]<<16|r[13]<<8|r[12],D=r[19]<<24|r[18]<<16|r[17]<<8|r[16],E=r[23]<<24|r[22]<<16|r[21]<<8|r[20],m=r[27]<<24|r[26]<<16|r[25]<<8|r[24],b=r[31]<<24|r[30]<<16|r[29]<<8|r[28],P=e[3]<<24|e[2]<<16|e[1]<<8|e[0],R=e[7]<<24|e[6]<<16|e[5]<<8|e[4],B=e[11]<<24|e[10]<<16|e[9]<<8|e[8],S=e[15]<<24|e[14]<<16|e[13]<<8|e[12],L=n,y=i,x=s,w=o,c=a,d=h,U=f,K=l,G=D,J=E,X=m,g=b,_=P,$=R,M=B,N=S,C=0;C<$f;C+=2)L=L+c|0,_^=L,_=_>>>32-16|_<<16,G=G+_|0,c^=G,c=c>>>32-12|c<<12,y=y+d|0,$^=y,$=$>>>32-16|$<<16,J=J+$|0,d^=J,d=d>>>32-12|d<<12,x=x+U|0,M^=x,M=M>>>32-16|M<<16,X=X+M|0,U^=X,U=U>>>32-12|U<<12,w=w+K|0,N^=w,N=N>>>32-16|N<<16,g=g+N|0,K^=g,K=K>>>32-12|K<<12,x=x+U|0,M^=x,M=M>>>32-8|M<<8,X=X+M|0,U^=X,U=U>>>32-7|U<<7,w=w+K|0,N^=w,N=N>>>32-8|N<<8,g=g+N|0,K^=g,K=K>>>32-7|K<<7,y=y+d|0,$^=y,$=$>>>32-8|$<<8,J=J+$|0,d^=J,d=d>>>32-7|d<<7,L=L+c|0,_^=L,_=_>>>32-8|_<<8,G=G+_|0,c^=G,c=c>>>32-7|c<<7,L=L+d|0,N^=L,N=N>>>32-16|N<<16,X=X+N|0,d^=X,d=d>>>32-12|d<<12,y=y+U|0,_^=y,_=_>>>32-16|_<<16,g=g+_|0,U^=g,U=U>>>32-12|U<<12,x=x+K|0,$^=x,$=$>>>32-16|$<<16,G=G+$|0,K^=G,K=K>>>32-12|K<<12,w=w+c|0,M^=w,M=M>>>32-16|M<<16,J=J+M|0,c^=J,c=c>>>32-12|c<<12,x=x+K|0,$^=x,$=$>>>32-8|$<<8,G=G+$|0,K^=G,K=K>>>32-7|K<<7,w=w+c|0,M^=w,M=M>>>32-8|M<<8,J=J+M|0,c^=J,c=c>>>32-7|c<<7,y=y+U|0,_^=y,_=_>>>32-8|_<<8,g=g+_|0,U^=g,U=U>>>32-7|U<<7,L=L+d|0,N^=L,N=N>>>32-8|N<<8,X=X+N|0,d^=X,d=d>>>32-7|d<<7;at.writeUint32LE(L+n|0,t,0),at.writeUint32LE(y+i|0,t,4),at.writeUint32LE(x+s|0,t,8),at.writeUint32LE(w+o|0,t,12),at.writeUint32LE(c+a|0,t,16),at.writeUint32LE(d+h|0,t,20),at.writeUint32LE(U+f|0,t,24),at.writeUint32LE(K+l|0,t,28),at.writeUint32LE(G+D|0,t,32),at.writeUint32LE(J+E|0,t,36),at.writeUint32LE(X+m|0,t,40),at.writeUint32LE(g+b|0,t,44),at.writeUint32LE(_+P|0,t,48),at.writeUint32LE($+R|0,t,52),at.writeUint32LE(M+B|0,t,56),at.writeUint32LE(N+S|0,t,60)}function Bs(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,o;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),o=s.length-e.length,s.set(e,o)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,o=i}for(var a=new Uint8Array(64),h=0;h<r.length;h+=64){Mf(a,s,t);for(var f=h;f<h+64&&f<r.length;f++)n[f]=r[f]^a[f-h];jf(s,0,o)}return ni.wipe(a),i===0&&ni.wipe(s),n}on.streamXOR=Bs;function Uf(t,e,r,n){return n===void 0&&(n=0),ni.wipe(r),Bs(t,e,r,r,n)}on.stream=Uf;function jf(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 zs={},Kt={};Object.defineProperty(Kt,"__esModule",{value:!0});function Bf(t,e,r){return~(t-1)&e|t-1&r}Kt.select=Bf;function zf(t,e){return(t|0)-(e|0)-1>>>31&1}Kt.lessOrEqual=zf;function Ks(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}Kt.compare=Ks;function Kf(t,e){return t.length===0||e.length===0?!1:Ks(t,e)!==0}Kt.equal=Kf,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Kt,r=yt;t.DIGEST_LENGTH=16;var n=function(){function o(a){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 h=a[0]|a[1]<<8;this._r[0]=h&8191;var f=a[2]|a[3]<<8;this._r[1]=(h>>>13|f<<3)&8191;var l=a[4]|a[5]<<8;this._r[2]=(f>>>10|l<<6)&7939;var D=a[6]|a[7]<<8;this._r[3]=(l>>>7|D<<9)&8191;var E=a[8]|a[9]<<8;this._r[4]=(D>>>4|E<<12)&255,this._r[5]=E>>>1&8190;var m=a[10]|a[11]<<8;this._r[6]=(E>>>14|m<<2)&8191;var b=a[12]|a[13]<<8;this._r[7]=(m>>>11|b<<5)&8065;var P=a[14]|a[15]<<8;this._r[8]=(b>>>8|P<<8)&8191,this._r[9]=P>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,h,f){for(var l=this._fin?0:2048,D=this._h[0],E=this._h[1],m=this._h[2],b=this._h[3],P=this._h[4],R=this._h[5],B=this._h[6],S=this._h[7],L=this._h[8],y=this._h[9],x=this._r[0],w=this._r[1],c=this._r[2],d=this._r[3],U=this._r[4],K=this._r[5],G=this._r[6],J=this._r[7],X=this._r[8],g=this._r[9];f>=16;){var _=a[h+0]|a[h+1]<<8;D+=_&8191;var $=a[h+2]|a[h+3]<<8;E+=(_>>>13|$<<3)&8191;var M=a[h+4]|a[h+5]<<8;m+=($>>>10|M<<6)&8191;var N=a[h+6]|a[h+7]<<8;b+=(M>>>7|N<<9)&8191;var C=a[h+8]|a[h+9]<<8;P+=(N>>>4|C<<12)&8191,R+=C>>>1&8191;var j=a[h+10]|a[h+11]<<8;B+=(C>>>14|j<<2)&8191;var z=a[h+12]|a[h+13]<<8;S+=(j>>>11|z<<5)&8191;var Q=a[h+14]|a[h+15]<<8;L+=(z>>>8|Q<<8)&8191,y+=Q>>>5|l;var H=0,ee=H;ee+=D*x,ee+=E*(5*g),ee+=m*(5*X),ee+=b*(5*J),ee+=P*(5*G),H=ee>>>13,ee&=8191,ee+=R*(5*K),ee+=B*(5*U),ee+=S*(5*d),ee+=L*(5*c),ee+=y*(5*w),H+=ee>>>13,ee&=8191;var Y=H;Y+=D*w,Y+=E*x,Y+=m*(5*g),Y+=b*(5*X),Y+=P*(5*J),H=Y>>>13,Y&=8191,Y+=R*(5*G),Y+=B*(5*K),Y+=S*(5*U),Y+=L*(5*d),Y+=y*(5*c),H+=Y>>>13,Y&=8191;var ae=H;ae+=D*c,ae+=E*w,ae+=m*x,ae+=b*(5*g),ae+=P*(5*X),H=ae>>>13,ae&=8191,ae+=R*(5*J),ae+=B*(5*G),ae+=S*(5*K),ae+=L*(5*U),ae+=y*(5*d),H+=ae>>>13,ae&=8191;var T=H;T+=D*d,T+=E*c,T+=m*w,T+=b*x,T+=P*(5*g),H=T>>>13,T&=8191,T+=R*(5*X),T+=B*(5*J),T+=S*(5*G),T+=L*(5*K),T+=y*(5*U),H+=T>>>13,T&=8191;var A=H;A+=D*U,A+=E*d,A+=m*c,A+=b*w,A+=P*x,H=A>>>13,A&=8191,A+=R*(5*g),A+=B*(5*X),A+=S*(5*J),A+=L*(5*G),A+=y*(5*K),H+=A>>>13,A&=8191;var O=H;O+=D*K,O+=E*U,O+=m*d,O+=b*c,O+=P*w,H=O>>>13,O&=8191,O+=R*x,O+=B*(5*g),O+=S*(5*X),O+=L*(5*J),O+=y*(5*G),H+=O>>>13,O&=8191;var u=H;u+=D*G,u+=E*K,u+=m*U,u+=b*d,u+=P*c,H=u>>>13,u&=8191,u+=R*w,u+=B*x,u+=S*(5*g),u+=L*(5*X),u+=y*(5*J),H+=u>>>13,u&=8191;var v=H;v+=D*J,v+=E*G,v+=m*K,v+=b*U,v+=P*d,H=v>>>13,v&=8191,v+=R*c,v+=B*w,v+=S*x,v+=L*(5*g),v+=y*(5*X),H+=v>>>13,v&=8191;var q=H;q+=D*X,q+=E*J,q+=m*G,q+=b*K,q+=P*U,H=q>>>13,q&=8191,q+=R*d,q+=B*c,q+=S*w,q+=L*x,q+=y*(5*g),H+=q>>>13,q&=8191;var W=H;W+=D*g,W+=E*X,W+=m*J,W+=b*G,W+=P*K,H=W>>>13,W&=8191,W+=R*U,W+=B*d,W+=S*c,W+=L*w,W+=y*x,H+=W>>>13,W&=8191,H=(H<<2)+H|0,H=H+ee|0,ee=H&8191,H=H>>>13,Y+=H,D=ee,E=Y,m=ae,b=T,P=A,R=O,B=u,S=v,L=q,y=W,h+=16,f-=16}this._h[0]=D,this._h[1]=E,this._h[2]=m,this._h[3]=b,this._h[4]=P,this._h[5]=R,this._h[6]=B,this._h[7]=S,this._h[8]=L,this._h[9]=y},o.prototype.finish=function(a,h){h===void 0&&(h=0);var f=new Uint16Array(10),l,D,E,m;if(this._leftover){for(m=this._leftover,this._buffer[m++]=1;m<16;m++)this._buffer[m]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(l=this._h[1]>>>13,this._h[1]&=8191,m=2;m<10;m++)this._h[m]+=l,l=this._h[m]>>>13,this._h[m]&=8191;for(this._h[0]+=l*5,l=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=l,l=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=l,f[0]=this._h[0]+5,l=f[0]>>>13,f[0]&=8191,m=1;m<10;m++)f[m]=this._h[m]+l,l=f[m]>>>13,f[m]&=8191;for(f[9]-=1<<13,D=(l^1)-1,m=0;m<10;m++)f[m]&=D;for(D=~D,m=0;m<10;m++)this._h[m]=this._h[m]&D|f[m];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,m=1;m<8;m++)E=(this._h[m]+this._pad[m]|0)+(E>>>16)|0,this._h[m]=E&65535;return a[h+0]=this._h[0]>>>0,a[h+1]=this._h[0]>>>8,a[h+2]=this._h[1]>>>0,a[h+3]=this._h[1]>>>8,a[h+4]=this._h[2]>>>0,a[h+5]=this._h[2]>>>8,a[h+6]=this._h[3]>>>0,a[h+7]=this._h[3]>>>8,a[h+8]=this._h[4]>>>0,a[h+9]=this._h[4]>>>8,a[h+10]=this._h[5]>>>0,a[h+11]=this._h[5]>>>8,a[h+12]=this._h[6]>>>0,a[h+13]=this._h[6]>>>8,a[h+14]=this._h[7]>>>0,a[h+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var h=0,f=a.length,l;if(this._leftover){l=16-this._leftover,l>f&&(l=f);for(var D=0;D<l;D++)this._buffer[this._leftover+D]=a[h+D];if(f-=l,h+=l,this._leftover+=l,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(f>=16&&(l=f-f%16,this._blocks(a,h,l),h+=l,f-=l),f){for(var D=0;D<f;D++)this._buffer[this._leftover+D]=a[h+D];this._leftover+=f}return this},o.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var a=new Uint8Array(16);return this.finish(a),a},o.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},o}();t.Poly1305=n;function i(o,a){var h=new n(o);h.update(a);var f=h.digest();return h.clean(),f}t.oneTimeAuth=i;function s(o,a){return o.length!==t.DIGEST_LENGTH||a.length!==t.DIGEST_LENGTH?!1:e.equal(o,a)}t.equal=s}(zs),function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=on,r=zs,n=yt,i=re,s=Kt;t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var o=new Uint8Array(16),a=function(){function h(f){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,f.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(f)}return h.prototype.seal=function(f,l,D,E){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var m=new Uint8Array(16);m.set(f,m.length-f.length);var b=new Uint8Array(32);e.stream(this._key,m,b,4);var P=l.length+this.tagLength,R;if(E){if(E.length!==P)throw new Error("ChaCha20Poly1305: incorrect destination length");R=E}else R=new Uint8Array(P);return e.streamXOR(this._key,m,l,R,4),this._authenticate(R.subarray(R.length-this.tagLength,R.length),b,R.subarray(0,R.length-this.tagLength),D),n.wipe(m),R},h.prototype.open=function(f,l,D,E){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(l.length<this.tagLength)return null;var m=new Uint8Array(16);m.set(f,m.length-f.length);var b=new Uint8Array(32);e.stream(this._key,m,b,4);var P=new Uint8Array(this.tagLength);if(this._authenticate(P,b,l.subarray(0,l.length-this.tagLength),D),!s.equal(P,l.subarray(l.length-this.tagLength,l.length)))return null;var R=l.length-this.tagLength,B;if(E){if(E.length!==R)throw new Error("ChaCha20Poly1305: incorrect destination length");B=E}else B=new Uint8Array(R);return e.streamXOR(this._key,m,l.subarray(0,l.length-this.tagLength),B,4),n.wipe(m),B},h.prototype.clean=function(){return n.wipe(this._key),this},h.prototype._authenticate=function(f,l,D,E){var m=new r.Poly1305(l);E&&(m.update(E),E.length%16>0&&m.update(o.subarray(E.length%16))),m.update(D),D.length%16>0&&m.update(o.subarray(D.length%16));var b=new Uint8Array(8);E&&i.writeUint64LE(E.length,b),m.update(b),i.writeUint64LE(D.length,b),m.update(b);for(var P=m.digest(),R=0;R<P.length;R++)f[R]=P[R];m.clean(),n.wipe(P),n.wipe(b)},h}();t.ChaCha20Poly1305=a}(Zn);var Hs={},Lr={},ii={};Object.defineProperty(ii,"__esModule",{value:!0});function Hf(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}ii.isSerializableHash=Hf,Object.defineProperty(Lr,"__esModule",{value:!0});var It=ii,qf=Kt,Vf=yt,qs=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),It.isSerializableHash(this._inner)&&It.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),Vf.wipe(n)}return t.prototype.reset=function(){if(!It.isSerializableHash(this._inner)||!It.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(){It.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),It.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(!It.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(!It.isSerializableHash(this._inner)||!It.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(!It.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},t}();Lr.HMAC=qs;function Gf(t,e,r){var n=new qs(t,e);n.update(r);var i=n.digest();return n.clean(),i}Lr.hmac=Gf,Lr.equal=qf.equal,Object.defineProperty(Hs,"__esModule",{value:!0});var Vs=Lr,Gs=yt,Wf=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=Vs.hmac(this._hash,n,r);this._hmac=new Vs.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(),Gs.wipe(this._buffer),Gs.wipe(this._counter),this._bufpos=0},t}(),kf=Hs.HKDF=Wf,fr={},un={},fn={};Object.defineProperty(fn,"__esModule",{value:!0}),fn.BrowserRandomSource=void 0;const Ws=65536;class Yf{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+=Ws)this._crypto.getRandomValues(r.subarray(n,n+Math.min(r.length-n,Ws)));return r}}fn.BrowserRandomSource=Yf;function Jf(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 hn={},Xf={},Zf=Object.freeze({__proto__:null,default:Xf}),Qf=Jt(Zf);Object.defineProperty(hn,"__esModule",{value:!0}),hn.NodeRandomSource=void 0;const eh=yt;class th{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Jf<"u"){const e=Qf;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,eh.wipe)(r),n}}hn.NodeRandomSource=th,Object.defineProperty(un,"__esModule",{value:!0}),un.SystemRandomSource=void 0;const rh=fn,nh=hn;class ih{constructor(){if(this.isAvailable=!1,this.name="",this._source=new rh.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new nh.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)}}un.SystemRandomSource=ih,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=un,r=re,n=yt;t.defaultRandomSource=new e.SystemRandomSource;function i(f,l=t.defaultRandomSource){return l.randomBytes(f)}t.randomBytes=i;function s(f=t.defaultRandomSource){const l=i(4,f),D=(0,r.readUint32LE)(l);return(0,n.wipe)(l),D}t.randomUint32=s;const o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function a(f,l=o,D=t.defaultRandomSource){if(l.length<2)throw new Error("randomString charset is too short");if(l.length>256)throw new Error("randomString charset is too long");let E="";const m=l.length,b=256-256%m;for(;f>0;){const P=i(Math.ceil(f*256/b),D);for(let R=0;R<P.length&&f>0;R++){const B=P[R];B<b&&(E+=l.charAt(B%m),f--)}(0,n.wipe)(P)}return E}t.randomString=a;function h(f,l=o,D=t.defaultRandomSource){const E=Math.ceil(f/(Math.log(l.length)/Math.LN2));return a(E,l,D)}t.randomStringForEntropy=h}(fr);var ln={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=re,r=yt;t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var n=function(){function a(){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 a.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},a.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},a.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._temp),this.reset()},a.prototype.update=function(h,f){if(f===void 0&&(f=h.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var l=0;if(this._bytesHashed+=f,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&f>0;)this._buffer[this._bufferLength++]=h[l++],f--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(f>=this.blockSize&&(l=s(this._temp,this._state,h,l,f),f%=this.blockSize);f>0;)this._buffer[this._bufferLength++]=h[l++],f--;return this},a.prototype.finish=function(h){if(!this._finished){var f=this._bytesHashed,l=this._bufferLength,D=f/536870912|0,E=f<<3,m=f%64<56?64:128;this._buffer[l]=128;for(var b=l+1;b<m-8;b++)this._buffer[b]=0;e.writeUint32BE(D,this._buffer,m-8),e.writeUint32BE(E,this._buffer,m-4),s(this._temp,this._state,this._buffer,0,m),this._finished=!0}for(var b=0;b<this.digestLength/4;b++)e.writeUint32BE(this._state[b],h,b*4);return this},a.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},a.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}},a.prototype.restoreState=function(h){return this._state.set(h.state),this._bufferLength=h.bufferLength,h.buffer&&this._buffer.set(h.buffer),this._bytesHashed=h.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(h){r.wipe(h.state),h.buffer&&r.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},a}();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(a,h,f,l,D){for(;D>=64;){for(var E=h[0],m=h[1],b=h[2],P=h[3],R=h[4],B=h[5],S=h[6],L=h[7],y=0;y<16;y++){var x=l+y*4;a[y]=e.readUint32BE(f,x)}for(var y=16;y<64;y++){var w=a[y-2],c=(w>>>17|w<<32-17)^(w>>>19|w<<32-19)^w>>>10;w=a[y-15];var d=(w>>>7|w<<32-7)^(w>>>18|w<<32-18)^w>>>3;a[y]=(c+a[y-7]|0)+(d+a[y-16]|0)}for(var y=0;y<64;y++){var c=(((R>>>6|R<<26)^(R>>>11|R<<21)^(R>>>25|R<<7))+(R&B^~R&S)|0)+(L+(i[y]+a[y]|0)|0)|0,d=((E>>>2|E<<32-2)^(E>>>13|E<<32-13)^(E>>>22|E<<32-22))+(E&m^E&b^m&b)|0;L=S,S=B,B=R,R=P+c|0,P=b,b=m,m=E,E=c+d|0}h[0]+=E,h[1]+=m,h[2]+=b,h[3]+=P,h[4]+=R,h[5]+=B,h[6]+=S,h[7]+=L,l+=64,D-=64}return l}function o(a){var h=new n;h.update(a);var f=h.digest();return h.clean(),f}t.hash=o})(ln);var si={};(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=fr,r=yt;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(y){const x=new Float64Array(16);if(y)for(let w=0;w<y.length;w++)x[w]=y[w];return x}const i=new Uint8Array(32);i[0]=9;const s=n([56129,1]);function o(y){let x=1;for(let w=0;w<16;w++){let c=y[w]+x+65535;x=Math.floor(c/65536),y[w]=c-x*65536}y[0]+=x-1+37*(x-1)}function a(y,x,w){const c=~(w-1);for(let d=0;d<16;d++){const U=c&(y[d]^x[d]);y[d]^=U,x[d]^=U}}function h(y,x){const w=n(),c=n();for(let d=0;d<16;d++)c[d]=x[d];o(c),o(c),o(c);for(let d=0;d<2;d++){w[0]=c[0]-65517;for(let K=1;K<15;K++)w[K]=c[K]-65535-(w[K-1]>>16&1),w[K-1]&=65535;w[15]=c[15]-32767-(w[14]>>16&1);const U=w[15]>>16&1;w[14]&=65535,a(c,w,1-U)}for(let d=0;d<16;d++)y[2*d]=c[d]&255,y[2*d+1]=c[d]>>8}function f(y,x){for(let w=0;w<16;w++)y[w]=x[2*w]+(x[2*w+1]<<8);y[15]&=32767}function l(y,x,w){for(let c=0;c<16;c++)y[c]=x[c]+w[c]}function D(y,x,w){for(let c=0;c<16;c++)y[c]=x[c]-w[c]}function E(y,x,w){let c,d,U=0,K=0,G=0,J=0,X=0,g=0,_=0,$=0,M=0,N=0,C=0,j=0,z=0,Q=0,H=0,ee=0,Y=0,ae=0,T=0,A=0,O=0,u=0,v=0,q=0,W=0,he=0,_e=0,de=0,me=0,je=0,Pe=0,ye=w[0],pe=w[1],le=w[2],ue=w[3],ce=w[4],oe=w[5],se=w[6],te=w[7],fe=w[8],ge=w[9],ne=w[10],ve=w[11],be=w[12],Ee=w[13],De=w[14],we=w[15];c=x[0],U+=c*ye,K+=c*pe,G+=c*le,J+=c*ue,X+=c*ce,g+=c*oe,_+=c*se,$+=c*te,M+=c*fe,N+=c*ge,C+=c*ne,j+=c*ve,z+=c*be,Q+=c*Ee,H+=c*De,ee+=c*we,c=x[1],K+=c*ye,G+=c*pe,J+=c*le,X+=c*ue,g+=c*ce,_+=c*oe,$+=c*se,M+=c*te,N+=c*fe,C+=c*ge,j+=c*ne,z+=c*ve,Q+=c*be,H+=c*Ee,ee+=c*De,Y+=c*we,c=x[2],G+=c*ye,J+=c*pe,X+=c*le,g+=c*ue,_+=c*ce,$+=c*oe,M+=c*se,N+=c*te,C+=c*fe,j+=c*ge,z+=c*ne,Q+=c*ve,H+=c*be,ee+=c*Ee,Y+=c*De,ae+=c*we,c=x[3],J+=c*ye,X+=c*pe,g+=c*le,_+=c*ue,$+=c*ce,M+=c*oe,N+=c*se,C+=c*te,j+=c*fe,z+=c*ge,Q+=c*ne,H+=c*ve,ee+=c*be,Y+=c*Ee,ae+=c*De,T+=c*we,c=x[4],X+=c*ye,g+=c*pe,_+=c*le,$+=c*ue,M+=c*ce,N+=c*oe,C+=c*se,j+=c*te,z+=c*fe,Q+=c*ge,H+=c*ne,ee+=c*ve,Y+=c*be,ae+=c*Ee,T+=c*De,A+=c*we,c=x[5],g+=c*ye,_+=c*pe,$+=c*le,M+=c*ue,N+=c*ce,C+=c*oe,j+=c*se,z+=c*te,Q+=c*fe,H+=c*ge,ee+=c*ne,Y+=c*ve,ae+=c*be,T+=c*Ee,A+=c*De,O+=c*we,c=x[6],_+=c*ye,$+=c*pe,M+=c*le,N+=c*ue,C+=c*ce,j+=c*oe,z+=c*se,Q+=c*te,H+=c*fe,ee+=c*ge,Y+=c*ne,ae+=c*ve,T+=c*be,A+=c*Ee,O+=c*De,u+=c*we,c=x[7],$+=c*ye,M+=c*pe,N+=c*le,C+=c*ue,j+=c*ce,z+=c*oe,Q+=c*se,H+=c*te,ee+=c*fe,Y+=c*ge,ae+=c*ne,T+=c*ve,A+=c*be,O+=c*Ee,u+=c*De,v+=c*we,c=x[8],M+=c*ye,N+=c*pe,C+=c*le,j+=c*ue,z+=c*ce,Q+=c*oe,H+=c*se,ee+=c*te,Y+=c*fe,ae+=c*ge,T+=c*ne,A+=c*ve,O+=c*be,u+=c*Ee,v+=c*De,q+=c*we,c=x[9],N+=c*ye,C+=c*pe,j+=c*le,z+=c*ue,Q+=c*ce,H+=c*oe,ee+=c*se,Y+=c*te,ae+=c*fe,T+=c*ge,A+=c*ne,O+=c*ve,u+=c*be,v+=c*Ee,q+=c*De,W+=c*we,c=x[10],C+=c*ye,j+=c*pe,z+=c*le,Q+=c*ue,H+=c*ce,ee+=c*oe,Y+=c*se,ae+=c*te,T+=c*fe,A+=c*ge,O+=c*ne,u+=c*ve,v+=c*be,q+=c*Ee,W+=c*De,he+=c*we,c=x[11],j+=c*ye,z+=c*pe,Q+=c*le,H+=c*ue,ee+=c*ce,Y+=c*oe,ae+=c*se,T+=c*te,A+=c*fe,O+=c*ge,u+=c*ne,v+=c*ve,q+=c*be,W+=c*Ee,he+=c*De,_e+=c*we,c=x[12],z+=c*ye,Q+=c*pe,H+=c*le,ee+=c*ue,Y+=c*ce,ae+=c*oe,T+=c*se,A+=c*te,O+=c*fe,u+=c*ge,v+=c*ne,q+=c*ve,W+=c*be,he+=c*Ee,_e+=c*De,de+=c*we,c=x[13],Q+=c*ye,H+=c*pe,ee+=c*le,Y+=c*ue,ae+=c*ce,T+=c*oe,A+=c*se,O+=c*te,u+=c*fe,v+=c*ge,q+=c*ne,W+=c*ve,he+=c*be,_e+=c*Ee,de+=c*De,me+=c*we,c=x[14],H+=c*ye,ee+=c*pe,Y+=c*le,ae+=c*ue,T+=c*ce,A+=c*oe,O+=c*se,u+=c*te,v+=c*fe,q+=c*ge,W+=c*ne,he+=c*ve,_e+=c*be,de+=c*Ee,me+=c*De,je+=c*we,c=x[15],ee+=c*ye,Y+=c*pe,ae+=c*le,T+=c*ue,A+=c*ce,O+=c*oe,u+=c*se,v+=c*te,q+=c*fe,W+=c*ge,he+=c*ne,_e+=c*ve,de+=c*be,me+=c*Ee,je+=c*De,Pe+=c*we,U+=38*Y,K+=38*ae,G+=38*T,J+=38*A,X+=38*O,g+=38*u,_+=38*v,$+=38*q,M+=38*W,N+=38*he,C+=38*_e,j+=38*de,z+=38*me,Q+=38*je,H+=38*Pe,d=1,c=U+d+65535,d=Math.floor(c/65536),U=c-d*65536,c=K+d+65535,d=Math.floor(c/65536),K=c-d*65536,c=G+d+65535,d=Math.floor(c/65536),G=c-d*65536,c=J+d+65535,d=Math.floor(c/65536),J=c-d*65536,c=X+d+65535,d=Math.floor(c/65536),X=c-d*65536,c=g+d+65535,d=Math.floor(c/65536),g=c-d*65536,c=_+d+65535,d=Math.floor(c/65536),_=c-d*65536,c=$+d+65535,d=Math.floor(c/65536),$=c-d*65536,c=M+d+65535,d=Math.floor(c/65536),M=c-d*65536,c=N+d+65535,d=Math.floor(c/65536),N=c-d*65536,c=C+d+65535,d=Math.floor(c/65536),C=c-d*65536,c=j+d+65535,d=Math.floor(c/65536),j=c-d*65536,c=z+d+65535,d=Math.floor(c/65536),z=c-d*65536,c=Q+d+65535,d=Math.floor(c/65536),Q=c-d*65536,c=H+d+65535,d=Math.floor(c/65536),H=c-d*65536,c=ee+d+65535,d=Math.floor(c/65536),ee=c-d*65536,U+=d-1+37*(d-1),d=1,c=U+d+65535,d=Math.floor(c/65536),U=c-d*65536,c=K+d+65535,d=Math.floor(c/65536),K=c-d*65536,c=G+d+65535,d=Math.floor(c/65536),G=c-d*65536,c=J+d+65535,d=Math.floor(c/65536),J=c-d*65536,c=X+d+65535,d=Math.floor(c/65536),X=c-d*65536,c=g+d+65535,d=Math.floor(c/65536),g=c-d*65536,c=_+d+65535,d=Math.floor(c/65536),_=c-d*65536,c=$+d+65535,d=Math.floor(c/65536),$=c-d*65536,c=M+d+65535,d=Math.floor(c/65536),M=c-d*65536,c=N+d+65535,d=Math.floor(c/65536),N=c-d*65536,c=C+d+65535,d=Math.floor(c/65536),C=c-d*65536,c=j+d+65535,d=Math.floor(c/65536),j=c-d*65536,c=z+d+65535,d=Math.floor(c/65536),z=c-d*65536,c=Q+d+65535,d=Math.floor(c/65536),Q=c-d*65536,c=H+d+65535,d=Math.floor(c/65536),H=c-d*65536,c=ee+d+65535,d=Math.floor(c/65536),ee=c-d*65536,U+=d-1+37*(d-1),y[0]=U,y[1]=K,y[2]=G,y[3]=J,y[4]=X,y[5]=g,y[6]=_,y[7]=$,y[8]=M,y[9]=N,y[10]=C,y[11]=j,y[12]=z,y[13]=Q,y[14]=H,y[15]=ee}function m(y,x){E(y,x,x)}function b(y,x){const w=n();for(let c=0;c<16;c++)w[c]=x[c];for(let c=253;c>=0;c--)m(w,w),c!==2&&c!==4&&E(w,w,x);for(let c=0;c<16;c++)y[c]=w[c]}function P(y,x){const w=new Uint8Array(32),c=new Float64Array(80),d=n(),U=n(),K=n(),G=n(),J=n(),X=n();for(let M=0;M<31;M++)w[M]=y[M];w[31]=y[31]&127|64,w[0]&=248,f(c,x);for(let M=0;M<16;M++)U[M]=c[M];d[0]=G[0]=1;for(let M=254;M>=0;--M){const N=w[M>>>3]>>>(M&7)&1;a(d,U,N),a(K,G,N),l(J,d,K),D(d,d,K),l(K,U,G),D(U,U,G),m(G,J),m(X,d),E(d,K,d),E(K,U,J),l(J,d,K),D(d,d,K),m(U,d),D(K,G,X),E(d,K,s),l(d,d,G),E(K,K,d),E(d,G,X),E(G,U,c),m(U,J),a(d,U,N),a(K,G,N)}for(let M=0;M<16;M++)c[M+16]=d[M],c[M+32]=K[M],c[M+48]=U[M],c[M+64]=G[M];const g=c.subarray(32),_=c.subarray(16);b(g,g),E(_,_,g);const $=new Uint8Array(32);return h($,_),$}t.scalarMult=P;function R(y){return P(y,i)}t.scalarMultBase=R;function B(y){if(y.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const x=new Uint8Array(y);return{publicKey:R(x),secretKey:x}}t.generateKeyPairFromSeed=B;function S(y){const x=(0,e.randomBytes)(32,y),w=B(x);return(0,r.wipe)(x),w}t.generateKeyPair=S;function L(y,x,w=!1){if(y.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(x.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const c=P(y,x);if(w){let d=0;for(let U=0;U<c.length;U++)d|=c[U];if(d===0)throw new Error("X25519: invalid shared key")}return c}t.sharedKey=L})(si);function ks(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function oi(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=ks(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function sh(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),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=i}var a=t.length,h=t.charAt(0),f=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function D(b){if(b instanceof Uint8Array||(ArrayBuffer.isView(b)?b=new Uint8Array(b.buffer,b.byteOffset,b.byteLength):Array.isArray(b)&&(b=Uint8Array.from(b))),!(b instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(b.length===0)return"";for(var P=0,R=0,B=0,S=b.length;B!==S&&b[B]===0;)B++,P++;for(var L=(S-B)*l+1>>>0,y=new Uint8Array(L);B!==S;){for(var x=b[B],w=0,c=L-1;(x!==0||w<R)&&c!==-1;c--,w++)x+=256*y[c]>>>0,y[c]=x%a>>>0,x=x/a>>>0;if(x!==0)throw new Error("Non-zero carry");R=w,B++}for(var d=L-R;d!==L&&y[d]===0;)d++;for(var U=h.repeat(P);d<L;++d)U+=t.charAt(y[d]);return U}function E(b){if(typeof b!="string")throw new TypeError("Expected String");if(b.length===0)return new Uint8Array;var P=0;if(b[P]!==" "){for(var R=0,B=0;b[P]===h;)R++,P++;for(var S=(b.length-P)*f+1>>>0,L=new Uint8Array(S);b[P];){var y=r[b.charCodeAt(P)];if(y===255)return;for(var x=0,w=S-1;(y!==0||x<B)&&w!==-1;w--,x++)y+=a*L[w]>>>0,L[w]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");B=x,P++}if(b[P]!==" "){for(var c=S-B;c!==S&&L[c]===0;)c++;for(var d=new Uint8Array(R+(S-c)),U=R;c!==S;)d[U++]=L[c++];return d}}}function m(b){var P=E(b);if(P)return P;throw new Error(`Non-${e} character`)}return{encode:D,decodeUnsafe:E,decode:m}}var oh=sh,ah=oh;const Ys=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")},ch=t=>new TextEncoder().encode(t),uh=t=>new TextDecoder().decode(t);class fh{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 hh{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 Js(this,e)}}class lh{constructor(e){this.decoders=e}or(e){return Js(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 Js=(t,e)=>new lh({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class dh{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new fh(e,r,n),this.decoder=new hh(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const dn=({name:t,prefix:e,encode:r,decode:n})=>new dh(t,e,r,n),Ar=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=ah(r,e);return dn({prefix:t,name:e,encode:n,decode:s=>Ys(i(s))})},ph=(t,e,r,n)=>{const i={};for(let l=0;l<e.length;++l)i[e[l]]=l;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let a=0,h=0,f=0;for(let l=0;l<s;++l){const D=i[t[l]];if(D===void 0)throw new SyntaxError(`Non-${n} character`);h=h<<r|D,a+=r,a>=8&&(a-=8,o[f++]=255&h>>a)}if(a>=r||255&h<<8-a)throw new SyntaxError("Unexpected end of data");return o},gh=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let s="",o=0,a=0;for(let h=0;h<t.length;++h)for(a=a<<8|t[h],o+=8;o>r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s},nt=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>dn({prefix:e,name:t,encode(i){return gh(i,n,r)},decode(i){return ph(i,n,r,t)}}),yh=dn({prefix:"\0",name:"identity",encode:t=>uh(t),decode:t=>ch(t)});var _h=Object.freeze({__proto__:null,identity:yh});const vh=nt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var bh=Object.freeze({__proto__:null,base2:vh});const mh=nt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var wh=Object.freeze({__proto__:null,base8:mh});const Eh=Ar({prefix:"9",name:"base10",alphabet:"0123456789"});var Dh=Object.freeze({__proto__:null,base10:Eh});const xh=nt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Sh=nt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Oh=Object.freeze({__proto__:null,base16:xh,base16upper:Sh});const Ih=nt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Lh=nt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ah=nt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Th=nt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ch=nt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Rh=nt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Nh=nt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ph=nt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Fh=nt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var $h=Object.freeze({__proto__:null,base32:Ih,base32upper:Lh,base32pad:Ah,base32padupper:Th,base32hex:Ch,base32hexupper:Rh,base32hexpad:Nh,base32hexpadupper:Ph,base32z:Fh});const Mh=Ar({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Uh=Ar({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var jh=Object.freeze({__proto__:null,base36:Mh,base36upper:Uh});const Bh=Ar({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),zh=Ar({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Kh=Object.freeze({__proto__:null,base58btc:Bh,base58flickr:zh});const Hh=nt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),qh=nt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Vh=nt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Gh=nt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Wh=Object.freeze({__proto__:null,base64:Hh,base64pad:qh,base64url:Vh,base64urlpad:Gh});const Xs=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}"),kh=Xs.reduce((t,e,r)=>(t[r]=e,t),[]),Yh=Xs.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Jh(t){return t.reduce((e,r)=>(e+=kh[r],e),"")}function Xh(t){const e=[];for(const r of t){const n=Yh[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Zh=dn({prefix:"\u{1F680}",name:"base256emoji",encode:Jh,decode:Xh});var Qh=Object.freeze({__proto__:null,base256emoji:Zh}),el=Qs,Zs=128,tl=127,rl=~tl,nl=Math.pow(2,31);function Qs(t,e,r){e=e||[],r=r||0;for(var n=r;t>=nl;)e[r++]=t&255|Zs,t/=128;for(;t&rl;)e[r++]=t&255|Zs,t>>>=7;return e[r]=t|0,Qs.bytes=r-n+1,e}var il=ai,sl=128,eo=127;function ai(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw ai.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&eo)<<i:(o&eo)*Math.pow(2,i),i+=7}while(o>=sl);return ai.bytes=s-n,r}var ol=Math.pow(2,7),al=Math.pow(2,14),cl=Math.pow(2,21),ul=Math.pow(2,28),fl=Math.pow(2,35),hl=Math.pow(2,42),ll=Math.pow(2,49),dl=Math.pow(2,56),pl=Math.pow(2,63),gl=function(t){return t<ol?1:t<al?2:t<cl?3:t<ul?4:t<fl?5:t<hl?6:t<ll?7:t<dl?8:t<pl?9:10},yl={encode:el,decode:il,encodingLength:gl},to=yl;const ro=(t,e,r=0)=>(to.encode(t,e,r),e),no=t=>to.encodingLength(t),ci=(t,e)=>{const r=e.byteLength,n=no(t),i=n+no(r),s=new Uint8Array(i+r);return ro(t,s,0),ro(r,s,n),s.set(e,i),new _l(t,r,e,s)};class _l{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const io=({name:t,code:e,encode:r})=>new vl(t,e,r);class vl{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?ci(this.code,r):r.then(n=>ci(this.code,n))}else throw Error("Unknown type, must be binary type")}}const so=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),bl=io({name:"sha2-256",code:18,encode:so("SHA-256")}),ml=io({name:"sha2-512",code:19,encode:so("SHA-512")});var wl=Object.freeze({__proto__:null,sha256:bl,sha512:ml});const oo=0,El="identity",ao=Ys;var Dl=Object.freeze({__proto__:null,identity:{code:oo,name:El,encode:ao,digest:t=>ci(oo,ao(t))}});new TextEncoder,new TextDecoder;const co={..._h,...bh,...wh,...Dh,...Oh,...$h,...jh,...Kh,...Wh,...Qh};({...wl,...Dl});function uo(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const fo=uo("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ui=uo("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=ks(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),ho={utf8:fo,"utf-8":fo,hex:co.base16,latin1:ui,ascii:ui,binary:ui,...co};function ht(t,e="utf8"){const r=ho[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,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}function lt(t,e="utf8"){const r=ho[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)}var lo=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))},xl=function(){function t(e,r,n){this.name=e,this.version=r,this.os=n,this.type="browser"}return t}(),Sl=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),Ol=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}(),Il=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),Ll=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),Al=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Tl=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,po=3,Cl=[["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",Al]],go=[["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 Rl(t){return t?yo(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Ll:typeof navigator<"u"?yo(navigator.userAgent):Fl()}function Nl(t){return t!==""&&Cl.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 yo(t){var e=Nl(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new Il;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<po&&(i=lo(lo([],i,!0),$l(po-i.length),!0)):i=[];var s=i.join("."),o=Pl(t),a=Tl.exec(t);return a&&a[1]?new Ol(r,s,o,a[1]):new xl(r,s,o)}function Pl(t){for(var e=0,r=go.length;e<r;e++){var n=go[e],i=n[0],s=n[1],o=s.exec(t);if(o)return i}return null}function Fl(){var t=typeof process<"u"&&process.version;return t?new Sl(process.version.slice(1)):null}function $l(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}var Z={};/*! *****************************************************************************
|
|
14
|
+
***************************************************************************** */var Jn=function(t,e){return Jn=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])},Jn(t,e)};function Zu(t,e){Jn(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Xn=function(){return Xn=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},Xn.apply(this,arguments)};function Qu(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 ef(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function tf(t,e){return function(r,n){e(r,n,t)}}function rf(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function nf(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{f(n.next(l))}catch(D){o(D)}}function h(l){try{f(n.throw(l))}catch(D){o(D)}}function f(l){l.done?s(l.value):i(l.value).then(a,h)}f((n=n.apply(t,e||[])).next())})}function sf(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(f){return function(l){return h([f,l])}}function h(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=f[0]&2?i.return:f[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,f[1])).done)return s;switch(i=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){r.label=f[1];break}if(f[0]===6&&r.label<s[1]){r.label=s[1],s=f;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(f);break}s[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(l){f=[6,l],i=0}finally{n=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function of(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function af(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Zn(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 Cs(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function cf(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Cs(arguments[e]));return t}function uf(){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],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Or(t){return this instanceof Or?(this.v=t,this):new Or(t)}function ff(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(b){n[b]&&(i[b]=function(m){return new Promise(function(w,N){s.push([b,m,w,N])>1||a(b,m)})})}function a(b,m){try{h(n[b](m))}catch(w){D(s[0][3],w)}}function h(b){b.value instanceof Or?Promise.resolve(b.value.v).then(f,l):D(s[0][2],b)}function f(b){a("next",b)}function l(b){a("throw",b)}function D(b,m){b(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function hf(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(o){return(r=!r)?{value:Or(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function lf(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 Zn=="function"?Zn(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(o){return new Promise(function(a,h){o=t[s](o),i(a,h,o.done,o.value)})}}function i(s,o,a,h){Promise.resolve(h).then(function(f){s({value:f,done:a})},o)}}function df(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function pf(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 gf(t){return t&&t.__esModule?t:{default:t}}function yf(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function vf(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 _f=Object.freeze({__proto__:null,__extends:Zu,get __assign(){return Xn},__rest:Qu,__decorate:ef,__param:tf,__metadata:rf,__awaiter:nf,__generator:sf,__createBinding:of,__exportStar:af,__values:Zn,__read:Cs,__spread:cf,__spreadArrays:uf,__await:Or,__asyncGenerator:ff,__asyncDelegator:hf,__asyncValues:lf,__makeTemplateObject:df,__importStar:pf,__importDefault:gf,__classPrivateFieldGet:yf,__classPrivateFieldSet:vf}),bf=Zt(_f),Mt={},Rs;function mf(){if(Rs)return Mt;Rs=1,Object.defineProperty(Mt,"__esModule",{value:!0}),Mt.isBrowserCryptoAvailable=Mt.getSubtleCrypto=Mt.getBrowerCrypto=void 0;function t(){return ke?.crypto||ke?.msCrypto||{}}Mt.getBrowerCrypto=t;function e(){const n=t();return n.subtle||n.webkitSubtle}Mt.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Mt.isBrowserCryptoAvailable=r,Mt}var Ut={},Ps;function wf(){if(Ps)return Ut;Ps=1,Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.isBrowser=Ut.isNode=Ut.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Ut.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Ut.isNode=e;function r(){return!t()&&!e()}return Ut.isBrowser=r,Ut}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=bf;e.__exportStar(mf(),t),e.__exportStar(wf(),t)})(Ts);function Ef(){const t=Date.now()*Math.pow(10,3),e=Math.floor(Math.random()*Math.pow(10,3));return t+e}function sn(t,e,r){return{id:r||Ef(),jsonrpc:"2.0",method:t,params:e}}function on(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Lr(t,e,r){return{id:t,jsonrpc:"2.0",error:Df(e,r)}}function Df(t,e){return typeof t>"u"?Is(Os):(typeof t=="string"&&(t=Object.assign(Object.assign({},Is(Yn)),{message:t})),typeof e<"u"&&(t.data=e),Ju(t.code)&&(t=Xu(t.code)),t)}class Ns{}class xf extends Ns{constructor(e){super()}}class Sf extends Ns{constructor(){super()}}class Of extends Sf{constructor(e){super()}}const Lf="^https?:",If="^wss?:";function Af(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function $s(t,e){const r=Af(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function Fs(t){return $s(t,Lf)}function Ms(t){return $s(t,If)}function Tf(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function Us(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function Qn(t){return Us(t)&&"method"in t}function ei(t){return Us(t)&&(jt(t)||Ot(t))}function jt(t){return"result"in t}function Ot(t){return"error"in t}class ti extends Of{constructor(e){super(e),this.events=new kn.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(sn(e.method,e.params||[]),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=>{Ot(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),ei(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}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",()=>this.events.emit("disconnect")),this.connection.on("error",e=>this.events.emit("error",e)),this.hasRegisteredEventListeners=!0)}}var ri={exports:{}};(function(t,e){var r=typeof self<"u"?self:ke,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={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 h(g){return g&&DataView.prototype.isPrototypeOf(g)}if(a.arrayBuffer)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(g){return g&&f.indexOf(Object.prototype.toString.call(g))>-1};function D(g){if(typeof g!="string"&&(g=String(g)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(g))throw new TypeError("Invalid character in header field name");return g.toLowerCase()}function b(g){return typeof g!="string"&&(g=String(g)),g}function m(g){var v={next:function(){var F=g.shift();return{done:F===void 0,value:F}}};return a.iterable&&(v[Symbol.iterator]=function(){return v}),v}function w(g){this.map={},g instanceof w?g.forEach(function(v,F){this.append(F,v)},this):Array.isArray(g)?g.forEach(function(v){this.append(v[0],v[1])},this):g&&Object.getOwnPropertyNames(g).forEach(function(v){this.append(v,g[v])},this)}w.prototype.append=function(g,v){g=D(g),v=b(v);var F=this.map[g];this.map[g]=F?F+", "+v:v},w.prototype.delete=function(g){delete this.map[D(g)]},w.prototype.get=function(g){return g=D(g),this.has(g)?this.map[g]:null},w.prototype.has=function(g){return this.map.hasOwnProperty(D(g))},w.prototype.set=function(g,v){this.map[D(g)]=b(v)},w.prototype.forEach=function(g,v){for(var F in this.map)this.map.hasOwnProperty(F)&&g.call(v,this.map[F],F,this)},w.prototype.keys=function(){var g=[];return this.forEach(function(v,F){g.push(F)}),m(g)},w.prototype.values=function(){var g=[];return this.forEach(function(v){g.push(v)}),m(g)},w.prototype.entries=function(){var g=[];return this.forEach(function(v,F){g.push([F,v])}),m(g)},a.iterable&&(w.prototype[Symbol.iterator]=w.prototype.entries);function N(g){if(g.bodyUsed)return Promise.reject(new TypeError("Already read"));g.bodyUsed=!0}function R(g){return new Promise(function(v,F){g.onload=function(){v(g.result)},g.onerror=function(){F(g.error)}})}function B(g){var v=new FileReader,F=R(v);return v.readAsArrayBuffer(g),F}function S(g){var v=new FileReader,F=R(v);return v.readAsText(g),F}function I(g){for(var v=new Uint8Array(g),F=new Array(v.length),M=0;M<v.length;M++)F[M]=String.fromCharCode(v[M]);return F.join("")}function y(g){if(g.slice)return g.slice(0);var v=new Uint8Array(g.byteLength);return v.set(new Uint8Array(g)),v.buffer}function x(){return this.bodyUsed=!1,this._initBody=function(g){this._bodyInit=g,g?typeof g=="string"?this._bodyText=g:a.blob&&Blob.prototype.isPrototypeOf(g)?this._bodyBlob=g:a.formData&&FormData.prototype.isPrototypeOf(g)?this._bodyFormData=g:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(g)?this._bodyText=g.toString():a.arrayBuffer&&a.blob&&h(g)?(this._bodyArrayBuffer=y(g.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(g)||l(g))?this._bodyArrayBuffer=y(g):this._bodyText=g=Object.prototype.toString.call(g):this._bodyText="",this.headers.get("content-type")||(typeof g=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(g)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var g=N(this);if(g)return g;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?N(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(B)}),this.text=function(){var g=N(this);if(g)return g;if(this._bodyBlob)return S(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(I(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(U)}),this.json=function(){return this.text().then(JSON.parse)},this}var E=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function c(g){var v=g.toUpperCase();return E.indexOf(v)>-1?v:g}function d(g,v){v=v||{};var F=v.body;if(g instanceof d){if(g.bodyUsed)throw new TypeError("Already read");this.url=g.url,this.credentials=g.credentials,v.headers||(this.headers=new w(g.headers)),this.method=g.method,this.mode=g.mode,this.signal=g.signal,!F&&g._bodyInit!=null&&(F=g._bodyInit,g.bodyUsed=!0)}else this.url=String(g);if(this.credentials=v.credentials||this.credentials||"same-origin",(v.headers||!this.headers)&&(this.headers=new w(v.headers)),this.method=c(v.method||this.method||"GET"),this.mode=v.mode||this.mode||null,this.signal=v.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&F)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(F)}d.prototype.clone=function(){return new d(this,{body:this._bodyInit})};function U(g){var v=new FormData;return g.trim().split("&").forEach(function(F){if(F){var M=F.split("="),P=M.shift().replace(/\+/g," "),C=M.join("=").replace(/\+/g," ");v.append(decodeURIComponent(P),decodeURIComponent(C))}}),v}function K(g){var v=new w,F=g.replace(/\r?\n[\t ]+/g," ");return F.split(/\r?\n/).forEach(function(M){var P=M.split(":"),C=P.shift().trim();if(C){var j=P.join(":").trim();v.append(C,j)}}),v}x.call(d.prototype);function G(g,v){v||(v={}),this.type="default",this.status=v.status===void 0?200:v.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in v?v.statusText:"OK",this.headers=new w(v.headers),this.url=v.url||"",this._initBody(g)}x.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new w(this.headers),url:this.url})},G.error=function(){var g=new G(null,{status:0,statusText:""});return g.type="error",g};var J=[301,302,303,307,308];G.redirect=function(g,v){if(J.indexOf(v)===-1)throw new RangeError("Invalid status code");return new G(null,{status:v,headers:{location:g}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(v,F){this.message=v,this.name=F;var M=Error(v);this.stack=M.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function X(g,v){return new Promise(function(F,M){var P=new d(g,v);if(P.signal&&P.signal.aborted)return M(new o.DOMException("Aborted","AbortError"));var C=new XMLHttpRequest;function j(){C.abort()}C.onload=function(){var z={status:C.status,statusText:C.statusText,headers:K(C.getAllResponseHeaders()||"")};z.url="responseURL"in C?C.responseURL:z.headers.get("X-Request-URL");var Q="response"in C?C.response:C.responseText;F(new G(Q,z))},C.onerror=function(){M(new TypeError("Network request failed"))},C.ontimeout=function(){M(new TypeError("Network request failed"))},C.onabort=function(){M(new o.DOMException("Aborted","AbortError"))},C.open(P.method,P.url,!0),P.credentials==="include"?C.withCredentials=!0:P.credentials==="omit"&&(C.withCredentials=!1),"responseType"in C&&a.blob&&(C.responseType="blob"),P.headers.forEach(function(z,Q){C.setRequestHeader(Q,z)}),P.signal&&(P.signal.addEventListener("abort",j),C.onreadystatechange=function(){C.readyState===4&&P.signal.removeEventListener("abort",j)}),C.send(typeof P._bodyInit>"u"?null:P._bodyInit)})}return X.polyfill=!0,s.fetch||(s.fetch=X,s.Headers=w,s.Request=d,s.Response=G),o.Headers=w,o.Request=d,o.Response=G,o.fetch=X,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(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})(ri,ri.exports);var js=Mu(ri.exports);function ni(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}function Ir(t){return typeof t=="string"?t:JSON.stringify(t)}const Bs={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},zs=10;class Cf{constructor(e){if(this.url=e,this.events=new kn.EventEmitter,this.isAvailable=!1,this.registering=!1,!Fs(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e}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=Ir(e),s=await(await js(this.url,Object.assign(Object.assign({},Bs),{body:n}))).json();this.onPayload({data:s})}catch(n){this.onError(e.id,n)}}async register(e=this.url){if(!Fs(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{const r=Ir({id:1,jsonrpc:"2.0",method:"test",params:[]});await js(e,Object.assign(Object.assign({},Bs),{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"?ni(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Lr(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return As(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>zs&&this.events.setMaxListeners(zs)}}var ii={},an={},re={},Ks={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(a,h){var f=a>>>16&65535,l=a&65535,D=h>>>16&65535,b=h&65535;return l*b+(f*b+l*D<<16>>>0)|0}t.mul=Math.imul||e;function r(a,h){return a+h|0}t.add=r;function n(a,h){return a-h|0}t.sub=n;function i(a,h){return a<<h|a>>>32-h}t.rotl=i;function s(a,h){return a<<32-h|a>>>h}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(Ks),Object.defineProperty(re,"__esModule",{value:!0});var qs=Ks;function Rf(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}re.readInt16BE=Rf;function Pf(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}re.readUint16BE=Pf;function Nf(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}re.readInt16LE=Nf;function $f(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}re.readUint16LE=$f;function Hs(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}re.writeUint16BE=Hs,re.writeInt16BE=Hs;function Vs(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}re.writeUint16LE=Vs,re.writeInt16LE=Vs;function si(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}re.readInt32BE=si;function oi(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}re.readUint32BE=oi;function ai(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}re.readInt32LE=ai;function ci(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}re.readUint32LE=ci;function cn(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}re.writeUint32BE=cn,re.writeInt32BE=cn;function un(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}re.writeUint32LE=un,re.writeInt32LE=un;function Ff(t,e){e===void 0&&(e=0);var r=si(t,e),n=si(t,e+4);return r*4294967296+n-(n>>31)*4294967296}re.readInt64BE=Ff;function Mf(t,e){e===void 0&&(e=0);var r=oi(t,e),n=oi(t,e+4);return r*4294967296+n}re.readUint64BE=Mf;function Uf(t,e){e===void 0&&(e=0);var r=ai(t,e),n=ai(t,e+4);return n*4294967296+r-(r>>31)*4294967296}re.readInt64LE=Uf;function jf(t,e){e===void 0&&(e=0);var r=ci(t,e),n=ci(t,e+4);return n*4294967296+r}re.readUint64LE=jf;function Gs(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),cn(t/4294967296>>>0,e,r),cn(t>>>0,e,r+4),e}re.writeUint64BE=Gs,re.writeInt64BE=Gs;function Ws(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),un(t>>>0,e,r),un(t/4294967296>>>0,e,r+4),e}re.writeUint64LE=Ws,re.writeInt64LE=Ws;function Bf(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}re.readUintBE=Bf;function zf(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}re.readUintLE=zf;function Kf(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(!qs.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}re.writeUintBE=Kf;function qf(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(!qs.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}re.writeUintLE=qf;function Hf(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e)}re.readFloat32BE=Hf;function Vf(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e,!0)}re.readFloat32LE=Vf;function Gf(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e)}re.readFloat64BE=Gf;function Wf(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e,!0)}re.readFloat64LE=Wf;function kf(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}re.writeFloat32BE=kf;function Yf(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}re.writeFloat32LE=Yf;function Jf(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}re.writeFloat64BE=Jf;function Xf(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}re.writeFloat64LE=Xf;var _t={};Object.defineProperty(_t,"__esModule",{value:!0});function Zf(t){for(var e=0;e<t.length;e++)t[e]=0;return t}_t.wipe=Zf,Object.defineProperty(an,"__esModule",{value:!0});var ct=re,ui=_t,Qf=20;function eh(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],h=r[7]<<24|r[6]<<16|r[5]<<8|r[4],f=r[11]<<24|r[10]<<16|r[9]<<8|r[8],l=r[15]<<24|r[14]<<16|r[13]<<8|r[12],D=r[19]<<24|r[18]<<16|r[17]<<8|r[16],b=r[23]<<24|r[22]<<16|r[21]<<8|r[20],m=r[27]<<24|r[26]<<16|r[25]<<8|r[24],w=r[31]<<24|r[30]<<16|r[29]<<8|r[28],N=e[3]<<24|e[2]<<16|e[1]<<8|e[0],R=e[7]<<24|e[6]<<16|e[5]<<8|e[4],B=e[11]<<24|e[10]<<16|e[9]<<8|e[8],S=e[15]<<24|e[14]<<16|e[13]<<8|e[12],I=n,y=i,x=s,E=o,c=a,d=h,U=f,K=l,G=D,J=b,X=m,g=w,v=N,F=R,M=B,P=S,C=0;C<Qf;C+=2)I=I+c|0,v^=I,v=v>>>32-16|v<<16,G=G+v|0,c^=G,c=c>>>32-12|c<<12,y=y+d|0,F^=y,F=F>>>32-16|F<<16,J=J+F|0,d^=J,d=d>>>32-12|d<<12,x=x+U|0,M^=x,M=M>>>32-16|M<<16,X=X+M|0,U^=X,U=U>>>32-12|U<<12,E=E+K|0,P^=E,P=P>>>32-16|P<<16,g=g+P|0,K^=g,K=K>>>32-12|K<<12,x=x+U|0,M^=x,M=M>>>32-8|M<<8,X=X+M|0,U^=X,U=U>>>32-7|U<<7,E=E+K|0,P^=E,P=P>>>32-8|P<<8,g=g+P|0,K^=g,K=K>>>32-7|K<<7,y=y+d|0,F^=y,F=F>>>32-8|F<<8,J=J+F|0,d^=J,d=d>>>32-7|d<<7,I=I+c|0,v^=I,v=v>>>32-8|v<<8,G=G+v|0,c^=G,c=c>>>32-7|c<<7,I=I+d|0,P^=I,P=P>>>32-16|P<<16,X=X+P|0,d^=X,d=d>>>32-12|d<<12,y=y+U|0,v^=y,v=v>>>32-16|v<<16,g=g+v|0,U^=g,U=U>>>32-12|U<<12,x=x+K|0,F^=x,F=F>>>32-16|F<<16,G=G+F|0,K^=G,K=K>>>32-12|K<<12,E=E+c|0,M^=E,M=M>>>32-16|M<<16,J=J+M|0,c^=J,c=c>>>32-12|c<<12,x=x+K|0,F^=x,F=F>>>32-8|F<<8,G=G+F|0,K^=G,K=K>>>32-7|K<<7,E=E+c|0,M^=E,M=M>>>32-8|M<<8,J=J+M|0,c^=J,c=c>>>32-7|c<<7,y=y+U|0,v^=y,v=v>>>32-8|v<<8,g=g+v|0,U^=g,U=U>>>32-7|U<<7,I=I+d|0,P^=I,P=P>>>32-8|P<<8,X=X+P|0,d^=X,d=d>>>32-7|d<<7;ct.writeUint32LE(I+n|0,t,0),ct.writeUint32LE(y+i|0,t,4),ct.writeUint32LE(x+s|0,t,8),ct.writeUint32LE(E+o|0,t,12),ct.writeUint32LE(c+a|0,t,16),ct.writeUint32LE(d+h|0,t,20),ct.writeUint32LE(U+f|0,t,24),ct.writeUint32LE(K+l|0,t,28),ct.writeUint32LE(G+D|0,t,32),ct.writeUint32LE(J+b|0,t,36),ct.writeUint32LE(X+m|0,t,40),ct.writeUint32LE(g+w|0,t,44),ct.writeUint32LE(v+N|0,t,48),ct.writeUint32LE(F+R|0,t,52),ct.writeUint32LE(M+B|0,t,56),ct.writeUint32LE(P+S|0,t,60)}function ks(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,o;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),o=s.length-e.length,s.set(e,o)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,o=i}for(var a=new Uint8Array(64),h=0;h<r.length;h+=64){eh(a,s,t);for(var f=h;f<h+64&&f<r.length;f++)n[f]=r[f]^a[f-h];rh(s,0,o)}return ui.wipe(a),i===0&&ui.wipe(s),n}an.streamXOR=ks;function th(t,e,r,n){return n===void 0&&(n=0),ui.wipe(r),ks(t,e,r,r,n)}an.stream=th;function rh(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 Ys={},Vt={};Object.defineProperty(Vt,"__esModule",{value:!0});function nh(t,e,r){return~(t-1)&e|t-1&r}Vt.select=nh;function ih(t,e){return(t|0)-(e|0)-1>>>31&1}Vt.lessOrEqual=ih;function Js(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}Vt.compare=Js;function sh(t,e){return t.length===0||e.length===0?!1:Js(t,e)!==0}Vt.equal=sh,function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Vt,r=_t;t.DIGEST_LENGTH=16;var n=function(){function o(a){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 h=a[0]|a[1]<<8;this._r[0]=h&8191;var f=a[2]|a[3]<<8;this._r[1]=(h>>>13|f<<3)&8191;var l=a[4]|a[5]<<8;this._r[2]=(f>>>10|l<<6)&7939;var D=a[6]|a[7]<<8;this._r[3]=(l>>>7|D<<9)&8191;var b=a[8]|a[9]<<8;this._r[4]=(D>>>4|b<<12)&255,this._r[5]=b>>>1&8190;var m=a[10]|a[11]<<8;this._r[6]=(b>>>14|m<<2)&8191;var w=a[12]|a[13]<<8;this._r[7]=(m>>>11|w<<5)&8065;var N=a[14]|a[15]<<8;this._r[8]=(w>>>8|N<<8)&8191,this._r[9]=N>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,h,f){for(var l=this._fin?0:2048,D=this._h[0],b=this._h[1],m=this._h[2],w=this._h[3],N=this._h[4],R=this._h[5],B=this._h[6],S=this._h[7],I=this._h[8],y=this._h[9],x=this._r[0],E=this._r[1],c=this._r[2],d=this._r[3],U=this._r[4],K=this._r[5],G=this._r[6],J=this._r[7],X=this._r[8],g=this._r[9];f>=16;){var v=a[h+0]|a[h+1]<<8;D+=v&8191;var F=a[h+2]|a[h+3]<<8;b+=(v>>>13|F<<3)&8191;var M=a[h+4]|a[h+5]<<8;m+=(F>>>10|M<<6)&8191;var P=a[h+6]|a[h+7]<<8;w+=(M>>>7|P<<9)&8191;var C=a[h+8]|a[h+9]<<8;N+=(P>>>4|C<<12)&8191,R+=C>>>1&8191;var j=a[h+10]|a[h+11]<<8;B+=(C>>>14|j<<2)&8191;var z=a[h+12]|a[h+13]<<8;S+=(j>>>11|z<<5)&8191;var Q=a[h+14]|a[h+15]<<8;I+=(z>>>8|Q<<8)&8191,y+=Q>>>5|l;var q=0,ee=q;ee+=D*x,ee+=b*(5*g),ee+=m*(5*X),ee+=w*(5*J),ee+=N*(5*G),q=ee>>>13,ee&=8191,ee+=R*(5*K),ee+=B*(5*U),ee+=S*(5*d),ee+=I*(5*c),ee+=y*(5*E),q+=ee>>>13,ee&=8191;var Y=q;Y+=D*E,Y+=b*x,Y+=m*(5*g),Y+=w*(5*X),Y+=N*(5*J),q=Y>>>13,Y&=8191,Y+=R*(5*G),Y+=B*(5*K),Y+=S*(5*U),Y+=I*(5*d),Y+=y*(5*c),q+=Y>>>13,Y&=8191;var ae=q;ae+=D*c,ae+=b*E,ae+=m*x,ae+=w*(5*g),ae+=N*(5*X),q=ae>>>13,ae&=8191,ae+=R*(5*J),ae+=B*(5*G),ae+=S*(5*K),ae+=I*(5*U),ae+=y*(5*d),q+=ae>>>13,ae&=8191;var T=q;T+=D*d,T+=b*c,T+=m*E,T+=w*x,T+=N*(5*g),q=T>>>13,T&=8191,T+=R*(5*X),T+=B*(5*J),T+=S*(5*G),T+=I*(5*K),T+=y*(5*U),q+=T>>>13,T&=8191;var A=q;A+=D*U,A+=b*d,A+=m*c,A+=w*E,A+=N*x,q=A>>>13,A&=8191,A+=R*(5*g),A+=B*(5*X),A+=S*(5*J),A+=I*(5*G),A+=y*(5*K),q+=A>>>13,A&=8191;var O=q;O+=D*K,O+=b*U,O+=m*d,O+=w*c,O+=N*E,q=O>>>13,O&=8191,O+=R*x,O+=B*(5*g),O+=S*(5*X),O+=I*(5*J),O+=y*(5*G),q+=O>>>13,O&=8191;var u=q;u+=D*G,u+=b*K,u+=m*U,u+=w*d,u+=N*c,q=u>>>13,u&=8191,u+=R*E,u+=B*x,u+=S*(5*g),u+=I*(5*X),u+=y*(5*J),q+=u>>>13,u&=8191;var _=q;_+=D*J,_+=b*G,_+=m*K,_+=w*U,_+=N*d,q=_>>>13,_&=8191,_+=R*c,_+=B*E,_+=S*x,_+=I*(5*g),_+=y*(5*X),q+=_>>>13,_&=8191;var H=q;H+=D*X,H+=b*J,H+=m*G,H+=w*K,H+=N*U,q=H>>>13,H&=8191,H+=R*d,H+=B*c,H+=S*E,H+=I*x,H+=y*(5*g),q+=H>>>13,H&=8191;var W=q;W+=D*g,W+=b*X,W+=m*J,W+=w*G,W+=N*K,q=W>>>13,W&=8191,W+=R*U,W+=B*d,W+=S*c,W+=I*E,W+=y*x,q+=W>>>13,W&=8191,q=(q<<2)+q|0,q=q+ee|0,ee=q&8191,q=q>>>13,Y+=q,D=ee,b=Y,m=ae,w=T,N=A,R=O,B=u,S=_,I=H,y=W,h+=16,f-=16}this._h[0]=D,this._h[1]=b,this._h[2]=m,this._h[3]=w,this._h[4]=N,this._h[5]=R,this._h[6]=B,this._h[7]=S,this._h[8]=I,this._h[9]=y},o.prototype.finish=function(a,h){h===void 0&&(h=0);var f=new Uint16Array(10),l,D,b,m;if(this._leftover){for(m=this._leftover,this._buffer[m++]=1;m<16;m++)this._buffer[m]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(l=this._h[1]>>>13,this._h[1]&=8191,m=2;m<10;m++)this._h[m]+=l,l=this._h[m]>>>13,this._h[m]&=8191;for(this._h[0]+=l*5,l=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=l,l=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=l,f[0]=this._h[0]+5,l=f[0]>>>13,f[0]&=8191,m=1;m<10;m++)f[m]=this._h[m]+l,l=f[m]>>>13,f[m]&=8191;for(f[9]-=1<<13,D=(l^1)-1,m=0;m<10;m++)f[m]&=D;for(D=~D,m=0;m<10;m++)this._h[m]=this._h[m]&D|f[m];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,b=this._h[0]+this._pad[0],this._h[0]=b&65535,m=1;m<8;m++)b=(this._h[m]+this._pad[m]|0)+(b>>>16)|0,this._h[m]=b&65535;return a[h+0]=this._h[0]>>>0,a[h+1]=this._h[0]>>>8,a[h+2]=this._h[1]>>>0,a[h+3]=this._h[1]>>>8,a[h+4]=this._h[2]>>>0,a[h+5]=this._h[2]>>>8,a[h+6]=this._h[3]>>>0,a[h+7]=this._h[3]>>>8,a[h+8]=this._h[4]>>>0,a[h+9]=this._h[4]>>>8,a[h+10]=this._h[5]>>>0,a[h+11]=this._h[5]>>>8,a[h+12]=this._h[6]>>>0,a[h+13]=this._h[6]>>>8,a[h+14]=this._h[7]>>>0,a[h+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var h=0,f=a.length,l;if(this._leftover){l=16-this._leftover,l>f&&(l=f);for(var D=0;D<l;D++)this._buffer[this._leftover+D]=a[h+D];if(f-=l,h+=l,this._leftover+=l,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(f>=16&&(l=f-f%16,this._blocks(a,h,l),h+=l,f-=l),f){for(var D=0;D<f;D++)this._buffer[this._leftover+D]=a[h+D];this._leftover+=f}return this},o.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var a=new Uint8Array(16);return this.finish(a),a},o.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},o}();t.Poly1305=n;function i(o,a){var h=new n(o);h.update(a);var f=h.digest();return h.clean(),f}t.oneTimeAuth=i;function s(o,a){return o.length!==t.DIGEST_LENGTH||a.length!==t.DIGEST_LENGTH?!1:e.equal(o,a)}t.equal=s}(Ys),function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=an,r=Ys,n=_t,i=re,s=Vt;t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var o=new Uint8Array(16),a=function(){function h(f){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,f.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(f)}return h.prototype.seal=function(f,l,D,b){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var m=new Uint8Array(16);m.set(f,m.length-f.length);var w=new Uint8Array(32);e.stream(this._key,m,w,4);var N=l.length+this.tagLength,R;if(b){if(b.length!==N)throw new Error("ChaCha20Poly1305: incorrect destination length");R=b}else R=new Uint8Array(N);return e.streamXOR(this._key,m,l,R,4),this._authenticate(R.subarray(R.length-this.tagLength,R.length),w,R.subarray(0,R.length-this.tagLength),D),n.wipe(m),R},h.prototype.open=function(f,l,D,b){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(l.length<this.tagLength)return null;var m=new Uint8Array(16);m.set(f,m.length-f.length);var w=new Uint8Array(32);e.stream(this._key,m,w,4);var N=new Uint8Array(this.tagLength);if(this._authenticate(N,w,l.subarray(0,l.length-this.tagLength),D),!s.equal(N,l.subarray(l.length-this.tagLength,l.length)))return null;var R=l.length-this.tagLength,B;if(b){if(b.length!==R)throw new Error("ChaCha20Poly1305: incorrect destination length");B=b}else B=new Uint8Array(R);return e.streamXOR(this._key,m,l.subarray(0,l.length-this.tagLength),B,4),n.wipe(m),B},h.prototype.clean=function(){return n.wipe(this._key),this},h.prototype._authenticate=function(f,l,D,b){var m=new r.Poly1305(l);b&&(m.update(b),b.length%16>0&&m.update(o.subarray(b.length%16))),m.update(D),D.length%16>0&&m.update(o.subarray(D.length%16));var w=new Uint8Array(8);b&&i.writeUint64LE(b.length,w),m.update(w),i.writeUint64LE(D.length,w),m.update(w);for(var N=m.digest(),R=0;R<N.length;R++)f[R]=N[R];m.clean(),n.wipe(N),n.wipe(w)},h}();t.ChaCha20Poly1305=a}(ii);var Xs={},Ar={},fi={};Object.defineProperty(fi,"__esModule",{value:!0});function oh(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}fi.isSerializableHash=oh,Object.defineProperty(Ar,"__esModule",{value:!0});var At=fi,ah=Vt,ch=_t,Zs=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),At.isSerializableHash(this._inner)&&At.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),ch.wipe(n)}return t.prototype.reset=function(){if(!At.isSerializableHash(this._inner)||!At.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(){At.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),At.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(!At.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(!At.isSerializableHash(this._inner)||!At.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(!At.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},t}();Ar.HMAC=Zs;function uh(t,e,r){var n=new Zs(t,e);n.update(r);var i=n.digest();return n.clean(),i}Ar.hmac=uh,Ar.equal=ah.equal,Object.defineProperty(Xs,"__esModule",{value:!0});var Qs=Ar,eo=_t,fh=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=Qs.hmac(this._hash,n,r);this._hmac=new Qs.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(),eo.wipe(this._buffer),eo.wipe(this._counter),this._bufpos=0},t}(),hh=Xs.HKDF=fh,lr={},fn={},hn={};Object.defineProperty(hn,"__esModule",{value:!0}),hn.BrowserRandomSource=void 0;const to=65536;class lh{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+=to)this._crypto.getRandomValues(r.subarray(n,n+Math.min(r.length-n,to)));return r}}hn.BrowserRandomSource=lh;function dh(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 ln={},ph={},gh=Object.freeze({__proto__:null,default:ph}),yh=Zt(gh);Object.defineProperty(ln,"__esModule",{value:!0}),ln.NodeRandomSource=void 0;const vh=_t;class _h{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof dh<"u"){const e=yh;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,vh.wipe)(r),n}}ln.NodeRandomSource=_h,Object.defineProperty(fn,"__esModule",{value:!0}),fn.SystemRandomSource=void 0;const bh=hn,mh=ln;class wh{constructor(){if(this.isAvailable=!1,this.name="",this._source=new bh.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new mh.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)}}fn.SystemRandomSource=wh,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=fn,r=re,n=_t;t.defaultRandomSource=new e.SystemRandomSource;function i(f,l=t.defaultRandomSource){return l.randomBytes(f)}t.randomBytes=i;function s(f=t.defaultRandomSource){const l=i(4,f),D=(0,r.readUint32LE)(l);return(0,n.wipe)(l),D}t.randomUint32=s;const o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function a(f,l=o,D=t.defaultRandomSource){if(l.length<2)throw new Error("randomString charset is too short");if(l.length>256)throw new Error("randomString charset is too long");let b="";const m=l.length,w=256-256%m;for(;f>0;){const N=i(Math.ceil(f*256/w),D);for(let R=0;R<N.length&&f>0;R++){const B=N[R];B<w&&(b+=l.charAt(B%m),f--)}(0,n.wipe)(N)}return b}t.randomString=a;function h(f,l=o,D=t.defaultRandomSource){const b=Math.ceil(f/(Math.log(l.length)/Math.LN2));return a(b,l,D)}t.randomStringForEntropy=h}(lr);var dn={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=re,r=_t;t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var n=function(){function a(){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 a.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},a.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},a.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._temp),this.reset()},a.prototype.update=function(h,f){if(f===void 0&&(f=h.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var l=0;if(this._bytesHashed+=f,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&f>0;)this._buffer[this._bufferLength++]=h[l++],f--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(f>=this.blockSize&&(l=s(this._temp,this._state,h,l,f),f%=this.blockSize);f>0;)this._buffer[this._bufferLength++]=h[l++],f--;return this},a.prototype.finish=function(h){if(!this._finished){var f=this._bytesHashed,l=this._bufferLength,D=f/536870912|0,b=f<<3,m=f%64<56?64:128;this._buffer[l]=128;for(var w=l+1;w<m-8;w++)this._buffer[w]=0;e.writeUint32BE(D,this._buffer,m-8),e.writeUint32BE(b,this._buffer,m-4),s(this._temp,this._state,this._buffer,0,m),this._finished=!0}for(var w=0;w<this.digestLength/4;w++)e.writeUint32BE(this._state[w],h,w*4);return this},a.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},a.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}},a.prototype.restoreState=function(h){return this._state.set(h.state),this._bufferLength=h.bufferLength,h.buffer&&this._buffer.set(h.buffer),this._bytesHashed=h.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(h){r.wipe(h.state),h.buffer&&r.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},a}();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(a,h,f,l,D){for(;D>=64;){for(var b=h[0],m=h[1],w=h[2],N=h[3],R=h[4],B=h[5],S=h[6],I=h[7],y=0;y<16;y++){var x=l+y*4;a[y]=e.readUint32BE(f,x)}for(var y=16;y<64;y++){var E=a[y-2],c=(E>>>17|E<<32-17)^(E>>>19|E<<32-19)^E>>>10;E=a[y-15];var d=(E>>>7|E<<32-7)^(E>>>18|E<<32-18)^E>>>3;a[y]=(c+a[y-7]|0)+(d+a[y-16]|0)}for(var y=0;y<64;y++){var c=(((R>>>6|R<<26)^(R>>>11|R<<21)^(R>>>25|R<<7))+(R&B^~R&S)|0)+(I+(i[y]+a[y]|0)|0)|0,d=((b>>>2|b<<32-2)^(b>>>13|b<<32-13)^(b>>>22|b<<32-22))+(b&m^b&w^m&w)|0;I=S,S=B,B=R,R=N+c|0,N=w,w=m,m=b,b=c+d|0}h[0]+=b,h[1]+=m,h[2]+=w,h[3]+=N,h[4]+=R,h[5]+=B,h[6]+=S,h[7]+=I,l+=64,D-=64}return l}function o(a){var h=new n;h.update(a);var f=h.digest();return h.clean(),f}t.hash=o})(dn);var hi={};(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=lr,r=_t;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(y){const x=new Float64Array(16);if(y)for(let E=0;E<y.length;E++)x[E]=y[E];return x}const i=new Uint8Array(32);i[0]=9;const s=n([56129,1]);function o(y){let x=1;for(let E=0;E<16;E++){let c=y[E]+x+65535;x=Math.floor(c/65536),y[E]=c-x*65536}y[0]+=x-1+37*(x-1)}function a(y,x,E){const c=~(E-1);for(let d=0;d<16;d++){const U=c&(y[d]^x[d]);y[d]^=U,x[d]^=U}}function h(y,x){const E=n(),c=n();for(let d=0;d<16;d++)c[d]=x[d];o(c),o(c),o(c);for(let d=0;d<2;d++){E[0]=c[0]-65517;for(let K=1;K<15;K++)E[K]=c[K]-65535-(E[K-1]>>16&1),E[K-1]&=65535;E[15]=c[15]-32767-(E[14]>>16&1);const U=E[15]>>16&1;E[14]&=65535,a(c,E,1-U)}for(let d=0;d<16;d++)y[2*d]=c[d]&255,y[2*d+1]=c[d]>>8}function f(y,x){for(let E=0;E<16;E++)y[E]=x[2*E]+(x[2*E+1]<<8);y[15]&=32767}function l(y,x,E){for(let c=0;c<16;c++)y[c]=x[c]+E[c]}function D(y,x,E){for(let c=0;c<16;c++)y[c]=x[c]-E[c]}function b(y,x,E){let c,d,U=0,K=0,G=0,J=0,X=0,g=0,v=0,F=0,M=0,P=0,C=0,j=0,z=0,Q=0,q=0,ee=0,Y=0,ae=0,T=0,A=0,O=0,u=0,_=0,H=0,W=0,he=0,ve=0,de=0,me=0,Be=0,$e=0,ye=E[0],pe=E[1],le=E[2],ue=E[3],ce=E[4],oe=E[5],se=E[6],te=E[7],fe=E[8],ge=E[9],ne=E[10],_e=E[11],be=E[12],Ee=E[13],De=E[14],we=E[15];c=x[0],U+=c*ye,K+=c*pe,G+=c*le,J+=c*ue,X+=c*ce,g+=c*oe,v+=c*se,F+=c*te,M+=c*fe,P+=c*ge,C+=c*ne,j+=c*_e,z+=c*be,Q+=c*Ee,q+=c*De,ee+=c*we,c=x[1],K+=c*ye,G+=c*pe,J+=c*le,X+=c*ue,g+=c*ce,v+=c*oe,F+=c*se,M+=c*te,P+=c*fe,C+=c*ge,j+=c*ne,z+=c*_e,Q+=c*be,q+=c*Ee,ee+=c*De,Y+=c*we,c=x[2],G+=c*ye,J+=c*pe,X+=c*le,g+=c*ue,v+=c*ce,F+=c*oe,M+=c*se,P+=c*te,C+=c*fe,j+=c*ge,z+=c*ne,Q+=c*_e,q+=c*be,ee+=c*Ee,Y+=c*De,ae+=c*we,c=x[3],J+=c*ye,X+=c*pe,g+=c*le,v+=c*ue,F+=c*ce,M+=c*oe,P+=c*se,C+=c*te,j+=c*fe,z+=c*ge,Q+=c*ne,q+=c*_e,ee+=c*be,Y+=c*Ee,ae+=c*De,T+=c*we,c=x[4],X+=c*ye,g+=c*pe,v+=c*le,F+=c*ue,M+=c*ce,P+=c*oe,C+=c*se,j+=c*te,z+=c*fe,Q+=c*ge,q+=c*ne,ee+=c*_e,Y+=c*be,ae+=c*Ee,T+=c*De,A+=c*we,c=x[5],g+=c*ye,v+=c*pe,F+=c*le,M+=c*ue,P+=c*ce,C+=c*oe,j+=c*se,z+=c*te,Q+=c*fe,q+=c*ge,ee+=c*ne,Y+=c*_e,ae+=c*be,T+=c*Ee,A+=c*De,O+=c*we,c=x[6],v+=c*ye,F+=c*pe,M+=c*le,P+=c*ue,C+=c*ce,j+=c*oe,z+=c*se,Q+=c*te,q+=c*fe,ee+=c*ge,Y+=c*ne,ae+=c*_e,T+=c*be,A+=c*Ee,O+=c*De,u+=c*we,c=x[7],F+=c*ye,M+=c*pe,P+=c*le,C+=c*ue,j+=c*ce,z+=c*oe,Q+=c*se,q+=c*te,ee+=c*fe,Y+=c*ge,ae+=c*ne,T+=c*_e,A+=c*be,O+=c*Ee,u+=c*De,_+=c*we,c=x[8],M+=c*ye,P+=c*pe,C+=c*le,j+=c*ue,z+=c*ce,Q+=c*oe,q+=c*se,ee+=c*te,Y+=c*fe,ae+=c*ge,T+=c*ne,A+=c*_e,O+=c*be,u+=c*Ee,_+=c*De,H+=c*we,c=x[9],P+=c*ye,C+=c*pe,j+=c*le,z+=c*ue,Q+=c*ce,q+=c*oe,ee+=c*se,Y+=c*te,ae+=c*fe,T+=c*ge,A+=c*ne,O+=c*_e,u+=c*be,_+=c*Ee,H+=c*De,W+=c*we,c=x[10],C+=c*ye,j+=c*pe,z+=c*le,Q+=c*ue,q+=c*ce,ee+=c*oe,Y+=c*se,ae+=c*te,T+=c*fe,A+=c*ge,O+=c*ne,u+=c*_e,_+=c*be,H+=c*Ee,W+=c*De,he+=c*we,c=x[11],j+=c*ye,z+=c*pe,Q+=c*le,q+=c*ue,ee+=c*ce,Y+=c*oe,ae+=c*se,T+=c*te,A+=c*fe,O+=c*ge,u+=c*ne,_+=c*_e,H+=c*be,W+=c*Ee,he+=c*De,ve+=c*we,c=x[12],z+=c*ye,Q+=c*pe,q+=c*le,ee+=c*ue,Y+=c*ce,ae+=c*oe,T+=c*se,A+=c*te,O+=c*fe,u+=c*ge,_+=c*ne,H+=c*_e,W+=c*be,he+=c*Ee,ve+=c*De,de+=c*we,c=x[13],Q+=c*ye,q+=c*pe,ee+=c*le,Y+=c*ue,ae+=c*ce,T+=c*oe,A+=c*se,O+=c*te,u+=c*fe,_+=c*ge,H+=c*ne,W+=c*_e,he+=c*be,ve+=c*Ee,de+=c*De,me+=c*we,c=x[14],q+=c*ye,ee+=c*pe,Y+=c*le,ae+=c*ue,T+=c*ce,A+=c*oe,O+=c*se,u+=c*te,_+=c*fe,H+=c*ge,W+=c*ne,he+=c*_e,ve+=c*be,de+=c*Ee,me+=c*De,Be+=c*we,c=x[15],ee+=c*ye,Y+=c*pe,ae+=c*le,T+=c*ue,A+=c*ce,O+=c*oe,u+=c*se,_+=c*te,H+=c*fe,W+=c*ge,he+=c*ne,ve+=c*_e,de+=c*be,me+=c*Ee,Be+=c*De,$e+=c*we,U+=38*Y,K+=38*ae,G+=38*T,J+=38*A,X+=38*O,g+=38*u,v+=38*_,F+=38*H,M+=38*W,P+=38*he,C+=38*ve,j+=38*de,z+=38*me,Q+=38*Be,q+=38*$e,d=1,c=U+d+65535,d=Math.floor(c/65536),U=c-d*65536,c=K+d+65535,d=Math.floor(c/65536),K=c-d*65536,c=G+d+65535,d=Math.floor(c/65536),G=c-d*65536,c=J+d+65535,d=Math.floor(c/65536),J=c-d*65536,c=X+d+65535,d=Math.floor(c/65536),X=c-d*65536,c=g+d+65535,d=Math.floor(c/65536),g=c-d*65536,c=v+d+65535,d=Math.floor(c/65536),v=c-d*65536,c=F+d+65535,d=Math.floor(c/65536),F=c-d*65536,c=M+d+65535,d=Math.floor(c/65536),M=c-d*65536,c=P+d+65535,d=Math.floor(c/65536),P=c-d*65536,c=C+d+65535,d=Math.floor(c/65536),C=c-d*65536,c=j+d+65535,d=Math.floor(c/65536),j=c-d*65536,c=z+d+65535,d=Math.floor(c/65536),z=c-d*65536,c=Q+d+65535,d=Math.floor(c/65536),Q=c-d*65536,c=q+d+65535,d=Math.floor(c/65536),q=c-d*65536,c=ee+d+65535,d=Math.floor(c/65536),ee=c-d*65536,U+=d-1+37*(d-1),d=1,c=U+d+65535,d=Math.floor(c/65536),U=c-d*65536,c=K+d+65535,d=Math.floor(c/65536),K=c-d*65536,c=G+d+65535,d=Math.floor(c/65536),G=c-d*65536,c=J+d+65535,d=Math.floor(c/65536),J=c-d*65536,c=X+d+65535,d=Math.floor(c/65536),X=c-d*65536,c=g+d+65535,d=Math.floor(c/65536),g=c-d*65536,c=v+d+65535,d=Math.floor(c/65536),v=c-d*65536,c=F+d+65535,d=Math.floor(c/65536),F=c-d*65536,c=M+d+65535,d=Math.floor(c/65536),M=c-d*65536,c=P+d+65535,d=Math.floor(c/65536),P=c-d*65536,c=C+d+65535,d=Math.floor(c/65536),C=c-d*65536,c=j+d+65535,d=Math.floor(c/65536),j=c-d*65536,c=z+d+65535,d=Math.floor(c/65536),z=c-d*65536,c=Q+d+65535,d=Math.floor(c/65536),Q=c-d*65536,c=q+d+65535,d=Math.floor(c/65536),q=c-d*65536,c=ee+d+65535,d=Math.floor(c/65536),ee=c-d*65536,U+=d-1+37*(d-1),y[0]=U,y[1]=K,y[2]=G,y[3]=J,y[4]=X,y[5]=g,y[6]=v,y[7]=F,y[8]=M,y[9]=P,y[10]=C,y[11]=j,y[12]=z,y[13]=Q,y[14]=q,y[15]=ee}function m(y,x){b(y,x,x)}function w(y,x){const E=n();for(let c=0;c<16;c++)E[c]=x[c];for(let c=253;c>=0;c--)m(E,E),c!==2&&c!==4&&b(E,E,x);for(let c=0;c<16;c++)y[c]=E[c]}function N(y,x){const E=new Uint8Array(32),c=new Float64Array(80),d=n(),U=n(),K=n(),G=n(),J=n(),X=n();for(let M=0;M<31;M++)E[M]=y[M];E[31]=y[31]&127|64,E[0]&=248,f(c,x);for(let M=0;M<16;M++)U[M]=c[M];d[0]=G[0]=1;for(let M=254;M>=0;--M){const P=E[M>>>3]>>>(M&7)&1;a(d,U,P),a(K,G,P),l(J,d,K),D(d,d,K),l(K,U,G),D(U,U,G),m(G,J),m(X,d),b(d,K,d),b(K,U,J),l(J,d,K),D(d,d,K),m(U,d),D(K,G,X),b(d,K,s),l(d,d,G),b(K,K,d),b(d,G,X),b(G,U,c),m(U,J),a(d,U,P),a(K,G,P)}for(let M=0;M<16;M++)c[M+16]=d[M],c[M+32]=K[M],c[M+48]=U[M],c[M+64]=G[M];const g=c.subarray(32),v=c.subarray(16);w(g,g),b(v,v,g);const F=new Uint8Array(32);return h(F,v),F}t.scalarMult=N;function R(y){return N(y,i)}t.scalarMultBase=R;function B(y){if(y.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const x=new Uint8Array(y);return{publicKey:R(x),secretKey:x}}t.generateKeyPairFromSeed=B;function S(y){const x=(0,e.randomBytes)(32,y),E=B(x);return(0,r.wipe)(x),E}t.generateKeyPair=S;function I(y,x,E=!1){if(y.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(x.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const c=N(y,x);if(E){let d=0;for(let U=0;U<c.length;U++)d|=c[U];if(d===0)throw new Error("X25519: invalid shared key")}return c}t.sharedKey=I})(hi);function ro(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function li(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));const r=ro(e);let n=0;for(const i of t)r.set(i,n),n+=i.length;return r}function Eh(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),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=i}var a=t.length,h=t.charAt(0),f=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function D(w){if(w instanceof Uint8Array||(ArrayBuffer.isView(w)?w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):Array.isArray(w)&&(w=Uint8Array.from(w))),!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(w.length===0)return"";for(var N=0,R=0,B=0,S=w.length;B!==S&&w[B]===0;)B++,N++;for(var I=(S-B)*l+1>>>0,y=new Uint8Array(I);B!==S;){for(var x=w[B],E=0,c=I-1;(x!==0||E<R)&&c!==-1;c--,E++)x+=256*y[c]>>>0,y[c]=x%a>>>0,x=x/a>>>0;if(x!==0)throw new Error("Non-zero carry");R=E,B++}for(var d=I-R;d!==I&&y[d]===0;)d++;for(var U=h.repeat(N);d<I;++d)U+=t.charAt(y[d]);return U}function b(w){if(typeof w!="string")throw new TypeError("Expected String");if(w.length===0)return new Uint8Array;var N=0;if(w[N]!==" "){for(var R=0,B=0;w[N]===h;)R++,N++;for(var S=(w.length-N)*f+1>>>0,I=new Uint8Array(S);w[N];){var y=r[w.charCodeAt(N)];if(y===255)return;for(var x=0,E=S-1;(y!==0||x<B)&&E!==-1;E--,x++)y+=a*I[E]>>>0,I[E]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");B=x,N++}if(w[N]!==" "){for(var c=S-B;c!==S&&I[c]===0;)c++;for(var d=new Uint8Array(R+(S-c)),U=R;c!==S;)d[U++]=I[c++];return d}}}function m(w){var N=b(w);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:D,decodeUnsafe:b,decode:m}}var Dh=Eh,xh=Dh;const no=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")},Sh=t=>new TextEncoder().encode(t),Oh=t=>new TextDecoder().decode(t);class Lh{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 Ih{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 io(this,e)}}class Ah{constructor(e){this.decoders=e}or(e){return io(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 io=(t,e)=>new Ah({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class Th{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Lh(e,r,n),this.decoder=new Ih(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const pn=({name:t,prefix:e,encode:r,decode:n})=>new Th(t,e,r,n),Tr=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=xh(r,e);return pn({prefix:t,name:e,encode:n,decode:s=>no(i(s))})},Ch=(t,e,r,n)=>{const i={};for(let l=0;l<e.length;++l)i[e[l]]=l;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let a=0,h=0,f=0;for(let l=0;l<s;++l){const D=i[t[l]];if(D===void 0)throw new SyntaxError(`Non-${n} character`);h=h<<r|D,a+=r,a>=8&&(a-=8,o[f++]=255&h>>a)}if(a>=r||255&h<<8-a)throw new SyntaxError("Unexpected end of data");return o},Rh=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let s="",o=0,a=0;for(let h=0;h<t.length;++h)for(a=a<<8|t[h],o+=8;o>r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s},it=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>pn({prefix:e,name:t,encode(i){return Rh(i,n,r)},decode(i){return Ch(i,n,r,t)}}),Ph=pn({prefix:"\0",name:"identity",encode:t=>Oh(t),decode:t=>Sh(t)});var Nh=Object.freeze({__proto__:null,identity:Ph});const $h=it({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Fh=Object.freeze({__proto__:null,base2:$h});const Mh=it({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Uh=Object.freeze({__proto__:null,base8:Mh});const jh=Tr({prefix:"9",name:"base10",alphabet:"0123456789"});var Bh=Object.freeze({__proto__:null,base10:jh});const zh=it({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Kh=it({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var qh=Object.freeze({__proto__:null,base16:zh,base16upper:Kh});const Hh=it({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Vh=it({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Gh=it({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Wh=it({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),kh=it({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Yh=it({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Jh=it({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Xh=it({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Zh=it({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Qh=Object.freeze({__proto__:null,base32:Hh,base32upper:Vh,base32pad:Gh,base32padupper:Wh,base32hex:kh,base32hexupper:Yh,base32hexpad:Jh,base32hexpadupper:Xh,base32z:Zh});const el=Tr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),tl=Tr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var rl=Object.freeze({__proto__:null,base36:el,base36upper:tl});const nl=Tr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),il=Tr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var sl=Object.freeze({__proto__:null,base58btc:nl,base58flickr:il});const ol=it({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),al=it({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),cl=it({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ul=it({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var fl=Object.freeze({__proto__:null,base64:ol,base64pad:al,base64url:cl,base64urlpad:ul});const so=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}"),hl=so.reduce((t,e,r)=>(t[r]=e,t),[]),ll=so.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function dl(t){return t.reduce((e,r)=>(e+=hl[r],e),"")}function pl(t){const e=[];for(const r of t){const n=ll[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const gl=pn({prefix:"\u{1F680}",name:"base256emoji",encode:dl,decode:pl});var yl=Object.freeze({__proto__:null,base256emoji:gl}),vl=ao,oo=128,_l=127,bl=~_l,ml=Math.pow(2,31);function ao(t,e,r){e=e||[],r=r||0;for(var n=r;t>=ml;)e[r++]=t&255|oo,t/=128;for(;t&bl;)e[r++]=t&255|oo,t>>>=7;return e[r]=t|0,ao.bytes=r-n+1,e}var wl=di,El=128,co=127;function di(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw di.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&co)<<i:(o&co)*Math.pow(2,i),i+=7}while(o>=El);return di.bytes=s-n,r}var Dl=Math.pow(2,7),xl=Math.pow(2,14),Sl=Math.pow(2,21),Ol=Math.pow(2,28),Ll=Math.pow(2,35),Il=Math.pow(2,42),Al=Math.pow(2,49),Tl=Math.pow(2,56),Cl=Math.pow(2,63),Rl=function(t){return t<Dl?1:t<xl?2:t<Sl?3:t<Ol?4:t<Ll?5:t<Il?6:t<Al?7:t<Tl?8:t<Cl?9:10},Pl={encode:vl,decode:wl,encodingLength:Rl},uo=Pl;const fo=(t,e,r=0)=>(uo.encode(t,e,r),e),ho=t=>uo.encodingLength(t),pi=(t,e)=>{const r=e.byteLength,n=ho(t),i=n+ho(r),s=new Uint8Array(i+r);return fo(t,s,0),fo(r,s,n),s.set(e,i),new Nl(t,r,e,s)};class Nl{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const lo=({name:t,code:e,encode:r})=>new $l(t,e,r);class $l{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?pi(this.code,r):r.then(n=>pi(this.code,n))}else throw Error("Unknown type, must be binary type")}}const po=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Fl=lo({name:"sha2-256",code:18,encode:po("SHA-256")}),Ml=lo({name:"sha2-512",code:19,encode:po("SHA-512")});var Ul=Object.freeze({__proto__:null,sha256:Fl,sha512:Ml});const go=0,jl="identity",yo=no;var Bl=Object.freeze({__proto__:null,identity:{code:go,name:jl,encode:yo,digest:t=>pi(go,yo(t))}});new TextEncoder,new TextDecoder;const vo={...Nh,...Fh,...Uh,...Bh,...qh,...Qh,...rl,...sl,...fl,...yl};({...Ul,...Bl});function _o(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const bo=_o("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),gi=_o("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=ro(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),mo={utf8:bo,"utf-8":bo,hex:vo.base16,latin1:gi,ascii:gi,binary:gi,...vo};function lt(t,e="utf8"){const r=mo[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,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}function dt(t,e="utf8"){const r=mo[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)}var wo=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))},zl=function(){function t(e,r,n){this.name=e,this.version=r,this.os=n,this.type="browser"}return t}(),Kl=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),ql=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}(),Hl=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),Vl=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),Gl=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Wl=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Eo=3,kl=[["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",Gl]],Do=[["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 Yl(t){return t?xo(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Vl:typeof navigator<"u"?xo(navigator.userAgent):Zl()}function Jl(t){return t!==""&&kl.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 xo(t){var e=Jl(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new Hl;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<Eo&&(i=wo(wo([],i,!0),Ql(Eo-i.length),!0)):i=[];var s=i.join("."),o=Xl(t),a=Wl.exec(t);return a&&a[1]?new ql(r,s,o,a[1]):new zl(r,s,o)}function Xl(t){for(var e=0,r=Do.length;e<r;e++){var n=Do[e],i=n[0],s=n[1],o=s.exec(t);if(o)return i}return null}function Zl(){var t=typeof process<"u"&&process.version;return t?new Kl(process.version.slice(1)):null}function Ql(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}var Z={};/*! *****************************************************************************
|
|
15
15
|
Copyright (c) Microsoft Corporation.
|
|
16
16
|
|
|
17
17
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
25
25
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
26
26
|
PERFORMANCE OF THIS SOFTWARE.
|
|
27
|
-
***************************************************************************** */var fi=function(t,e){return fi=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])},fi(t,e)};function Ml(t,e){fi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var hi=function(){return hi=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},hi.apply(this,arguments)};function Ul(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 jl(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function Bl(t,e){return function(r,n){e(r,n,t)}}function zl(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Kl(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{f(n.next(l))}catch(D){o(D)}}function h(l){try{f(n.throw(l))}catch(D){o(D)}}function f(l){l.done?s(l.value):i(l.value).then(a,h)}f((n=n.apply(t,e||[])).next())})}function Hl(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(f){return function(l){return h([f,l])}}function h(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=f[0]&2?i.return:f[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,f[1])).done)return s;switch(i=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){r.label=f[1];break}if(f[0]===6&&r.label<s[1]){r.label=s[1],s=f;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(f);break}s[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(l){f=[6,l],i=0}finally{n=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function ql(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Vl(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function li(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 _o(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Gl(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(_o(arguments[e]));return t}function Wl(){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],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Tr(t){return this instanceof Tr?(this.v=t,this):new Tr(t)}function kl(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(E){n[E]&&(i[E]=function(m){return new Promise(function(b,P){s.push([E,m,b,P])>1||a(E,m)})})}function a(E,m){try{h(n[E](m))}catch(b){D(s[0][3],b)}}function h(E){E.value instanceof Tr?Promise.resolve(E.value.v).then(f,l):D(s[0][2],E)}function f(E){a("next",E)}function l(E){a("throw",E)}function D(E,m){E(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Yl(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(o){return(r=!r)?{value:Tr(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function Jl(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 li=="function"?li(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(o){return new Promise(function(a,h){o=t[s](o),i(a,h,o.done,o.value)})}}function i(s,o,a,h){Promise.resolve(h).then(function(f){s({value:f,done:a})},o)}}function Xl(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Zl(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 Ql(t){return t&&t.__esModule?t:{default:t}}function ed(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function td(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 rd=Object.freeze({__proto__:null,__extends:Ml,get __assign(){return hi},__rest:Ul,__decorate:jl,__param:Bl,__metadata:zl,__awaiter:Kl,__generator:Hl,__createBinding:ql,__exportStar:Vl,__values:li,__read:_o,__spread:Gl,__spreadArrays:Wl,__await:Tr,__asyncGenerator:kl,__asyncDelegator:Yl,__asyncValues:Jl,__makeTemplateObject:Xl,__importStar:Zl,__importDefault:Ql,__classPrivateFieldGet:ed,__classPrivateFieldSet:td}),pn=Jt(rd),di={},Cr={},vo;function nd(){if(vo)return Cr;vo=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Cr.delay=t,Cr}var Xt={},pi={},Zt={},bo;function id(){return bo||(bo=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.ONE_THOUSAND=Zt.ONE_HUNDRED=void 0,Zt.ONE_HUNDRED=100,Zt.ONE_THOUSAND=1e3),Zt}var gi={},mo;function sd(){return mo||(mo=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}(gi)),gi}var wo;function Eo(){return wo||(wo=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=pn;e.__exportStar(id(),t),e.__exportStar(sd(),t)}(pi)),pi}var Do;function od(){if(Do)return Xt;Do=1,Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.fromMiliseconds=Xt.toMiliseconds=void 0;const t=Eo();function e(n){return n*t.ONE_THOUSAND}Xt.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return Xt.fromMiliseconds=r,Xt}var xo;function ad(){return xo||(xo=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=pn;e.__exportStar(nd(),t),e.__exportStar(od(),t)}(di)),di}var hr={},So;function cd(){if(So)return hr;So=1,Object.defineProperty(hr,"__esModule",{value:!0}),hr.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 hr.Watch=t,hr.default=t,hr}var yi={},Rr={},Oo;function ud(){if(Oo)return Rr;Oo=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.IWatch=void 0;class t{}return Rr.IWatch=t,Rr}var Io;function fd(){return Io||(Io=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),pn.__exportStar(ud(),t)}(yi)),yi}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=pn;e.__exportStar(ad(),t),e.__exportStar(cd(),t),e.__exportStar(fd(),t),e.__exportStar(Eo(),t)})(Z);var Te={};Object.defineProperty(Te,"__esModule",{value:!0}),Te.getLocalStorage=Te.getLocalStorageOrThrow=Te.getCrypto=Te.getCryptoOrThrow=Ao=Te.getLocation=Te.getLocationOrThrow=_i=Te.getNavigator=Te.getNavigatorOrThrow=Lo=Te.getDocument=Te.getDocumentOrThrow=Te.getFromWindowOrThrow=Te.getFromWindow=void 0;function Qt(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Te.getFromWindow=Qt;function lr(t){const e=Qt(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Te.getFromWindowOrThrow=lr;function hd(){return lr("document")}Te.getDocumentOrThrow=hd;function ld(){return Qt("document")}var Lo=Te.getDocument=ld;function dd(){return lr("navigator")}Te.getNavigatorOrThrow=dd;function pd(){return Qt("navigator")}var _i=Te.getNavigator=pd;function gd(){return lr("location")}Te.getLocationOrThrow=gd;function yd(){return Qt("location")}var Ao=Te.getLocation=yd;function _d(){return lr("crypto")}Te.getCryptoOrThrow=_d;function vd(){return Qt("crypto")}Te.getCrypto=vd;function bd(){return lr("localStorage")}Te.getLocalStorageOrThrow=bd;function md(){return Qt("localStorage")}Te.getLocalStorage=md;var vi={};Object.defineProperty(vi,"__esModule",{value:!0});var To=vi.getWindowMetadata=void 0;const Co=Te;function wd(){let t,e;try{t=Co.getDocumentOrThrow(),e=Co.getLocationOrThrow()}catch{return null}function r(){const D=t.getElementsByTagName("link"),E=[];for(let m=0;m<D.length;m++){const b=D[m],P=b.getAttribute("rel");if(P&&P.toLowerCase().indexOf("icon")>-1){const R=b.getAttribute("href");if(R)if(R.toLowerCase().indexOf("https:")===-1&&R.toLowerCase().indexOf("http:")===-1&&R.indexOf("//")!==0){let B=e.protocol+"//"+e.host;if(R.indexOf("/")===0)B+=R;else{const S=e.pathname.split("/");S.pop();const L=S.join("/");B+=L+"/"+R}E.push(B)}else if(R.indexOf("//")===0){const B=e.protocol+R;E.push(B)}else E.push(R)}}return E}function n(...D){const E=t.getElementsByTagName("meta");for(let m=0;m<E.length;m++){const b=E[m],P=["itemprop","property","name"].map(R=>b.getAttribute(R)).filter(R=>R?D.includes(R):!1);if(P.length&&P){const R=b.getAttribute("content");if(R)return R}}return""}function i(){let D=n("name","og:site_name","og:title","twitter:title");return D||(D=t.title),D}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),h=e.origin,f=r();return{description:a,url:h,icons:f,name:o}}To=vi.getWindowMetadata=wd;var Nr={},Ed=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Ro="%[a-f0-9]{2}",No=new RegExp(Ro,"gi"),Po=new RegExp("("+Ro+")+","gi");function bi(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([],bi(r),bi(n))}function Dd(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(No),r=1;r<e.length;r++)t=bi(e,r).join(""),e=t.match(No);return t}}function xd(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=Po.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var n=Dd(r[0]);n!==r[0]&&(e[r[0]]=n)}r=Po.exec(t)}e["%C2"]="\uFFFD";for(var i=Object.keys(e),s=0;s<i.length;s++){var o=i[s];t=t.replace(new RegExp(o,"g"),e[o])}return t}var Sd=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 xd(t)}},Od=(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)]},Id=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s<n.length;s++){var o=n[s],a=t[o];(i?e.indexOf(o)!==-1:e(o,a,t))&&(r[o]=a)}return r};(function(t){const e=Ed,r=Sd,n=Od,i=Id,s=S=>S==null,o=Symbol("encodeFragmentIdentifier");function a(S){switch(S.arrayFormat){case"index":return L=>(y,x)=>{const w=y.length;return x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,[l(L,S),"[",w,"]"].join("")]:[...y,[l(L,S),"[",l(w,S),"]=",l(x,S)].join("")]};case"bracket":return L=>(y,x)=>x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,[l(L,S),"[]"].join("")]:[...y,[l(L,S),"[]=",l(x,S)].join("")];case"colon-list-separator":return L=>(y,x)=>x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,[l(L,S),":list="].join("")]:[...y,[l(L,S),":list=",l(x,S)].join("")];case"comma":case"separator":case"bracket-separator":{const L=S.arrayFormat==="bracket-separator"?"[]=":"=";return y=>(x,w)=>w===void 0||S.skipNull&&w===null||S.skipEmptyString&&w===""?x:(w=w===null?"":w,x.length===0?[[l(y,S),L,l(w,S)].join("")]:[[x,l(w,S)].join(S.arrayFormatSeparator)])}default:return L=>(y,x)=>x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,l(L,S)]:[...y,[l(L,S),"=",l(x,S)].join("")]}}function h(S){let L;switch(S.arrayFormat){case"index":return(y,x,w)=>{if(L=/\[(\d*)\]$/.exec(y),y=y.replace(/\[\d*\]$/,""),!L){w[y]=x;return}w[y]===void 0&&(w[y]={}),w[y][L[1]]=x};case"bracket":return(y,x,w)=>{if(L=/(\[\])$/.exec(y),y=y.replace(/\[\]$/,""),!L){w[y]=x;return}if(w[y]===void 0){w[y]=[x];return}w[y]=[].concat(w[y],x)};case"colon-list-separator":return(y,x,w)=>{if(L=/(:list)$/.exec(y),y=y.replace(/:list$/,""),!L){w[y]=x;return}if(w[y]===void 0){w[y]=[x];return}w[y]=[].concat(w[y],x)};case"comma":case"separator":return(y,x,w)=>{const c=typeof x=="string"&&x.includes(S.arrayFormatSeparator),d=typeof x=="string"&&!c&&D(x,S).includes(S.arrayFormatSeparator);x=d?D(x,S):x;const U=c||d?x.split(S.arrayFormatSeparator).map(K=>D(K,S)):x===null?x:D(x,S);w[y]=U};case"bracket-separator":return(y,x,w)=>{const c=/(\[\])$/.test(y);if(y=y.replace(/\[\]$/,""),!c){w[y]=x&&D(x,S);return}const d=x===null?[]:x.split(S.arrayFormatSeparator).map(U=>D(U,S));if(w[y]===void 0){w[y]=d;return}w[y]=[].concat(w[y],d)};default:return(y,x,w)=>{if(w[y]===void 0){w[y]=x;return}w[y]=[].concat(w[y],x)}}}function f(S){if(typeof S!="string"||S.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function l(S,L){return L.encode?L.strict?e(S):encodeURIComponent(S):S}function D(S,L){return L.decode?r(S):S}function E(S){return Array.isArray(S)?S.sort():typeof S=="object"?E(Object.keys(S)).sort((L,y)=>Number(L)-Number(y)).map(L=>S[L]):S}function m(S){const L=S.indexOf("#");return L!==-1&&(S=S.slice(0,L)),S}function b(S){let L="";const y=S.indexOf("#");return y!==-1&&(L=S.slice(y)),L}function P(S){S=m(S);const L=S.indexOf("?");return L===-1?"":S.slice(L+1)}function R(S,L){return L.parseNumbers&&!Number.isNaN(Number(S))&&typeof S=="string"&&S.trim()!==""?S=Number(S):L.parseBooleans&&S!==null&&(S.toLowerCase()==="true"||S.toLowerCase()==="false")&&(S=S.toLowerCase()==="true"),S}function B(S,L){L=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},L),f(L.arrayFormatSeparator);const y=h(L),x=Object.create(null);if(typeof S!="string"||(S=S.trim().replace(/^[?#&]/,""),!S))return x;for(const w of S.split("&")){if(w==="")continue;let[c,d]=n(L.decode?w.replace(/\+/g," "):w,"=");d=d===void 0?null:["comma","separator","bracket-separator"].includes(L.arrayFormat)?d:D(d,L),y(D(c,L),d,x)}for(const w of Object.keys(x)){const c=x[w];if(typeof c=="object"&&c!==null)for(const d of Object.keys(c))c[d]=R(c[d],L);else x[w]=R(c,L)}return L.sort===!1?x:(L.sort===!0?Object.keys(x).sort():Object.keys(x).sort(L.sort)).reduce((w,c)=>{const d=x[c];return Boolean(d)&&typeof d=="object"&&!Array.isArray(d)?w[c]=E(d):w[c]=d,w},Object.create(null))}t.extract=P,t.parse=B,t.stringify=(S,L)=>{if(!S)return"";L=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},L),f(L.arrayFormatSeparator);const y=d=>L.skipNull&&s(S[d])||L.skipEmptyString&&S[d]==="",x=a(L),w={};for(const d of Object.keys(S))y(d)||(w[d]=S[d]);const c=Object.keys(w);return L.sort!==!1&&c.sort(L.sort),c.map(d=>{const U=S[d];return U===void 0?"":U===null?l(d,L):Array.isArray(U)?U.length===0&&L.arrayFormat==="bracket-separator"?l(d,L)+"[]":U.reduce(x(d),[]).join("&"):l(d,L)+"="+l(U,L)}).filter(d=>d.length>0).join("&")},t.parseUrl=(S,L)=>{L=Object.assign({decode:!0},L);const[y,x]=n(S,"#");return Object.assign({url:y.split("?")[0]||"",query:B(P(S),L)},L&&L.parseFragmentIdentifier&&x?{fragmentIdentifier:D(x,L)}:{})},t.stringifyUrl=(S,L)=>{L=Object.assign({encode:!0,strict:!0,[o]:!0},L);const y=m(S.url).split("?")[0]||"",x=t.extract(S.url),w=t.parse(x,{sort:!1}),c=Object.assign(w,S.query);let d=t.stringify(c,L);d&&(d=`?${d}`);let U=b(S.url);return S.fragmentIdentifier&&(U=`#${L[o]?l(S.fragmentIdentifier,L):S.fragmentIdentifier}`),`${y}${d}${U}`},t.pick=(S,L,y)=>{y=Object.assign({parseFragmentIdentifier:!0,[o]:!1},y);const{url:x,query:w,fragmentIdentifier:c}=t.parseUrl(S,y);return t.stringifyUrl({url:x,query:i(w,L),fragmentIdentifier:c},y)},t.exclude=(S,L,y)=>{const x=Array.isArray(L)?w=>!L.includes(w):(w,c)=>!L(w,c);return t.pick(S,x,y)}})(Nr);const Ld={waku:{publish:"waku_publish",subscribe:"waku_subscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe"},irn:{publish:"irn_publish",subscribe:"irn_subscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe"},iridium:{publish:"iridium_publish",subscribe:"iridium_subscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe"}},Fo=":";function Ad(t){const{namespace:e,reference:r}=t;return[e,r].join(Fo)}function Td(t){const[e,r,n]=t.split(Fo);return{namespace:e,reference:r,address:n}}function Cd(t,e){const r=[];return t.forEach(n=>{const i=e(n);r.includes(i)||r.push(i)}),r}function Rd(t){const{namespace:e,reference:r}=Td(t);return Ad({namespace:e,reference:r})}function Nd(t){return Cd(t,Rd)}function mi(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 wi(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...Nd(i.accounts))}),r}function Pd(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...i.chains)}),r}const $o="base10",dt="base16",Ei="base64pad",Di="utf8",Mo=0,er=1,Fd=0,Uo=1,xi=12,Si=32;function $d(){const t=si.generateKeyPair();return{privateKey:lt(t.secretKey,dt),publicKey:lt(t.publicKey,dt)}}function Oi(){const t=fr.randomBytes(Si);return lt(t,dt)}function Md(t,e){const r=si.sharedKey(ht(t,dt),ht(e,dt)),n=new kf(ln.SHA256,r).expand(Si);return lt(n,dt)}function Ud(t){const e=ln.hash(ht(t,dt));return lt(e,dt)}function gn(t){const e=ln.hash(ht(t,Di));return lt(e,dt)}function jd(t){return ht(`${t}`,$o)}function Pr(t){return Number(lt(t,$o))}function Bd(t){const e=jd(typeof t.type<"u"?t.type:Mo);if(Pr(e)===er&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?ht(t.senderPublicKey,dt):void 0,n=typeof t.iv<"u"?ht(t.iv,dt):fr.randomBytes(xi),i=new Zn.ChaCha20Poly1305(ht(t.symKey,dt)).seal(n,ht(t.message,Di));return Kd({type:e,sealed:i,iv:n,senderPublicKey:r})}function zd(t){const e=new Zn.ChaCha20Poly1305(ht(t.symKey,dt)),{sealed:r,iv:n}=Ii(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return lt(i,Di)}function Kd(t){if(Pr(t.type)===er){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return lt(oi([t.type,t.senderPublicKey,t.iv,t.sealed]),Ei)}return lt(oi([t.type,t.iv,t.sealed]),Ei)}function Ii(t){const e=ht(t,Ei),r=e.slice(Fd,Uo),n=Uo;if(Pr(r)===er){const a=n+Si,h=a+xi,f=e.slice(n,a),l=e.slice(a,h),D=e.slice(h);return{type:r,sealed:D,iv:l,senderPublicKey:f}}const i=n+xi,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function Hd(t,e){const r=Ii(t);return jo({type:Pr(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?lt(r.senderPublicKey,dt):void 0,receiverPublicKey:e?.receiverPublicKey})}function jo(t){const e=t?.type||Mo;if(e===er){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 Bo(t){return t.type===er&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var qd=Object.defineProperty,zo=Object.getOwnPropertySymbols,Vd=Object.prototype.hasOwnProperty,Gd=Object.prototype.propertyIsEnumerable,Ko=(t,e,r)=>e in t?qd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ho=(t,e)=>{for(var r in e||(e={}))Vd.call(e,r)&&Ko(t,r,e[r]);if(zo)for(var r of zo(e))Gd.call(e,r)&&Ko(t,r,e[r]);return t};const Wd="ReactNative",Fr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},kd="js";function qo(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Yd(){return!Lo()&&!!_i()&&navigator.product===Wd}function Jd(){return!qo()&&!!_i()}function Xd(){return Yd()?Fr.reactNative:qo()?Fr.node:Jd()?Fr.browser:Fr.unknown}function Zd(t,e){let r=Nr.parse(t);return r=Ho(Ho({},r),e),t=Nr.stringify(r),t}function Qd(){return To()||{name:"",description:"",url:"",icons:[""]}}function ep(){const t=Rl();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 tp(){var t;const e=Xd();return e===Fr.browser?[e,((t=Ao())==null?void 0:t.host)||"unknown"].join(":"):e}function rp(t,e,r){const n=ep(),i=tp();return[[t,e].join("-"),[kd,r].join("-"),n,i].join("/")}function np({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s}){const o=r.split("?"),a=rp(t,e,n),h={auth:i,ua:a,projectId:s},f=Zd(o[1]||"",h);return o[0]+"?"+f}function pt(t,e){return t.filter(r=>e.includes(r)).length===t.length}function Vo(t){return Object.fromEntries(t.entries())}function Go(t){return new Map(Object.entries(t))}function Mt(t,e){return Z.fromMiliseconds((e||Date.now())+Z.toMiliseconds(t))}function Ht(t){return Z.fromMiliseconds(Date.now())>=Z.toMiliseconds(t)}function tr(){const t=Z.toMiliseconds(Z.FIVE_MINUTES);let e,r,n;return{resolve:i=>{n&&e&&(clearTimeout(n),e(i))},reject:i=>{n&&r&&(clearTimeout(n),r(i))},done:()=>new Promise((i,s)=>{n=setTimeout(s,t),e=i,r=s})}}function Wo(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 ip(t){return Wo("topic",t)}function sp(t){return Wo("id",t)}function ko(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 Ue(t,e){return`${t}${e?`:${e}`:""}`}const op="irn";function Li(t){return t?.relay||{protocol:op}}function Ai(t){const e=Ld[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var ap=Object.defineProperty,Yo=Object.getOwnPropertySymbols,cp=Object.prototype.hasOwnProperty,up=Object.prototype.propertyIsEnumerable,Jo=(t,e,r)=>e in t?ap(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fp=(t,e)=>{for(var r in e||(e={}))cp.call(e,r)&&Jo(t,r,e[r]);if(Yo)for(var r of Yo(e))up.call(e,r)&&Jo(t,r,e[r]);return t};function hp(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function lp(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):"",o=Nr.parse(s);return{protocol:n,topic:i[0],version:parseInt(i[1],10),symKey:o.symKey,relay:hp(o)}}function dp(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 pp(t){return`${t.protocol}:${t.topic}@${t.version}?`+Nr.stringify(fp({symKey:t.symKey},dp(t.relay)))}function Lt(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function gp(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Lt(r.accounts)),r.extension&&r.extension.forEach(n=>{e.push(...Lt(n.accounts))})}),e}function yp(t,e){const r=[];return Object.values(t).forEach(n=>{Lt(n.accounts).includes(e)&&r.push(...n.methods),n.extension&&n.extension.forEach(i=>{Lt(i.accounts).includes(e)&&r.push(...i.methods)})}),r}function _p(t,e){const r=[];return Object.values(t).forEach(n=>{Lt(n.accounts).includes(e)&&r.push(...n.events),n.extension&&n.extension.forEach(i=>{Lt(i.accounts).includes(e)&&r.push(...i.events)})}),r}const vp={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}},bp={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 V(t,e){const{message:r,code:n}=bp[t];return{message:e?`${r} ${e}`:r,code:n}}function Ve(t,e){const{message:r,code:n}=vp[t];return{message:e?`${r} ${e}`:r,code:n}}function $r(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function Xo(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bt(t){return typeof t>"u"}function it(t,e){return e&&bt(t)?!0:typeof t=="string"&&Boolean(t.trim().length)}function Zo(t,e){return e&&bt(t)?!0:typeof t=="number"&&!isNaN(t)}function mp(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return pt(i,n)?(n.forEach(o=>{const{accounts:a,methods:h,events:f,extension:l}=t.namespaces[o],D=Lt(a),E=r[o];(!pt(E.chains,D)||!pt(E.methods,h)||!pt(E.events,f))&&(s=!1),s&&l&&l.forEach(m=>{var b;const{accounts:P,methods:R,events:B}=m,S=Lt(P);(b=E.extension)!=null&&b.find(L=>pt(L.chains,S)&&pt(L.methods,R)&&pt(L.events,B))||(s=!1)})}),s):!1}function Ti(t){return it(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function wp(t){if(it(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Ti(r)}}return!1}function Ep(t){if(it(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function Dp(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function xp(t){return t?.topic}function Sp(t,e){let r=null;return it(t?.publicKey,!1)||(r=V("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function Ci(t,e){let r=null;return bt(t?.extension)||(!$r(t.extension)||!t.extension.length)&&(r=V("MISSING_OR_INVALID",`${e} extension should be an array of namespaces, or omitted`)),r}function Qo(t){let e=!0;return $r(t)?t.length&&(e=t.every(r=>it(r,!1))):e=!1,e}function ea(t,e,r){let n=null;return $r(e)?e.forEach(i=>{n||(!Ti(i)||!i.includes(t))&&(n=Ve("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):n=Ve("UNSUPPORTED_CHAINS",`${r}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),n}function Op(t,e){let r=null;return Object.entries(t).forEach(([n,i])=>{if(r)return;const s=ea(n,i?.chains,`${e} requiredNamespace`),o=Ci(i,e);s?r=s:o?r=o:i.extension&&i.extension.forEach(a=>{if(r)return;const h=ea(n,a.chains,`${e} extension`);h&&(r=h)})}),r}function ta(t,e){let r=null;return $r(t)?t.forEach(n=>{r||wp(n)||(r=Ve("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Ve("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function Ip(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=ta(n?.accounts,`${e} namespace`),s=Ci(n,e);i?r=i:s?r=s:n.extension&&n.extension.forEach(o=>{if(r)return;const a=ta(o.accounts,`${e} extension`);a&&(r=a)})}),r}function ra(t,e){let r=null;return Qo(t?.methods)?Qo(t?.events)||(r=Ve("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Ve("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function na(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=ra(n,`${e}, namespace`),s=Ci(n,e);i?r=i:s?r=s:n.extension&&n.extension.forEach(o=>{if(r)return;const a=ra(o,`${e}, extension`);a&&(r=a)})}),r}function Lp(t,e){let r=null;if(t&&Xo(t)){const n=na(t,e);n&&(r=n);const i=Op(t,e);i&&(r=i)}else r=V("MISSING_OR_INVALID",`${e}, requiredNamespaces should be an object with data`);return r}function Ri(t,e){let r=null;if(t&&Xo(t)){const n=na(t,e);n&&(r=n);const i=Ip(t,e);i&&(r=i)}else r=V("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function ia(t){return it(t.protocol,!0)}function Ap(t,e){let r=!1;return e&&!t?r=!0:t&&$r(t)&&t.length&&t.forEach(n=>{r=ia(n)}),r}function Tp(t){return typeof t=="number"}function gt(t){return typeof t<"u"&&typeof t!==null}function Cp(t){return!(!t||typeof t!="object"||!t.code||!Zo(t.code,!1)||!t.message||!it(t.message,!1))}function Rp(t){return!(bt(t)||!it(t.method,!1))}function Np(t){return!(bt(t)||bt(t.result)&&bt(t.error)||!Zo(t.id,!1)||!it(t.jsonrpc,!1))}function Pp(t){return!(bt(t)||!it(t.name,!1))}function sa(t,e){return!(!Ti(e)||!gp(t).includes(e))}function Fp(t,e,r){return it(r,!1)?yp(t,e).includes(r):!1}function $p(t,e,r){return it(r,!1)?_p(t,e).includes(r):!1}function oa(t,e,r){let n=null;const i=Object.keys(t),s=Object.keys(e);return pt(i,s)?i.forEach(o=>{var a;if(n)return;const h=t[o].chains,f=Lt(e[o].accounts);pt(h,f)?pt(t[o].methods,e[o].methods)?pt(t[o].events,e[o].events)?t[o].extension&&!e[o].extension?n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces extension doesn't satisfy requiredNamespaces extension for ${o}`):t[o].extension&&e[o].extension&&((a=t[o].extension)==null||a.forEach(({methods:l,events:D,chains:E})=>{var m;n||(m=e[o].extension)!=null&&m.find(b=>{const P=Lt(b.accounts);return pt(E,P)&&pt(D,b.events)&&pt(l,b.methods)})||(n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces extension doesn't satisfy requiredNamespaces extension for ${o}`))})):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy requiredNamespaces events for ${o}`):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy requiredNamespaces methods for ${o}`):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy requiredNamespaces chains for ${o}`)}):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces`),n}function Mp(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var Up=jp;function jp(t,e,r){var n=r&&r.stringify||Mp,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a<s;a++)o[a]=n(e[a]);return o.join(" ")}if(typeof t!="string")return t;var h=e.length;if(h===0)return t;for(var f="",l=1-i,D=-1,E=t&&t.length||0,m=0;m<E;){if(t.charCodeAt(m)===37&&m+1<E){switch(D=D>-1?D:0,t.charCodeAt(m+1)){case 100:case 102:if(l>=h||e[l]==null)break;D<m&&(f+=t.slice(D,m)),f+=Number(e[l]),D=m+2,m++;break;case 105:if(l>=h||e[l]==null)break;D<m&&(f+=t.slice(D,m)),f+=Math.floor(Number(e[l])),D=m+2,m++;break;case 79:case 111:case 106:if(l>=h||e[l]===void 0)break;D<m&&(f+=t.slice(D,m));var b=typeof e[l];if(b==="string"){f+="'"+e[l]+"'",D=m+2,m++;break}if(b==="function"){f+=e[l].name||"<anonymous>",D=m+2,m++;break}f+=n(e[l]),D=m+2,m++;break;case 115:if(l>=h)break;D<m&&(f+=t.slice(D,m)),f+=String(e[l]),D=m+2,m++;break;case 37:D<m&&(f+=t.slice(D,m)),f+="%",D=m+2,m++,l--;break}++l}++m}return D===-1?t:(D<E&&(f+=t.slice(D)),f)}const aa=Up;var yn=At;const Mr=Yp().console||{},Bp={mapHttpRequest:vn,mapHttpResponse:vn,wrapRequestSerializer:Pi,wrapResponseSerializer:Pi,wrapErrorSerializer:Pi,req:vn,res:vn,err:Vp};function zp(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function At(t){t=t||{},t.browser=t.browser||{};const e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const r=t.browser.write||Mr;t.browser.write&&(t.browser.asObject=!0);const n=t.serializers||{},i=zp(t.browser.serialize,n);let s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",h=Object.create(r);h.log||(h.log=Ur),Object.defineProperty(h,"levelVal",{get:l}),Object.defineProperty(h,"level",{get:D,set:E});const f={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:Gp(t)};h.levels=At.levels,h.level=a,h.setMaxListeners=h.getMaxListeners=h.emit=h.addListener=h.on=h.prependListener=h.once=h.prependOnceListener=h.removeListener=h.removeAllListeners=h.listeners=h.listenerCount=h.eventNames=h.write=h.flush=Ur,h.serializers=n,h._serialize=i,h._stdErrSerialize=s,h.child=m,e&&(h._logEvent=Ni());function l(){return this.level==="silent"?1/0:this.levels.values[this.level]}function D(){return this._level}function E(b){if(b!=="silent"&&!this.levels.values[b])throw Error("unknown level "+b);this._level=b,dr(f,h,"error","log"),dr(f,h,"fatal","error"),dr(f,h,"warn","error"),dr(f,h,"info","log"),dr(f,h,"debug","log"),dr(f,h,"trace","log")}function m(b,P){if(!b)throw new Error("missing bindings for child Pino");P=P||{},i&&b.serializers&&(P.serializers=b.serializers);const R=P.serializers;if(i&&R){var B=Object.assign({},n,R),S=t.browser.serialize===!0?Object.keys(B):i;delete b.serializers,_n([b],S,B,this._stdErrSerialize)}function L(y){this._childLevel=(y._childLevel|0)+1,this.error=pr(y,b,"error"),this.fatal=pr(y,b,"fatal"),this.warn=pr(y,b,"warn"),this.info=pr(y,b,"info"),this.debug=pr(y,b,"debug"),this.trace=pr(y,b,"trace"),B&&(this.serializers=B,this._serialize=S),e&&(this._logEvent=Ni([].concat(y._logEvent.bindings,b)))}return L.prototype=this,new L(this)}return h}At.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"}},At.stdSerializers=Bp,At.stdTimeFunctions=Object.assign({},{nullTime:ca,epochTime:ua,unixTime:Wp,isoTime:kp});function dr(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Ur:i[r]?i[r]:Mr[r]||Mr[n]||Ur,Kp(t,e,r)}function Kp(t,e,r){!t.transmit&&e[r]===Ur||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Mr?Mr:this;for(var h=0;h<o.length;h++)o[h]=arguments[h];if(t.serialize&&!t.asObject&&_n(o,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?n.call(a,Hp(this,r,o,s)):n.apply(a,o),t.transmit){const f=t.transmit.level||e.level,l=At.levels.values[f],D=At.levels.values[r];if(D<l)return;qp(this,{ts:s,methodLevel:r,methodValue:D,transmitLevel:f,transmitValue:At.levels.values[t.transmit.level||e.level],send:t.transmit.send,val:e.levelVal},o)}}}(e[r]))}function Hp(t,e,r,n){t._serialize&&_n(r,t._serialize,t.serializers,t._stdErrSerialize);const i=r.slice();let s=i[0];const o={};n&&(o.time=n),o.level=At.levels.values[e];let a=(t._childLevel|0)+1;if(a<1&&(a=1),s!==null&&typeof s=="object"){for(;a--&&typeof i[0]=="object";)Object.assign(o,i.shift());s=i.length?aa(i.shift(),i):void 0}else typeof s=="string"&&(s=aa(i.shift(),i));return s!==void 0&&(o.msg=s),o}function _n(t,e,r,n){for(const i in t)if(n&&t[i]instanceof Error)t[i]=At.stdSerializers.err(t[i]);else if(typeof t[i]=="object"&&!Array.isArray(t[i]))for(const s in t[i])e&&e.indexOf(s)>-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function pr(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;i<n.length;i++)n[i]=arguments[i-1];return t[r].apply(this,n)}}function qp(t,e,r){const n=e.send,i=e.ts,s=e.methodLevel,o=e.methodValue,a=e.val,h=t._logEvent.bindings;_n(r,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=i,t._logEvent.messages=r.filter(function(f){return h.indexOf(f)===-1}),t._logEvent.level.label=s,t._logEvent.level.value=o,n(s,t._logEvent,a),t._logEvent=Ni(h)}function Ni(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function Vp(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const r in t)e[r]===void 0&&(e[r]=t[r]);return e}function Gp(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?ca:ua}function vn(){return{}}function Pi(t){return t}function Ur(){}function ca(){return!1}function ua(){return Date.now()}function Wp(){return Math.round(Date.now()/1e3)}function kp(){return new Date(Date.now()).toISOString()}function Yp(){function t(e){return typeof e<"u"&&e}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 t(self)||t(window)||t(this)||{}}}var Ut={exports:{}},gr=typeof Reflect=="object"?Reflect:null,fa=gr&&typeof gr.apply=="function"?gr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},bn;gr&&typeof gr.ownKeys=="function"?bn=gr.ownKeys:Object.getOwnPropertySymbols?bn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:bn=function(e){return Object.getOwnPropertyNames(e)};function Jp(t){console&&console.warn&&console.warn(t)}var ha=Number.isNaN||function(e){return e!==e};function Se(){Se.init.call(this)}Ut.exports=Se,Ut.exports.once=eg,Se.EventEmitter=Se,Se.prototype._events=void 0,Se.prototype._eventsCount=0,Se.prototype._maxListeners=void 0;var la=10;function mn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Se,"defaultMaxListeners",{enumerable:!0,get:function(){return la},set:function(t){if(typeof t!="number"||t<0||ha(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");la=t}}),Se.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},Se.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ha(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 da(t){return t._maxListeners===void 0?Se.defaultMaxListeners:t._maxListeners}Se.prototype.getMaxListeners=function(){return da(this)},Se.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 o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")fa(h,this,r);else for(var f=h.length,l=va(h,f),n=0;n<f;++n)fa(l[n],this,r);return!0};function pa(t,e,r,n){var i,s,o;if(mn(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),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=da(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,Jp(a)}return t}Se.prototype.addListener=function(e,r){return pa(this,e,r,!1)},Se.prototype.on=Se.prototype.addListener,Se.prototype.prependListener=function(e,r){return pa(this,e,r,!0)};function Xp(){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 ga(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Xp.bind(n);return i.listener=r,n.wrapFn=i,i}Se.prototype.once=function(e,r){return mn(r),this.on(e,ga(this,e,r)),this},Se.prototype.prependOnceListener=function(e,r){return mn(r),this.prependListener(e,ga(this,e,r)),this},Se.prototype.removeListener=function(e,r){var n,i,s,o,a;if(mn(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,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():Zp(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Se.prototype.off=Se.prototype.removeListener,Se.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),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);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 ya(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?Qp(i):va(i,i.length)}Se.prototype.listeners=function(e){return ya(this,e,!0)},Se.prototype.rawListeners=function(e){return ya(this,e,!1)},Se.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):_a.call(t,e)},Se.prototype.listenerCount=_a;function _a(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}Se.prototype.eventNames=function(){return this._eventsCount>0?bn(this._events):[]};function va(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Zp(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Qp(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function eg(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}ba(t,e,s,{once:!0}),e!=="error"&&tg(t,i,{once:!0})})}function tg(t,e,r){typeof t.on=="function"&&ba(t,"error",e,r)}function ba(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 wn={};/*! *****************************************************************************
|
|
27
|
+
***************************************************************************** */var yi=function(t,e){return yi=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])},yi(t,e)};function ed(t,e){yi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var vi=function(){return vi=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},vi.apply(this,arguments)};function td(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 rd(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function nd(t,e){return function(r,n){e(r,n,t)}}function id(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function sd(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{f(n.next(l))}catch(D){o(D)}}function h(l){try{f(n.throw(l))}catch(D){o(D)}}function f(l){l.done?s(l.value):i(l.value).then(a,h)}f((n=n.apply(t,e||[])).next())})}function od(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(f){return function(l){return h([f,l])}}function h(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=f[0]&2?i.return:f[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,f[1])).done)return s;switch(i=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){r.label=f[1];break}if(f[0]===6&&r.label<s[1]){r.label=s[1],s=f;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(f);break}s[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(l){f=[6,l],i=0}finally{n=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function ad(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function cd(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function _i(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 So(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function ud(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(So(arguments[e]));return t}function fd(){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],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Cr(t){return this instanceof Cr?(this.v=t,this):new Cr(t)}function hd(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(b){n[b]&&(i[b]=function(m){return new Promise(function(w,N){s.push([b,m,w,N])>1||a(b,m)})})}function a(b,m){try{h(n[b](m))}catch(w){D(s[0][3],w)}}function h(b){b.value instanceof Cr?Promise.resolve(b.value.v).then(f,l):D(s[0][2],b)}function f(b){a("next",b)}function l(b){a("throw",b)}function D(b,m){b(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function ld(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(o){return(r=!r)?{value:Cr(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function dd(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 _i=="function"?_i(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(o){return new Promise(function(a,h){o=t[s](o),i(a,h,o.done,o.value)})}}function i(s,o,a,h){Promise.resolve(h).then(function(f){s({value:f,done:a})},o)}}function pd(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function gd(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 yd(t){return t&&t.__esModule?t:{default:t}}function vd(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function _d(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:ed,get __assign(){return vi},__rest:td,__decorate:rd,__param:nd,__metadata:id,__awaiter:sd,__generator:od,__createBinding:ad,__exportStar:cd,__values:_i,__read:So,__spread:ud,__spreadArrays:fd,__await:Cr,__asyncGenerator:hd,__asyncDelegator:ld,__asyncValues:dd,__makeTemplateObject:pd,__importStar:gd,__importDefault:yd,__classPrivateFieldGet:vd,__classPrivateFieldSet:_d}),gn=Zt(bd),bi={},Rr={},Oo;function md(){if(Oo)return Rr;Oo=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Rr.delay=t,Rr}var Qt={},mi={},er={},Lo;function wd(){return Lo||(Lo=1,Object.defineProperty(er,"__esModule",{value:!0}),er.ONE_THOUSAND=er.ONE_HUNDRED=void 0,er.ONE_HUNDRED=100,er.ONE_THOUSAND=1e3),er}var wi={},Io;function Ed(){return Io||(Io=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}(wi)),wi}var Ao;function To(){return Ao||(Ao=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=gn;e.__exportStar(wd(),t),e.__exportStar(Ed(),t)}(mi)),mi}var Co;function Dd(){if(Co)return Qt;Co=1,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.fromMiliseconds=Qt.toMiliseconds=void 0;const t=To();function e(n){return n*t.ONE_THOUSAND}Qt.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return Qt.fromMiliseconds=r,Qt}var Ro;function xd(){return Ro||(Ro=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=gn;e.__exportStar(md(),t),e.__exportStar(Dd(),t)}(bi)),bi}var dr={},Po;function Sd(){if(Po)return dr;Po=1,Object.defineProperty(dr,"__esModule",{value:!0}),dr.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 dr.Watch=t,dr.default=t,dr}var Ei={},Pr={},No;function Od(){if(No)return Pr;No=1,Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.IWatch=void 0;class t{}return Pr.IWatch=t,Pr}var $o;function Ld(){return $o||($o=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),gn.__exportStar(Od(),t)}(Ei)),Ei}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=gn;e.__exportStar(xd(),t),e.__exportStar(Sd(),t),e.__exportStar(Ld(),t),e.__exportStar(To(),t)})(Z);var Ce={};Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.getLocalStorage=Ce.getLocalStorageOrThrow=Ce.getCrypto=Ce.getCryptoOrThrow=Mo=Ce.getLocation=Ce.getLocationOrThrow=Di=Ce.getNavigator=Ce.getNavigatorOrThrow=Fo=Ce.getDocument=Ce.getDocumentOrThrow=Ce.getFromWindowOrThrow=Ce.getFromWindow=void 0;function tr(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Ce.getFromWindow=tr;function pr(t){const e=tr(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Ce.getFromWindowOrThrow=pr;function Id(){return pr("document")}Ce.getDocumentOrThrow=Id;function Ad(){return tr("document")}var Fo=Ce.getDocument=Ad;function Td(){return pr("navigator")}Ce.getNavigatorOrThrow=Td;function Cd(){return tr("navigator")}var Di=Ce.getNavigator=Cd;function Rd(){return pr("location")}Ce.getLocationOrThrow=Rd;function Pd(){return tr("location")}var Mo=Ce.getLocation=Pd;function Nd(){return pr("crypto")}Ce.getCryptoOrThrow=Nd;function $d(){return tr("crypto")}Ce.getCrypto=$d;function Fd(){return pr("localStorage")}Ce.getLocalStorageOrThrow=Fd;function Md(){return tr("localStorage")}Ce.getLocalStorage=Md;var xi={};Object.defineProperty(xi,"__esModule",{value:!0});var Uo=xi.getWindowMetadata=void 0;const jo=Ce;function Ud(){let t,e;try{t=jo.getDocumentOrThrow(),e=jo.getLocationOrThrow()}catch{return null}function r(){const D=t.getElementsByTagName("link"),b=[];for(let m=0;m<D.length;m++){const w=D[m],N=w.getAttribute("rel");if(N&&N.toLowerCase().indexOf("icon")>-1){const R=w.getAttribute("href");if(R)if(R.toLowerCase().indexOf("https:")===-1&&R.toLowerCase().indexOf("http:")===-1&&R.indexOf("//")!==0){let B=e.protocol+"//"+e.host;if(R.indexOf("/")===0)B+=R;else{const S=e.pathname.split("/");S.pop();const I=S.join("/");B+=I+"/"+R}b.push(B)}else if(R.indexOf("//")===0){const B=e.protocol+R;b.push(B)}else b.push(R)}}return b}function n(...D){const b=t.getElementsByTagName("meta");for(let m=0;m<b.length;m++){const w=b[m],N=["itemprop","property","name"].map(R=>w.getAttribute(R)).filter(R=>R?D.includes(R):!1);if(N.length&&N){const R=w.getAttribute("content");if(R)return R}}return""}function i(){let D=n("name","og:site_name","og:title","twitter:title");return D||(D=t.title),D}function s(){return n("description","og:description","twitter:description","keywords")}const o=i(),a=s(),h=e.origin,f=r();return{description:a,url:h,icons:f,name:o}}Uo=xi.getWindowMetadata=Ud;var Nr={},jd=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Bo="%[a-f0-9]{2}",zo=new RegExp(Bo,"gi"),Ko=new RegExp("("+Bo+")+","gi");function Si(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([],Si(r),Si(n))}function Bd(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(zo),r=1;r<e.length;r++)t=Si(e,r).join(""),e=t.match(zo);return t}}function zd(t){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},r=Ko.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var n=Bd(r[0]);n!==r[0]&&(e[r[0]]=n)}r=Ko.exec(t)}e["%C2"]="\uFFFD";for(var i=Object.keys(e),s=0;s<i.length;s++){var o=i[s];t=t.replace(new RegExp(o,"g"),e[o])}return t}var Kd=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 zd(t)}},qd=(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)]},Hd=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s<n.length;s++){var o=n[s],a=t[o];(i?e.indexOf(o)!==-1:e(o,a,t))&&(r[o]=a)}return r};(function(t){const e=jd,r=Kd,n=qd,i=Hd,s=S=>S==null,o=Symbol("encodeFragmentIdentifier");function a(S){switch(S.arrayFormat){case"index":return I=>(y,x)=>{const E=y.length;return x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,[l(I,S),"[",E,"]"].join("")]:[...y,[l(I,S),"[",l(E,S),"]=",l(x,S)].join("")]};case"bracket":return I=>(y,x)=>x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,[l(I,S),"[]"].join("")]:[...y,[l(I,S),"[]=",l(x,S)].join("")];case"colon-list-separator":return I=>(y,x)=>x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,[l(I,S),":list="].join("")]:[...y,[l(I,S),":list=",l(x,S)].join("")];case"comma":case"separator":case"bracket-separator":{const I=S.arrayFormat==="bracket-separator"?"[]=":"=";return y=>(x,E)=>E===void 0||S.skipNull&&E===null||S.skipEmptyString&&E===""?x:(E=E===null?"":E,x.length===0?[[l(y,S),I,l(E,S)].join("")]:[[x,l(E,S)].join(S.arrayFormatSeparator)])}default:return I=>(y,x)=>x===void 0||S.skipNull&&x===null||S.skipEmptyString&&x===""?y:x===null?[...y,l(I,S)]:[...y,[l(I,S),"=",l(x,S)].join("")]}}function h(S){let I;switch(S.arrayFormat){case"index":return(y,x,E)=>{if(I=/\[(\d*)\]$/.exec(y),y=y.replace(/\[\d*\]$/,""),!I){E[y]=x;return}E[y]===void 0&&(E[y]={}),E[y][I[1]]=x};case"bracket":return(y,x,E)=>{if(I=/(\[\])$/.exec(y),y=y.replace(/\[\]$/,""),!I){E[y]=x;return}if(E[y]===void 0){E[y]=[x];return}E[y]=[].concat(E[y],x)};case"colon-list-separator":return(y,x,E)=>{if(I=/(:list)$/.exec(y),y=y.replace(/:list$/,""),!I){E[y]=x;return}if(E[y]===void 0){E[y]=[x];return}E[y]=[].concat(E[y],x)};case"comma":case"separator":return(y,x,E)=>{const c=typeof x=="string"&&x.includes(S.arrayFormatSeparator),d=typeof x=="string"&&!c&&D(x,S).includes(S.arrayFormatSeparator);x=d?D(x,S):x;const U=c||d?x.split(S.arrayFormatSeparator).map(K=>D(K,S)):x===null?x:D(x,S);E[y]=U};case"bracket-separator":return(y,x,E)=>{const c=/(\[\])$/.test(y);if(y=y.replace(/\[\]$/,""),!c){E[y]=x&&D(x,S);return}const d=x===null?[]:x.split(S.arrayFormatSeparator).map(U=>D(U,S));if(E[y]===void 0){E[y]=d;return}E[y]=[].concat(E[y],d)};default:return(y,x,E)=>{if(E[y]===void 0){E[y]=x;return}E[y]=[].concat(E[y],x)}}}function f(S){if(typeof S!="string"||S.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function l(S,I){return I.encode?I.strict?e(S):encodeURIComponent(S):S}function D(S,I){return I.decode?r(S):S}function b(S){return Array.isArray(S)?S.sort():typeof S=="object"?b(Object.keys(S)).sort((I,y)=>Number(I)-Number(y)).map(I=>S[I]):S}function m(S){const I=S.indexOf("#");return I!==-1&&(S=S.slice(0,I)),S}function w(S){let I="";const y=S.indexOf("#");return y!==-1&&(I=S.slice(y)),I}function N(S){S=m(S);const I=S.indexOf("?");return I===-1?"":S.slice(I+1)}function R(S,I){return I.parseNumbers&&!Number.isNaN(Number(S))&&typeof S=="string"&&S.trim()!==""?S=Number(S):I.parseBooleans&&S!==null&&(S.toLowerCase()==="true"||S.toLowerCase()==="false")&&(S=S.toLowerCase()==="true"),S}function B(S,I){I=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},I),f(I.arrayFormatSeparator);const y=h(I),x=Object.create(null);if(typeof S!="string"||(S=S.trim().replace(/^[?#&]/,""),!S))return x;for(const E of S.split("&")){if(E==="")continue;let[c,d]=n(I.decode?E.replace(/\+/g," "):E,"=");d=d===void 0?null:["comma","separator","bracket-separator"].includes(I.arrayFormat)?d:D(d,I),y(D(c,I),d,x)}for(const E of Object.keys(x)){const c=x[E];if(typeof c=="object"&&c!==null)for(const d of Object.keys(c))c[d]=R(c[d],I);else x[E]=R(c,I)}return I.sort===!1?x:(I.sort===!0?Object.keys(x).sort():Object.keys(x).sort(I.sort)).reduce((E,c)=>{const d=x[c];return Boolean(d)&&typeof d=="object"&&!Array.isArray(d)?E[c]=b(d):E[c]=d,E},Object.create(null))}t.extract=N,t.parse=B,t.stringify=(S,I)=>{if(!S)return"";I=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},I),f(I.arrayFormatSeparator);const y=d=>I.skipNull&&s(S[d])||I.skipEmptyString&&S[d]==="",x=a(I),E={};for(const d of Object.keys(S))y(d)||(E[d]=S[d]);const c=Object.keys(E);return I.sort!==!1&&c.sort(I.sort),c.map(d=>{const U=S[d];return U===void 0?"":U===null?l(d,I):Array.isArray(U)?U.length===0&&I.arrayFormat==="bracket-separator"?l(d,I)+"[]":U.reduce(x(d),[]).join("&"):l(d,I)+"="+l(U,I)}).filter(d=>d.length>0).join("&")},t.parseUrl=(S,I)=>{I=Object.assign({decode:!0},I);const[y,x]=n(S,"#");return Object.assign({url:y.split("?")[0]||"",query:B(N(S),I)},I&&I.parseFragmentIdentifier&&x?{fragmentIdentifier:D(x,I)}:{})},t.stringifyUrl=(S,I)=>{I=Object.assign({encode:!0,strict:!0,[o]:!0},I);const y=m(S.url).split("?")[0]||"",x=t.extract(S.url),E=t.parse(x,{sort:!1}),c=Object.assign(E,S.query);let d=t.stringify(c,I);d&&(d=`?${d}`);let U=w(S.url);return S.fragmentIdentifier&&(U=`#${I[o]?l(S.fragmentIdentifier,I):S.fragmentIdentifier}`),`${y}${d}${U}`},t.pick=(S,I,y)=>{y=Object.assign({parseFragmentIdentifier:!0,[o]:!1},y);const{url:x,query:E,fragmentIdentifier:c}=t.parseUrl(S,y);return t.stringifyUrl({url:x,query:i(E,I),fragmentIdentifier:c},y)},t.exclude=(S,I,y)=>{const x=Array.isArray(I)?E=>!I.includes(E):(E,c)=>!I(E,c);return t.pick(S,x,y)}})(Nr);const Vd={waku:{publish:"waku_publish",subscribe:"waku_subscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe"},irn:{publish:"irn_publish",subscribe:"irn_subscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe"},iridium:{publish:"iridium_publish",subscribe:"iridium_subscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe"}},qo=":";function Gd(t){const{namespace:e,reference:r}=t;return[e,r].join(qo)}function Wd(t){const[e,r,n]=t.split(qo);return{namespace:e,reference:r,address:n}}function kd(t,e){const r=[];return t.forEach(n=>{const i=e(n);r.includes(i)||r.push(i)}),r}function Yd(t){const{namespace:e,reference:r}=Wd(t);return Gd({namespace:e,reference:r})}function Jd(t){return kd(t,Yd)}function Oi(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 Li(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...Jd(i.accounts))}),r}function Xd(t,e=[]){const r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;const i=t[n];r.push(...i.chains)}),r}const Ho="base10",pt="base16",Ii="base64pad",Ai="utf8",Vo=0,rr=1,Zd=0,Go=1,Ti=12,Ci=32;function Qd(){const t=hi.generateKeyPair();return{privateKey:dt(t.secretKey,pt),publicKey:dt(t.publicKey,pt)}}function Ri(){const t=lr.randomBytes(Ci);return dt(t,pt)}function ep(t,e){const r=hi.sharedKey(lt(t,pt),lt(e,pt)),n=new hh(dn.SHA256,r).expand(Ci);return dt(n,pt)}function tp(t){const e=dn.hash(lt(t,pt));return dt(e,pt)}function Pi(t){const e=dn.hash(lt(t,Ai));return dt(e,pt)}function rp(t){return lt(`${t}`,Ho)}function $r(t){return Number(dt(t,Ho))}function np(t){const e=rp(typeof t.type<"u"?t.type:Vo);if($r(e)===rr&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?lt(t.senderPublicKey,pt):void 0,n=typeof t.iv<"u"?lt(t.iv,pt):lr.randomBytes(Ti),i=new ii.ChaCha20Poly1305(lt(t.symKey,pt)).seal(n,lt(t.message,Ai));return sp({type:e,sealed:i,iv:n,senderPublicKey:r})}function ip(t){const e=new ii.ChaCha20Poly1305(lt(t.symKey,pt)),{sealed:r,iv:n}=Ni(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return dt(i,Ai)}function sp(t){if($r(t.type)===rr){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return dt(li([t.type,t.senderPublicKey,t.iv,t.sealed]),Ii)}return dt(li([t.type,t.iv,t.sealed]),Ii)}function Ni(t){const e=lt(t,Ii),r=e.slice(Zd,Go),n=Go;if($r(r)===rr){const a=n+Ci,h=a+Ti,f=e.slice(n,a),l=e.slice(a,h),D=e.slice(h);return{type:r,sealed:D,iv:l,senderPublicKey:f}}const i=n+Ti,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function op(t,e){const r=Ni(t);return Wo({type:$r(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?dt(r.senderPublicKey,pt):void 0,receiverPublicKey:e?.receiverPublicKey})}function Wo(t){const e=t?.type||Vo;if(e===rr){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 ko(t){return t.type===rr&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var ap=Object.defineProperty,Yo=Object.getOwnPropertySymbols,cp=Object.prototype.hasOwnProperty,up=Object.prototype.propertyIsEnumerable,Jo=(t,e,r)=>e in t?ap(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xo=(t,e)=>{for(var r in e||(e={}))cp.call(e,r)&&Jo(t,r,e[r]);if(Yo)for(var r of Yo(e))up.call(e,r)&&Jo(t,r,e[r]);return t};const fp="ReactNative",Fr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},hp="js";function Zo(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function lp(){return!Fo()&&!!Di()&&navigator.product===fp}function dp(){return!Zo()&&!!Di()}function pp(){return lp()?Fr.reactNative:Zo()?Fr.node:dp()?Fr.browser:Fr.unknown}function gp(t,e){let r=Nr.parse(t);return r=Xo(Xo({},r),e),t=Nr.stringify(r),t}function yp(){return Uo()||{name:"",description:"",url:"",icons:[""]}}function vp(){const t=Yl();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 _p(){var t;const e=pp();return e===Fr.browser?[e,((t=Mo())==null?void 0:t.host)||"unknown"].join(":"):e}function bp(t,e,r){const n=vp(),i=_p();return[[t,e].join("-"),[hp,r].join("-"),n,i].join("/")}function mp({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s}){const o=r.split("?"),a=bp(t,e,n),h={auth:i,ua:a,projectId:s},f=gp(o[1]||"",h);return o[0]+"?"+f}function gt(t,e){return t.filter(r=>e.includes(r)).length===t.length}function Qo(t){return Object.fromEntries(t.entries())}function ea(t){return new Map(Object.entries(t))}function Bt(t,e){return Z.fromMiliseconds((e||Date.now())+Z.toMiliseconds(t))}function Gt(t){return Z.fromMiliseconds(Date.now())>=Z.toMiliseconds(t)}function nr(){const t=Z.toMiliseconds(Z.FIVE_MINUTES);let e,r,n;return{resolve:i=>{n&&e&&(clearTimeout(n),e(i))},reject:i=>{n&&r&&(clearTimeout(n),r(i))},done:()=>new Promise((i,s)=>{n=setTimeout(s,t),e=i,r=s})}}function ta(t,e){return new Promise(async(r,n)=>{const i=setTimeout(()=>n(),e),s=await t;clearTimeout(i),r(s)})}function ra(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 wp(t){return ra("topic",t)}function Ep(t){return ra("id",t)}function na(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 je(t,e){return`${t}${e?`:${e}`:""}`}const Dp="irn";function $i(t){return t?.relay||{protocol:Dp}}function Fi(t){const e=Vd[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var xp=Object.defineProperty,ia=Object.getOwnPropertySymbols,Sp=Object.prototype.hasOwnProperty,Op=Object.prototype.propertyIsEnumerable,sa=(t,e,r)=>e in t?xp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Lp=(t,e)=>{for(var r in e||(e={}))Sp.call(e,r)&&sa(t,r,e[r]);if(ia)for(var r of ia(e))Op.call(e,r)&&sa(t,r,e[r]);return t};function Ip(t,e="-"){const r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){const s=i.replace(n,""),o=t[i];r[s]=o}}),r}function Ap(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):"",o=Nr.parse(s);return{protocol:n,topic:i[0],version:parseInt(i[1],10),symKey:o.symKey,relay:Ip(o)}}function Tp(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 Cp(t){return`${t.protocol}:${t.topic}@${t.version}?`+Nr.stringify(Lp({symKey:t.symKey},Tp(t.relay)))}function Tt(t){const e=[];return t.forEach(r=>{const[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function Rp(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Tt(r.accounts)),r.extension&&r.extension.forEach(n=>{e.push(...Tt(n.accounts))})}),e}function Pp(t,e){const r=[];return Object.values(t).forEach(n=>{Tt(n.accounts).includes(e)&&r.push(...n.methods),n.extension&&n.extension.forEach(i=>{Tt(i.accounts).includes(e)&&r.push(...i.methods)})}),r}function Np(t,e){const r=[];return Object.values(t).forEach(n=>{Tt(n.accounts).includes(e)&&r.push(...n.events),n.extension&&n.extension.forEach(i=>{Tt(i.accounts).includes(e)&&r.push(...i.events)})}),r}function $p(t,e){const r=vn(t,e);if(r)throw new Error(r.message);const n={};for(const[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}const Fp={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}},Mp={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 V(t,e){const{message:r,code:n}=Mp[t];return{message:e?`${r} ${e}`:r,code:n}}function Ge(t,e){const{message:r,code:n}=Fp[t];return{message:e?`${r} ${e}`:r,code:n}}function Mr(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function yn(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function bt(t){return typeof t>"u"}function st(t,e){return e&&bt(t)?!0:typeof t=="string"&&Boolean(t.trim().length)}function oa(t,e){return e&&bt(t)?!0:typeof t=="number"&&!isNaN(t)}function Up(t,e){const{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r);let s=!0;return gt(i,n)?(n.forEach(o=>{const{accounts:a,methods:h,events:f,extension:l}=t.namespaces[o],D=Tt(a),b=r[o];(!gt(b.chains,D)||!gt(b.methods,h)||!gt(b.events,f))&&(s=!1),s&&l&&l.forEach(m=>{var w;const{accounts:N,methods:R,events:B}=m,S=Tt(N);(w=b.extension)!=null&&w.find(I=>gt(I.chains,S)&>(I.methods,R)&>(I.events,B))||(s=!1)})}),s):!1}function Mi(t){return st(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function jp(t){if(st(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&Mi(r)}}return!1}function Bp(t){if(st(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function zp(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function Kp(t){return t?.topic}function qp(t,e){let r=null;return st(t?.publicKey,!1)||(r=V("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function Ui(t,e){let r=null;return bt(t?.extension)||(!Mr(t.extension)||!t.extension.length)&&(r=V("MISSING_OR_INVALID",`${e} extension should be an array of namespaces, or omitted`)),r}function aa(t){let e=!0;return Mr(t)?t.length&&(e=t.every(r=>st(r,!1))):e=!1,e}function ca(t,e,r){let n=null;return Mr(e)?e.forEach(i=>{n||(!Mi(i)||!i.includes(t))&&(n=Ge("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):n=Ge("UNSUPPORTED_CHAINS",`${r}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),n}function Hp(t,e){let r=null;return Object.entries(t).forEach(([n,i])=>{if(r)return;const s=ca(n,i?.chains,`${e} requiredNamespace`),o=Ui(i,e);s?r=s:o?r=o:i.extension&&i.extension.forEach(a=>{if(r)return;const h=ca(n,a.chains,`${e} extension`);h&&(r=h)})}),r}function ua(t,e){let r=null;return Mr(t)?t.forEach(n=>{r||jp(n)||(r=Ge("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Ge("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function Vp(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=ua(n?.accounts,`${e} namespace`),s=Ui(n,e);i?r=i:s?r=s:n.extension&&n.extension.forEach(o=>{if(r)return;const a=ua(o.accounts,`${e} extension`);a&&(r=a)})}),r}function fa(t,e){let r=null;return aa(t?.methods)?aa(t?.events)||(r=Ge("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Ge("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function ha(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;const i=fa(n,`${e}, namespace`),s=Ui(n,e);i?r=i:s?r=s:n.extension&&n.extension.forEach(o=>{if(r)return;const a=fa(o,`${e}, extension`);a&&(r=a)})}),r}function Gp(t,e){let r=null;if(t&&yn(t)){const n=ha(t,e);n&&(r=n);const i=Hp(t,e);i&&(r=i)}else r=V("MISSING_OR_INVALID",`${e}, requiredNamespaces should be an object with data`);return r}function vn(t,e){let r=null;if(t&&yn(t)){const n=ha(t,e);n&&(r=n);const i=Vp(t,e);i&&(r=i)}else r=V("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function la(t){return st(t.protocol,!0)}function Wp(t,e){let r=!1;return e&&!t?r=!0:t&&Mr(t)&&t.length&&t.forEach(n=>{r=la(n)}),r}function kp(t){return typeof t=="number"}function yt(t){return typeof t<"u"&&typeof t!==null}function Yp(t){return!(!t||typeof t!="object"||!t.code||!oa(t.code,!1)||!t.message||!st(t.message,!1))}function Jp(t){return!(bt(t)||!st(t.method,!1))}function Xp(t){return!(bt(t)||bt(t.result)&&bt(t.error)||!oa(t.id,!1)||!st(t.jsonrpc,!1))}function Zp(t){return!(bt(t)||!st(t.name,!1))}function da(t,e){return!(!Mi(e)||!Rp(t).includes(e))}function Qp(t,e,r){return st(r,!1)?Pp(t,e).includes(r):!1}function eg(t,e,r){return st(r,!1)?Np(t,e).includes(r):!1}function pa(t,e,r){let n=null;const i=Object.keys(t),s=Object.keys(e);return gt(i,s)?i.forEach(o=>{var a;if(n)return;const h=t[o].chains,f=Tt(e[o].accounts);gt(h,f)?gt(t[o].methods,e[o].methods)?gt(t[o].events,e[o].events)?t[o].extension&&!e[o].extension?n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces extension doesn't satisfy requiredNamespaces extension for ${o}`):t[o].extension&&e[o].extension&&((a=t[o].extension)==null||a.forEach(({methods:l,events:D,chains:b})=>{var m;n||(m=e[o].extension)!=null&&m.find(w=>{const N=Tt(w.accounts);return gt(b,N)&>(D,w.events)&>(l,w.methods)})||(n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces extension doesn't satisfy requiredNamespaces extension for ${o}`))})):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy requiredNamespaces events for ${o}`):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy requiredNamespaces methods for ${o}`):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy requiredNamespaces chains for ${o}`)}):n=V("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces`),n}function tg(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var rg=ng;function ng(t,e,r){var n=r&&r.stringify||tg,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a<s;a++)o[a]=n(e[a]);return o.join(" ")}if(typeof t!="string")return t;var h=e.length;if(h===0)return t;for(var f="",l=1-i,D=-1,b=t&&t.length||0,m=0;m<b;){if(t.charCodeAt(m)===37&&m+1<b){switch(D=D>-1?D:0,t.charCodeAt(m+1)){case 100:case 102:if(l>=h||e[l]==null)break;D<m&&(f+=t.slice(D,m)),f+=Number(e[l]),D=m+2,m++;break;case 105:if(l>=h||e[l]==null)break;D<m&&(f+=t.slice(D,m)),f+=Math.floor(Number(e[l])),D=m+2,m++;break;case 79:case 111:case 106:if(l>=h||e[l]===void 0)break;D<m&&(f+=t.slice(D,m));var w=typeof e[l];if(w==="string"){f+="'"+e[l]+"'",D=m+2,m++;break}if(w==="function"){f+=e[l].name||"<anonymous>",D=m+2,m++;break}f+=n(e[l]),D=m+2,m++;break;case 115:if(l>=h)break;D<m&&(f+=t.slice(D,m)),f+=String(e[l]),D=m+2,m++;break;case 37:D<m&&(f+=t.slice(D,m)),f+="%",D=m+2,m++,l--;break}++l}++m}return D===-1?t:(D<b&&(f+=t.slice(D)),f)}const ga=rg;var _n=Ct;const Ur=dg().console||{},ig={mapHttpRequest:mn,mapHttpResponse:mn,wrapRequestSerializer:Bi,wrapResponseSerializer:Bi,wrapErrorSerializer:Bi,req:mn,res:mn,err:ug};function sg(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function Ct(t){t=t||{},t.browser=t.browser||{};const e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const r=t.browser.write||Ur;t.browser.write&&(t.browser.asObject=!0);const n=t.serializers||{},i=sg(t.browser.serialize,n);let s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",h=Object.create(r);h.log||(h.log=jr),Object.defineProperty(h,"levelVal",{get:l}),Object.defineProperty(h,"level",{get:D,set:b});const f={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:fg(t)};h.levels=Ct.levels,h.level=a,h.setMaxListeners=h.getMaxListeners=h.emit=h.addListener=h.on=h.prependListener=h.once=h.prependOnceListener=h.removeListener=h.removeAllListeners=h.listeners=h.listenerCount=h.eventNames=h.write=h.flush=jr,h.serializers=n,h._serialize=i,h._stdErrSerialize=s,h.child=m,e&&(h._logEvent=ji());function l(){return this.level==="silent"?1/0:this.levels.values[this.level]}function D(){return this._level}function b(w){if(w!=="silent"&&!this.levels.values[w])throw Error("unknown level "+w);this._level=w,gr(f,h,"error","log"),gr(f,h,"fatal","error"),gr(f,h,"warn","error"),gr(f,h,"info","log"),gr(f,h,"debug","log"),gr(f,h,"trace","log")}function m(w,N){if(!w)throw new Error("missing bindings for child Pino");N=N||{},i&&w.serializers&&(N.serializers=w.serializers);const R=N.serializers;if(i&&R){var B=Object.assign({},n,R),S=t.browser.serialize===!0?Object.keys(B):i;delete w.serializers,bn([w],S,B,this._stdErrSerialize)}function I(y){this._childLevel=(y._childLevel|0)+1,this.error=yr(y,w,"error"),this.fatal=yr(y,w,"fatal"),this.warn=yr(y,w,"warn"),this.info=yr(y,w,"info"),this.debug=yr(y,w,"debug"),this.trace=yr(y,w,"trace"),B&&(this.serializers=B,this._serialize=S),e&&(this._logEvent=ji([].concat(y._logEvent.bindings,w)))}return I.prototype=this,new I(this)}return h}Ct.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"}},Ct.stdSerializers=ig,Ct.stdTimeFunctions=Object.assign({},{nullTime:ya,epochTime:va,unixTime:hg,isoTime:lg});function gr(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?jr:i[r]?i[r]:Ur[r]||Ur[n]||jr,og(t,e,r)}function og(t,e,r){!t.transmit&&e[r]===jr||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Ur?Ur:this;for(var h=0;h<o.length;h++)o[h]=arguments[h];if(t.serialize&&!t.asObject&&bn(o,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?n.call(a,ag(this,r,o,s)):n.apply(a,o),t.transmit){const f=t.transmit.level||e.level,l=Ct.levels.values[f],D=Ct.levels.values[r];if(D<l)return;cg(this,{ts:s,methodLevel:r,methodValue:D,transmitLevel:f,transmitValue:Ct.levels.values[t.transmit.level||e.level],send:t.transmit.send,val:e.levelVal},o)}}}(e[r]))}function ag(t,e,r,n){t._serialize&&bn(r,t._serialize,t.serializers,t._stdErrSerialize);const i=r.slice();let s=i[0];const o={};n&&(o.time=n),o.level=Ct.levels.values[e];let a=(t._childLevel|0)+1;if(a<1&&(a=1),s!==null&&typeof s=="object"){for(;a--&&typeof i[0]=="object";)Object.assign(o,i.shift());s=i.length?ga(i.shift(),i):void 0}else typeof s=="string"&&(s=ga(i.shift(),i));return s!==void 0&&(o.msg=s),o}function bn(t,e,r,n){for(const i in t)if(n&&t[i]instanceof Error)t[i]=Ct.stdSerializers.err(t[i]);else if(typeof t[i]=="object"&&!Array.isArray(t[i]))for(const s in t[i])e&&e.indexOf(s)>-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function yr(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;i<n.length;i++)n[i]=arguments[i-1];return t[r].apply(this,n)}}function cg(t,e,r){const n=e.send,i=e.ts,s=e.methodLevel,o=e.methodValue,a=e.val,h=t._logEvent.bindings;bn(r,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=i,t._logEvent.messages=r.filter(function(f){return h.indexOf(f)===-1}),t._logEvent.level.label=s,t._logEvent.level.value=o,n(s,t._logEvent,a),t._logEvent=ji(h)}function ji(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function ug(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const r in t)e[r]===void 0&&(e[r]=t[r]);return e}function fg(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?ya:va}function mn(){return{}}function Bi(t){return t}function jr(){}function ya(){return!1}function va(){return Date.now()}function hg(){return Math.round(Date.now()/1e3)}function lg(){return new Date(Date.now()).toISOString()}function dg(){function t(e){return typeof e<"u"&&e}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 t(self)||t(window)||t(this)||{}}}var zt={exports:{}},vr=typeof Reflect=="object"?Reflect:null,_a=vr&&typeof vr.apply=="function"?vr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},wn;vr&&typeof vr.ownKeys=="function"?wn=vr.ownKeys:Object.getOwnPropertySymbols?wn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:wn=function(e){return Object.getOwnPropertyNames(e)};function pg(t){console&&console.warn&&console.warn(t)}var ba=Number.isNaN||function(e){return e!==e};function Se(){Se.init.call(this)}zt.exports=Se,zt.exports.once=_g,Se.EventEmitter=Se,Se.prototype._events=void 0,Se.prototype._eventsCount=0,Se.prototype._maxListeners=void 0;var ma=10;function En(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Se,"defaultMaxListeners",{enumerable:!0,get:function(){return ma},set:function(t){if(typeof t!="number"||t<0||ba(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");ma=t}}),Se.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},Se.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ba(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 wa(t){return t._maxListeners===void 0?Se.defaultMaxListeners:t._maxListeners}Se.prototype.getMaxListeners=function(){return wa(this)},Se.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 o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")_a(h,this,r);else for(var f=h.length,l=Oa(h,f),n=0;n<f;++n)_a(l[n],this,r);return!0};function Ea(t,e,r,n){var i,s,o;if(En(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),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=wa(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,pg(a)}return t}Se.prototype.addListener=function(e,r){return Ea(this,e,r,!1)},Se.prototype.on=Se.prototype.addListener,Se.prototype.prependListener=function(e,r){return Ea(this,e,r,!0)};function gg(){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 Da(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=gg.bind(n);return i.listener=r,n.wrapFn=i,i}Se.prototype.once=function(e,r){return En(r),this.on(e,Da(this,e,r)),this},Se.prototype.prependOnceListener=function(e,r){return En(r),this.prependListener(e,Da(this,e,r)),this},Se.prototype.removeListener=function(e,r){var n,i,s,o,a;if(En(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,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():yg(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Se.prototype.off=Se.prototype.removeListener,Se.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),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);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 xa(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?vg(i):Oa(i,i.length)}Se.prototype.listeners=function(e){return xa(this,e,!0)},Se.prototype.rawListeners=function(e){return xa(this,e,!1)},Se.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Sa.call(t,e)},Se.prototype.listenerCount=Sa;function Sa(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}Se.prototype.eventNames=function(){return this._eventsCount>0?wn(this._events):[]};function Oa(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function yg(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function vg(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function _g(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}La(t,e,s,{once:!0}),e!=="error"&&bg(t,i,{once:!0})})}function bg(t,e,r){typeof t.on=="function"&&La(t,"error",e,r)}function La(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 Dn={};/*! *****************************************************************************
|
|
28
28
|
Copyright (c) Microsoft Corporation.
|
|
29
29
|
|
|
30
30
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
38
38
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
39
39
|
PERFORMANCE OF THIS SOFTWARE.
|
|
40
|
-
***************************************************************************** */var
|
|
40
|
+
***************************************************************************** */var zi=function(t,e){return zi=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])},zi(t,e)};function mg(t,e){zi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Ki=function(){return Ki=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},Ki.apply(this,arguments)};function wg(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 Eg(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function Dg(t,e){return function(r,n){e(r,n,t)}}function xg(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Sg(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{f(n.next(l))}catch(D){o(D)}}function h(l){try{f(n.throw(l))}catch(D){o(D)}}function f(l){l.done?s(l.value):i(l.value).then(a,h)}f((n=n.apply(t,e||[])).next())})}function Og(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(f){return function(l){return h([f,l])}}function h(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=f[0]&2?i.return:f[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,f[1])).done)return s;switch(i=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){r.label=f[1];break}if(f[0]===6&&r.label<s[1]){r.label=s[1],s=f;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(f);break}s[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(l){f=[6,l],i=0}finally{n=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Lg(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Ig(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function qi(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 Ia(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Ag(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Ia(arguments[e]));return t}function Tg(){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],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Br(t){return this instanceof Br?(this.v=t,this):new Br(t)}function Cg(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(b){n[b]&&(i[b]=function(m){return new Promise(function(w,N){s.push([b,m,w,N])>1||a(b,m)})})}function a(b,m){try{h(n[b](m))}catch(w){D(s[0][3],w)}}function h(b){b.value instanceof Br?Promise.resolve(b.value.v).then(f,l):D(s[0][2],b)}function f(b){a("next",b)}function l(b){a("throw",b)}function D(b,m){b(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Rg(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(o){return(r=!r)?{value:Br(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function Pg(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 qi=="function"?qi(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(o){return new Promise(function(a,h){o=t[s](o),i(a,h,o.done,o.value)})}}function i(s,o,a,h){Promise.resolve(h).then(function(f){s({value:f,done:a})},o)}}function Ng(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function $g(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 Fg(t){return t&&t.__esModule?t:{default:t}}function Mg(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Ug(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 jg=Object.freeze({__proto__:null,__extends:mg,get __assign(){return Ki},__rest:wg,__decorate:Eg,__param:Dg,__metadata:xg,__awaiter:Sg,__generator:Og,__createBinding:Lg,__exportStar:Ig,__values:qi,__read:Ia,__spread:Ag,__spreadArrays:Tg,__await:Br,__asyncGenerator:Cg,__asyncDelegator:Rg,__asyncValues:Pg,__makeTemplateObject:Ng,__importStar:$g,__importDefault:Fg,__classPrivateFieldGet:Mg,__classPrivateFieldSet:Ug}),Aa=Zt(jg),zr={};Object.defineProperty(zr,"__esModule",{value:!0});function Bg(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}zr.safeJsonParse=Bg;function zg(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}zr.safeJsonStringify=zg;var Kr={exports:{}},Ta;function Kg(){return Ta||(Ta=1,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 ke<"u"&&ke.localStorage?Kr.exports=ke.localStorage:typeof window<"u"&&window.localStorage?Kr.exports=window.localStorage:Kr.exports=new e}()),Kr.exports}var Hi={},qr={},Ca;function qg(){if(Ca)return qr;Ca=1,Object.defineProperty(qr,"__esModule",{value:!0}),qr.IKeyValueStorage=void 0;class t{}return qr.IKeyValueStorage=t,qr}var Hr={},Ra;function Hg(){if(Ra)return Hr;Ra=1,Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.parseEntry=void 0;const t=zr;function e(r){var n;return[r[0],t.safeJsonParse((n=r[1])!==null&&n!==void 0?n:"")]}return Hr.parseEntry=e,Hr}var Pa;function Vg(){return Pa||(Pa=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Aa;e.__exportStar(qg(),t),e.__exportStar(Hg(),t)}(Hi)),Hi}Object.defineProperty(Dn,"__esModule",{value:!0}),Dn.KeyValueStorage=void 0;const _r=Aa,Na=zr,Gg=_r.__importDefault(Kg()),Wg=Vg();class $a{constructor(){this.localStorage=Gg.default}getKeys(){return _r.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return _r.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(Wg.parseEntry)})}getItem(e){return _r.__awaiter(this,void 0,void 0,function*(){const r=this.localStorage.getItem(e);if(r!==null)return Na.safeJsonParse(r)})}setItem(e,r){return _r.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,Na.safeJsonStringify(r))})}removeItem(e){return _r.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}}Dn.KeyValueStorage=$a;var kg=Dn.default=$a,Vr={};/*! *****************************************************************************
|
|
41
41
|
Copyright (c) Microsoft Corporation.
|
|
42
42
|
|
|
43
43
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
51
51
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
52
52
|
PERFORMANCE OF THIS SOFTWARE.
|
|
53
|
-
***************************************************************************** */var
|
|
53
|
+
***************************************************************************** */var Vi=function(t,e){return Vi=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])},Vi(t,e)};function Yg(t,e){Vi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Gi=function(){return Gi=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},Gi.apply(this,arguments)};function Jg(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 Xg(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function Zg(t,e){return function(r,n){e(r,n,t)}}function Qg(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function ey(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{f(n.next(l))}catch(D){o(D)}}function h(l){try{f(n.throw(l))}catch(D){o(D)}}function f(l){l.done?s(l.value):i(l.value).then(a,h)}f((n=n.apply(t,e||[])).next())})}function ty(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(f){return function(l){return h([f,l])}}function h(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=f[0]&2?i.return:f[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,f[1])).done)return s;switch(i=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){r.label=f[1];break}if(f[0]===6&&r.label<s[1]){r.label=s[1],s=f;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(f);break}s[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(l){f=[6,l],i=0}finally{n=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function ry(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function ny(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Wi(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 Fa(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function iy(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Fa(arguments[e]));return t}function sy(){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],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Gr(t){return this instanceof Gr?(this.v=t,this):new Gr(t)}function oy(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(b){n[b]&&(i[b]=function(m){return new Promise(function(w,N){s.push([b,m,w,N])>1||a(b,m)})})}function a(b,m){try{h(n[b](m))}catch(w){D(s[0][3],w)}}function h(b){b.value instanceof Gr?Promise.resolve(b.value.v).then(f,l):D(s[0][2],b)}function f(b){a("next",b)}function l(b){a("throw",b)}function D(b,m){b(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function ay(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(o){return(r=!r)?{value:Gr(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function cy(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 Wi=="function"?Wi(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(o){return new Promise(function(a,h){o=t[s](o),i(a,h,o.done,o.value)})}}function i(s,o,a,h){Promise.resolve(h).then(function(f){s({value:f,done:a})},o)}}function uy(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function fy(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 hy(t){return t&&t.__esModule?t:{default:t}}function ly(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function dy(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 py=Object.freeze({__proto__:null,__extends:Yg,get __assign(){return Gi},__rest:Jg,__decorate:Xg,__param:Zg,__metadata:Qg,__awaiter:ey,__generator:ty,__createBinding:ry,__exportStar:ny,__values:Wi,__read:Fa,__spread:iy,__spreadArrays:sy,__await:Gr,__asyncGenerator:oy,__asyncDelegator:ay,__asyncValues:cy,__makeTemplateObject:uy,__importStar:fy,__importDefault:hy,__classPrivateFieldGet:ly,__classPrivateFieldSet:dy}),xn=Zt(py),Wr={},ki={},kr={};class ir{}var gy=Object.freeze({__proto__:null,IEvents:ir}),yy=Zt(gy),Ma;function vy(){if(Ma)return kr;Ma=1,Object.defineProperty(kr,"__esModule",{value:!0}),kr.IHeartBeat=void 0;const t=yy;class e extends t.IEvents{constructor(n){super()}}return kr.IHeartBeat=e,kr}var Ua;function ja(){return Ua||(Ua=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),xn.__exportStar(vy(),t)}(ki)),ki}var Yi={},sr={},Ba;function _y(){if(Ba)return sr;Ba=1,Object.defineProperty(sr,"__esModule",{value:!0}),sr.HEARTBEAT_EVENTS=sr.HEARTBEAT_INTERVAL=void 0;const t=Z;return sr.HEARTBEAT_INTERVAL=t.FIVE_SECONDS,sr.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},sr}var za;function Ka(){return za||(za=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),xn.__exportStar(_y(),t)}(Yi)),Yi}var qa;function by(){if(qa)return Wr;qa=1,Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.HeartBeat=void 0;const t=xn,e=kn,r=Z,n=ja(),i=Ka();class s extends n.IHeartBeat{constructor(a){super(a),this.events=new e.EventEmitter,this.interval=i.HEARTBEAT_INTERVAL,this.interval=a?.interval||i.HEARTBEAT_INTERVAL}static init(a){return t.__awaiter(this,void 0,void 0,function*(){const h=new s(a);return yield h.init(),h})}init(){return t.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}on(a,h){this.events.on(a,h)}once(a,h){this.events.once(a,h)}off(a,h){this.events.off(a,h)}removeListener(a,h){this.events.removeListener(a,h)}initialize(){return t.__awaiter(this,void 0,void 0,function*(){setInterval(()=>this.pulse(),r.toMiliseconds(this.interval))})}pulse(){this.events.emit(i.HEARTBEAT_EVENTS.pulse)}}return Wr.HeartBeat=s,Wr}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=xn;e.__exportStar(by(),t),e.__exportStar(ja(),t),e.__exportStar(Ka(),t)})(Vr);var Oe={};/*! *****************************************************************************
|
|
54
54
|
Copyright (c) Microsoft Corporation.
|
|
55
55
|
|
|
56
56
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
64
64
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
65
65
|
PERFORMANCE OF THIS SOFTWARE.
|
|
66
|
-
***************************************************************************** */var qi=function(t,e){return qi=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])},qi(t,e)};function ry(t,e){qi(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Vi=function(){return Vi=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},Vi.apply(this,arguments)};function ny(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 iy(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function sy(t,e){return function(r,n){e(r,n,t)}}function oy(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function ay(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{f(n.next(l))}catch(D){o(D)}}function h(l){try{f(n.throw(l))}catch(D){o(D)}}function f(l){l.done?s(l.value):i(l.value).then(a,h)}f((n=n.apply(t,e||[])).next())})}function cy(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(f){return function(l){return h([f,l])}}function h(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=f[0]&2?i.return:f[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,f[1])).done)return s;switch(i=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){r.label=f[1];break}if(f[0]===6&&r.label<s[1]){r.label=s[1],s=f;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(f);break}s[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(l){f=[6,l],i=0}finally{n=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function uy(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function fy(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Gi(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 $a(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function hy(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat($a(arguments[e]));return t}function ly(){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],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function kr(t){return this instanceof kr?(this.v=t,this):new kr(t)}function dy(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(E){n[E]&&(i[E]=function(m){return new Promise(function(b,P){s.push([E,m,b,P])>1||a(E,m)})})}function a(E,m){try{h(n[E](m))}catch(b){D(s[0][3],b)}}function h(E){E.value instanceof kr?Promise.resolve(E.value.v).then(f,l):D(s[0][2],E)}function f(E){a("next",E)}function l(E){a("throw",E)}function D(E,m){E(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function py(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(o){return(r=!r)?{value:kr(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function gy(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 Gi=="function"?Gi(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(o){return new Promise(function(a,h){o=t[s](o),i(a,h,o.done,o.value)})}}function i(s,o,a,h){Promise.resolve(h).then(function(f){s({value:f,done:a})},o)}}function yy(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function _y(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 vy(t){return t&&t.__esModule?t:{default:t}}function by(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function my(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 wy=Object.freeze({__proto__:null,__extends:ry,get __assign(){return Vi},__rest:ny,__decorate:iy,__param:sy,__metadata:oy,__awaiter:ay,__generator:cy,__createBinding:uy,__exportStar:fy,__values:Gi,__read:$a,__spread:hy,__spreadArrays:ly,__await:kr,__asyncGenerator:dy,__asyncDelegator:py,__asyncValues:gy,__makeTemplateObject:yy,__importStar:_y,__importDefault:vy,__classPrivateFieldGet:by,__classPrivateFieldSet:my}),Ey=Jt(wy),ir={},Ma;function Ua(){return Ma||(Ma=1,Object.defineProperty(ir,"__esModule",{value:!0}),ir.PINO_CUSTOM_CONTEXT_KEY=ir.PINO_LOGGER_DEFAULTS=void 0,ir.PINO_LOGGER_DEFAULTS={level:"info"},ir.PINO_CUSTOM_CONTEXT_KEY="custom_context"),ir}var ut={},ja;function Dy(){if(ja)return ut;ja=1,Object.defineProperty(ut,"__esModule",{value:!0}),ut.generateChildLogger=ut.formatChildLoggerContext=ut.getLoggerContext=ut.setBrowserLoggerContext=ut.getBrowserLoggerContext=ut.getDefaultLoggerOptions=void 0;const t=Ua();function e(a){return Object.assign(Object.assign({},a),{level:a?.level||t.PINO_LOGGER_DEFAULTS.level})}ut.getDefaultLoggerOptions=e;function r(a,h=t.PINO_CUSTOM_CONTEXT_KEY){return a[h]||""}ut.getBrowserLoggerContext=r;function n(a,h,f=t.PINO_CUSTOM_CONTEXT_KEY){return a[f]=h,a}ut.setBrowserLoggerContext=n;function i(a,h=t.PINO_CUSTOM_CONTEXT_KEY){let f="";return typeof a.bindings>"u"?f=r(a,h):f=a.bindings().context||"",f}ut.getLoggerContext=i;function s(a,h,f=t.PINO_CUSTOM_CONTEXT_KEY){const l=i(a,f);return l.trim()?`${l}/${h}`:h}ut.formatChildLoggerContext=s;function o(a,h,f=t.PINO_CUSTOM_CONTEXT_KEY){const l=s(a,h,f),D=a.child({context:l});return n(D,l,f)}return ut.generateChildLogger=o,ut}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.pino=void 0;const e=Ey,r=e.__importDefault(yn);Object.defineProperty(t,"pino",{enumerable:!0,get:function(){return r.default}}),e.__exportStar(Ua(),t),e.__exportStar(Dy(),t)})(Oe);var Ba={exports:{}},_r=typeof Reflect=="object"?Reflect:null,za=_r&&typeof _r.apply=="function"?_r.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Dn;_r&&typeof _r.ownKeys=="function"?Dn=_r.ownKeys:Object.getOwnPropertySymbols?Dn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Dn=function(e){return Object.getOwnPropertyNames(e)};function xy(t){console&&console.warn&&console.warn(t)}var Ka=Number.isNaN||function(e){return e!==e};function Ie(){Ie.init.call(this)}Ba.exports=Ie,Ba.exports.once=Ly,Ie.EventEmitter=Ie,Ie.prototype._events=void 0,Ie.prototype._eventsCount=0,Ie.prototype._maxListeners=void 0;var Ha=10;function xn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ie,"defaultMaxListeners",{enumerable:!0,get:function(){return Ha},set:function(t){if(typeof t!="number"||t<0||Ka(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ha=t}}),Ie.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},Ie.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ka(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 qa(t){return t._maxListeners===void 0?Ie.defaultMaxListeners:t._maxListeners}Ie.prototype.getMaxListeners=function(){return qa(this)},Ie.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 o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")za(h,this,r);else for(var f=h.length,l=Ya(h,f),n=0;n<f;++n)za(l[n],this,r);return!0};function Va(t,e,r,n){var i,s,o;if(xn(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),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=qa(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,xy(a)}return t}Ie.prototype.addListener=function(e,r){return Va(this,e,r,!1)},Ie.prototype.on=Ie.prototype.addListener,Ie.prototype.prependListener=function(e,r){return Va(this,e,r,!0)};function Sy(){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 Ga(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Sy.bind(n);return i.listener=r,n.wrapFn=i,i}Ie.prototype.once=function(e,r){return xn(r),this.on(e,Ga(this,e,r)),this},Ie.prototype.prependOnceListener=function(e,r){return xn(r),this.prependListener(e,Ga(this,e,r)),this},Ie.prototype.removeListener=function(e,r){var n,i,s,o,a;if(xn(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,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():Oy(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Ie.prototype.off=Ie.prototype.removeListener,Ie.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),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);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 Wa(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?Iy(i):Ya(i,i.length)}Ie.prototype.listeners=function(e){return Wa(this,e,!0)},Ie.prototype.rawListeners=function(e){return Wa(this,e,!1)},Ie.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ka.call(t,e)},Ie.prototype.listenerCount=ka;function ka(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}Ie.prototype.eventNames=function(){return this._eventsCount>0?Dn(this._events):[]};function Ya(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Oy(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Iy(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Ly(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}Ja(t,e,s,{once:!0}),e!=="error"&&Ay(t,i,{once:!0})})}function Ay(t,e,r){typeof t.on=="function"&&Ja(t,"error",e,r)}function Ja(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)}class Ty extends rr{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class Cy extends rr{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}}class Ry{constructor(e,r){this.logger=e,this.core=r}}class Ny extends rr{constructor(e,r){super(),this.relayer=e,this.logger=r}}class Py extends rr{constructor(e){super()}}class Fy{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}}class $y extends rr{constructor(e,r){super(),this.relayer=e,this.logger=r}}class My extends rr{constructor(e,r){super(),this.core=e,this.logger=r}}class Uy{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class jy{constructor(e){this.client=e}}var Wi={},Xa={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=re,r=yt;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var n=function(){function a(){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 a.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},a.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},a.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},a.prototype.update=function(h,f){if(f===void 0&&(f=h.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var l=0;if(this._bytesHashed+=f,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&f>0;)this._buffer[this._bufferLength++]=h[l++],f--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(f>=this.blockSize&&(l=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,h,l,f),f%=this.blockSize);f>0;)this._buffer[this._bufferLength++]=h[l++],f--;return this},a.prototype.finish=function(h){if(!this._finished){var f=this._bytesHashed,l=this._bufferLength,D=f/536870912|0,E=f<<3,m=f%128<112?128:256;this._buffer[l]=128;for(var b=l+1;b<m-8;b++)this._buffer[b]=0;e.writeUint32BE(D,this._buffer,m-8),e.writeUint32BE(E,this._buffer,m-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,m),this._finished=!0}for(var b=0;b<this.digestLength/8;b++)e.writeUint32BE(this._stateHi[b],h,b*8),e.writeUint32BE(this._stateLo[b],h,b*8+4);return this},a.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},a.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}},a.prototype.restoreState=function(h){return this._stateHi.set(h.stateHi),this._stateLo.set(h.stateLo),this._bufferLength=h.bufferLength,h.buffer&&this._buffer.set(h.buffer),this._bytesHashed=h.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(h){r.wipe(h.stateHi),r.wipe(h.stateLo),h.buffer&&r.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},a}();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(a,h,f,l,D,E,m){for(var b=f[0],P=f[1],R=f[2],B=f[3],S=f[4],L=f[5],y=f[6],x=f[7],w=l[0],c=l[1],d=l[2],U=l[3],K=l[4],G=l[5],J=l[6],X=l[7],g,_,$,M,N,C,j,z;m>=128;){for(var Q=0;Q<16;Q++){var H=8*Q+E;a[Q]=e.readUint32BE(D,H),h[Q]=e.readUint32BE(D,H+4)}for(var Q=0;Q<80;Q++){var ee=b,Y=P,ae=R,T=B,A=S,O=L,u=y,v=x,q=w,W=c,he=d,_e=U,de=K,me=G,je=J,Pe=X;if(g=x,_=X,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=(S>>>14|K<<32-14)^(S>>>18|K<<32-18)^(K>>>41-32|S<<32-(41-32)),_=(K>>>14|S<<32-14)^(K>>>18|S<<32-18)^(S>>>41-32|K<<32-(41-32)),N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,g=S&L^~S&y,_=K&G^~K&J,N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,g=i[Q*2],_=i[Q*2+1],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,g=a[Q%16],_=h[Q%16],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,$=j&65535|z<<16,M=N&65535|C<<16,g=$,_=M,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=(b>>>28|w<<32-28)^(w>>>34-32|b<<32-(34-32))^(w>>>39-32|b<<32-(39-32)),_=(w>>>28|b<<32-28)^(b>>>34-32|w<<32-(34-32))^(b>>>39-32|w<<32-(39-32)),N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,g=b&P^b&R^P&R,_=w&c^w&d^c&d,N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,v=j&65535|z<<16,Pe=N&65535|C<<16,g=T,_=_e,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=$,_=M,N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,T=j&65535|z<<16,_e=N&65535|C<<16,P=ee,R=Y,B=ae,S=T,L=A,y=O,x=u,b=v,c=q,d=W,U=he,K=_e,G=de,J=me,X=je,w=Pe,Q%16===15)for(var H=0;H<16;H++)g=a[H],_=h[H],N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=a[(H+9)%16],_=h[(H+9)%16],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,$=a[(H+1)%16],M=h[(H+1)%16],g=($>>>1|M<<32-1)^($>>>8|M<<32-8)^$>>>7,_=(M>>>1|$<<32-1)^(M>>>8|$<<32-8)^(M>>>7|$<<32-7),N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,$=a[(H+14)%16],M=h[(H+14)%16],g=($>>>19|M<<32-19)^(M>>>61-32|$<<32-(61-32))^$>>>6,_=(M>>>19|$<<32-19)^($>>>61-32|M<<32-(61-32))^(M>>>6|$<<32-6),N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,a[H]=j&65535|z<<16,h[H]=N&65535|C<<16}g=b,_=w,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=f[0],_=l[0],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,f[0]=b=j&65535|z<<16,l[0]=w=N&65535|C<<16,g=P,_=c,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=f[1],_=l[1],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,f[1]=P=j&65535|z<<16,l[1]=c=N&65535|C<<16,g=R,_=d,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=f[2],_=l[2],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,f[2]=R=j&65535|z<<16,l[2]=d=N&65535|C<<16,g=B,_=U,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=f[3],_=l[3],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,f[3]=B=j&65535|z<<16,l[3]=U=N&65535|C<<16,g=S,_=K,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=f[4],_=l[4],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,f[4]=S=j&65535|z<<16,l[4]=K=N&65535|C<<16,g=L,_=G,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=f[5],_=l[5],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,f[5]=L=j&65535|z<<16,l[5]=G=N&65535|C<<16,g=y,_=J,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=f[6],_=l[6],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,f[6]=y=j&65535|z<<16,l[6]=J=N&65535|C<<16,g=x,_=X,N=_&65535,C=_>>>16,j=g&65535,z=g>>>16,g=f[7],_=l[7],N+=_&65535,C+=_>>>16,j+=g&65535,z+=g>>>16,C+=N>>>16,j+=C>>>16,z+=j>>>16,f[7]=x=j&65535|z<<16,l[7]=X=N&65535|C<<16,E+=128,m-=128}return E}function o(a){var h=new n;h.update(a);var f=h.digest();return h.clean(),f}t.hash=o})(Xa),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=fr,r=Xa,n=yt;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(T){const A=new Float64Array(16);if(T)for(let O=0;O<T.length;O++)A[O]=T[O];return A}const s=new Uint8Array(32);s[0]=9;const o=i(),a=i([1]),h=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),f=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),l=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),D=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 m(T,A){for(let O=0;O<16;O++)T[O]=A[O]|0}function b(T){let A=1;for(let O=0;O<16;O++){let u=T[O]+A+65535;A=Math.floor(u/65536),T[O]=u-A*65536}T[0]+=A-1+37*(A-1)}function P(T,A,O){const u=~(O-1);for(let v=0;v<16;v++){const q=u&(T[v]^A[v]);T[v]^=q,A[v]^=q}}function R(T,A){const O=i(),u=i();for(let v=0;v<16;v++)u[v]=A[v];b(u),b(u),b(u);for(let v=0;v<2;v++){O[0]=u[0]-65517;for(let W=1;W<15;W++)O[W]=u[W]-65535-(O[W-1]>>16&1),O[W-1]&=65535;O[15]=u[15]-32767-(O[14]>>16&1);const q=O[15]>>16&1;O[14]&=65535,P(u,O,1-q)}for(let v=0;v<16;v++)T[2*v]=u[v]&255,T[2*v+1]=u[v]>>8}function B(T,A){let O=0;for(let u=0;u<32;u++)O|=T[u]^A[u];return(1&O-1>>>8)-1}function S(T,A){const O=new Uint8Array(32),u=new Uint8Array(32);return R(O,T),R(u,A),B(O,u)}function L(T){const A=new Uint8Array(32);return R(A,T),A[0]&1}function y(T,A){for(let O=0;O<16;O++)T[O]=A[2*O]+(A[2*O+1]<<8);T[15]&=32767}function x(T,A,O){for(let u=0;u<16;u++)T[u]=A[u]+O[u]}function w(T,A,O){for(let u=0;u<16;u++)T[u]=A[u]-O[u]}function c(T,A,O){let u,v,q=0,W=0,he=0,_e=0,de=0,me=0,je=0,Pe=0,ye=0,pe=0,le=0,ue=0,ce=0,oe=0,se=0,te=0,fe=0,ge=0,ne=0,ve=0,be=0,Ee=0,De=0,we=0,St=0,Rt=0,Gt=0,_t=0,sr=0,Xr=0,Fn=0,Be=O[0],Fe=O[1],ze=O[2],Ke=O[3],He=O[4],$e=O[5],Ye=O[6],Je=O[7],Xe=O[8],Ze=O[9],Qe=O[10],Ge=O[11],qe=O[12],Re=O[13],et=O[14],tt=O[15];u=A[0],q+=u*Be,W+=u*Fe,he+=u*ze,_e+=u*Ke,de+=u*He,me+=u*$e,je+=u*Ye,Pe+=u*Je,ye+=u*Xe,pe+=u*Ze,le+=u*Qe,ue+=u*Ge,ce+=u*qe,oe+=u*Re,se+=u*et,te+=u*tt,u=A[1],W+=u*Be,he+=u*Fe,_e+=u*ze,de+=u*Ke,me+=u*He,je+=u*$e,Pe+=u*Ye,ye+=u*Je,pe+=u*Xe,le+=u*Ze,ue+=u*Qe,ce+=u*Ge,oe+=u*qe,se+=u*Re,te+=u*et,fe+=u*tt,u=A[2],he+=u*Be,_e+=u*Fe,de+=u*ze,me+=u*Ke,je+=u*He,Pe+=u*$e,ye+=u*Ye,pe+=u*Je,le+=u*Xe,ue+=u*Ze,ce+=u*Qe,oe+=u*Ge,se+=u*qe,te+=u*Re,fe+=u*et,ge+=u*tt,u=A[3],_e+=u*Be,de+=u*Fe,me+=u*ze,je+=u*Ke,Pe+=u*He,ye+=u*$e,pe+=u*Ye,le+=u*Je,ue+=u*Xe,ce+=u*Ze,oe+=u*Qe,se+=u*Ge,te+=u*qe,fe+=u*Re,ge+=u*et,ne+=u*tt,u=A[4],de+=u*Be,me+=u*Fe,je+=u*ze,Pe+=u*Ke,ye+=u*He,pe+=u*$e,le+=u*Ye,ue+=u*Je,ce+=u*Xe,oe+=u*Ze,se+=u*Qe,te+=u*Ge,fe+=u*qe,ge+=u*Re,ne+=u*et,ve+=u*tt,u=A[5],me+=u*Be,je+=u*Fe,Pe+=u*ze,ye+=u*Ke,pe+=u*He,le+=u*$e,ue+=u*Ye,ce+=u*Je,oe+=u*Xe,se+=u*Ze,te+=u*Qe,fe+=u*Ge,ge+=u*qe,ne+=u*Re,ve+=u*et,be+=u*tt,u=A[6],je+=u*Be,Pe+=u*Fe,ye+=u*ze,pe+=u*Ke,le+=u*He,ue+=u*$e,ce+=u*Ye,oe+=u*Je,se+=u*Xe,te+=u*Ze,fe+=u*Qe,ge+=u*Ge,ne+=u*qe,ve+=u*Re,be+=u*et,Ee+=u*tt,u=A[7],Pe+=u*Be,ye+=u*Fe,pe+=u*ze,le+=u*Ke,ue+=u*He,ce+=u*$e,oe+=u*Ye,se+=u*Je,te+=u*Xe,fe+=u*Ze,ge+=u*Qe,ne+=u*Ge,ve+=u*qe,be+=u*Re,Ee+=u*et,De+=u*tt,u=A[8],ye+=u*Be,pe+=u*Fe,le+=u*ze,ue+=u*Ke,ce+=u*He,oe+=u*$e,se+=u*Ye,te+=u*Je,fe+=u*Xe,ge+=u*Ze,ne+=u*Qe,ve+=u*Ge,be+=u*qe,Ee+=u*Re,De+=u*et,we+=u*tt,u=A[9],pe+=u*Be,le+=u*Fe,ue+=u*ze,ce+=u*Ke,oe+=u*He,se+=u*$e,te+=u*Ye,fe+=u*Je,ge+=u*Xe,ne+=u*Ze,ve+=u*Qe,be+=u*Ge,Ee+=u*qe,De+=u*Re,we+=u*et,St+=u*tt,u=A[10],le+=u*Be,ue+=u*Fe,ce+=u*ze,oe+=u*Ke,se+=u*He,te+=u*$e,fe+=u*Ye,ge+=u*Je,ne+=u*Xe,ve+=u*Ze,be+=u*Qe,Ee+=u*Ge,De+=u*qe,we+=u*Re,St+=u*et,Rt+=u*tt,u=A[11],ue+=u*Be,ce+=u*Fe,oe+=u*ze,se+=u*Ke,te+=u*He,fe+=u*$e,ge+=u*Ye,ne+=u*Je,ve+=u*Xe,be+=u*Ze,Ee+=u*Qe,De+=u*Ge,we+=u*qe,St+=u*Re,Rt+=u*et,Gt+=u*tt,u=A[12],ce+=u*Be,oe+=u*Fe,se+=u*ze,te+=u*Ke,fe+=u*He,ge+=u*$e,ne+=u*Ye,ve+=u*Je,be+=u*Xe,Ee+=u*Ze,De+=u*Qe,we+=u*Ge,St+=u*qe,Rt+=u*Re,Gt+=u*et,_t+=u*tt,u=A[13],oe+=u*Be,se+=u*Fe,te+=u*ze,fe+=u*Ke,ge+=u*He,ne+=u*$e,ve+=u*Ye,be+=u*Je,Ee+=u*Xe,De+=u*Ze,we+=u*Qe,St+=u*Ge,Rt+=u*qe,Gt+=u*Re,_t+=u*et,sr+=u*tt,u=A[14],se+=u*Be,te+=u*Fe,fe+=u*ze,ge+=u*Ke,ne+=u*He,ve+=u*$e,be+=u*Ye,Ee+=u*Je,De+=u*Xe,we+=u*Ze,St+=u*Qe,Rt+=u*Ge,Gt+=u*qe,_t+=u*Re,sr+=u*et,Xr+=u*tt,u=A[15],te+=u*Be,fe+=u*Fe,ge+=u*ze,ne+=u*Ke,ve+=u*He,be+=u*$e,Ee+=u*Ye,De+=u*Je,we+=u*Xe,St+=u*Ze,Rt+=u*Qe,Gt+=u*Ge,_t+=u*qe,sr+=u*Re,Xr+=u*et,Fn+=u*tt,q+=38*fe,W+=38*ge,he+=38*ne,_e+=38*ve,de+=38*be,me+=38*Ee,je+=38*De,Pe+=38*we,ye+=38*St,pe+=38*Rt,le+=38*Gt,ue+=38*_t,ce+=38*sr,oe+=38*Xr,se+=38*Fn,v=1,u=q+v+65535,v=Math.floor(u/65536),q=u-v*65536,u=W+v+65535,v=Math.floor(u/65536),W=u-v*65536,u=he+v+65535,v=Math.floor(u/65536),he=u-v*65536,u=_e+v+65535,v=Math.floor(u/65536),_e=u-v*65536,u=de+v+65535,v=Math.floor(u/65536),de=u-v*65536,u=me+v+65535,v=Math.floor(u/65536),me=u-v*65536,u=je+v+65535,v=Math.floor(u/65536),je=u-v*65536,u=Pe+v+65535,v=Math.floor(u/65536),Pe=u-v*65536,u=ye+v+65535,v=Math.floor(u/65536),ye=u-v*65536,u=pe+v+65535,v=Math.floor(u/65536),pe=u-v*65536,u=le+v+65535,v=Math.floor(u/65536),le=u-v*65536,u=ue+v+65535,v=Math.floor(u/65536),ue=u-v*65536,u=ce+v+65535,v=Math.floor(u/65536),ce=u-v*65536,u=oe+v+65535,v=Math.floor(u/65536),oe=u-v*65536,u=se+v+65535,v=Math.floor(u/65536),se=u-v*65536,u=te+v+65535,v=Math.floor(u/65536),te=u-v*65536,q+=v-1+37*(v-1),v=1,u=q+v+65535,v=Math.floor(u/65536),q=u-v*65536,u=W+v+65535,v=Math.floor(u/65536),W=u-v*65536,u=he+v+65535,v=Math.floor(u/65536),he=u-v*65536,u=_e+v+65535,v=Math.floor(u/65536),_e=u-v*65536,u=de+v+65535,v=Math.floor(u/65536),de=u-v*65536,u=me+v+65535,v=Math.floor(u/65536),me=u-v*65536,u=je+v+65535,v=Math.floor(u/65536),je=u-v*65536,u=Pe+v+65535,v=Math.floor(u/65536),Pe=u-v*65536,u=ye+v+65535,v=Math.floor(u/65536),ye=u-v*65536,u=pe+v+65535,v=Math.floor(u/65536),pe=u-v*65536,u=le+v+65535,v=Math.floor(u/65536),le=u-v*65536,u=ue+v+65535,v=Math.floor(u/65536),ue=u-v*65536,u=ce+v+65535,v=Math.floor(u/65536),ce=u-v*65536,u=oe+v+65535,v=Math.floor(u/65536),oe=u-v*65536,u=se+v+65535,v=Math.floor(u/65536),se=u-v*65536,u=te+v+65535,v=Math.floor(u/65536),te=u-v*65536,q+=v-1+37*(v-1),T[0]=q,T[1]=W,T[2]=he,T[3]=_e,T[4]=de,T[5]=me,T[6]=je,T[7]=Pe,T[8]=ye,T[9]=pe,T[10]=le,T[11]=ue,T[12]=ce,T[13]=oe,T[14]=se,T[15]=te}function d(T,A){c(T,A,A)}function U(T,A){const O=i();let u;for(u=0;u<16;u++)O[u]=A[u];for(u=253;u>=0;u--)d(O,O),u!==2&&u!==4&&c(O,O,A);for(u=0;u<16;u++)T[u]=O[u]}function K(T,A){const O=i();let u;for(u=0;u<16;u++)O[u]=A[u];for(u=250;u>=0;u--)d(O,O),u!==1&&c(O,O,A);for(u=0;u<16;u++)T[u]=O[u]}function G(T,A){const O=i(),u=i(),v=i(),q=i(),W=i(),he=i(),_e=i(),de=i(),me=i();w(O,T[1],T[0]),w(me,A[1],A[0]),c(O,O,me),x(u,T[0],T[1]),x(me,A[0],A[1]),c(u,u,me),c(v,T[3],A[3]),c(v,v,f),c(q,T[2],A[2]),x(q,q,q),w(W,u,O),w(he,q,v),x(_e,q,v),x(de,u,O),c(T[0],W,he),c(T[1],de,_e),c(T[2],_e,he),c(T[3],W,de)}function J(T,A,O){for(let u=0;u<4;u++)P(T[u],A[u],O)}function X(T,A){const O=i(),u=i(),v=i();U(v,A[2]),c(O,A[0],v),c(u,A[1],v),R(T,u),T[31]^=L(O)<<7}function g(T,A,O){m(T[0],o),m(T[1],a),m(T[2],a),m(T[3],o);for(let u=255;u>=0;--u){const v=O[u/8|0]>>(u&7)&1;J(T,A,v),G(A,T),G(T,T),J(T,A,v)}}function _(T,A){const O=[i(),i(),i(),i()];m(O[0],l),m(O[1],D),m(O[2],a),c(O[3],l,D),g(T,O,A)}function $(T){if(T.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const A=(0,r.hash)(T);A[0]&=248,A[31]&=127,A[31]|=64;const O=new Uint8Array(32),u=[i(),i(),i(),i()];_(u,A),X(O,u);const v=new Uint8Array(64);return v.set(T),v.set(O,32),{publicKey:O,secretKey:v}}t.generateKeyPairFromSeed=$;function M(T){const A=(0,e.randomBytes)(32,T),O=$(A);return(0,n.wipe)(A),O}t.generateKeyPair=M;function N(T){if(T.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(T.subarray(32))}t.extractPublicKeyFromSecretKey=N;const C=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function j(T,A){let O,u,v,q;for(u=63;u>=32;--u){for(O=0,v=u-32,q=u-12;v<q;++v)A[v]+=O-16*A[u]*C[v-(u-32)],O=Math.floor((A[v]+128)/256),A[v]-=O*256;A[v]+=O,A[u]=0}for(O=0,v=0;v<32;v++)A[v]+=O-(A[31]>>4)*C[v],O=A[v]>>8,A[v]&=255;for(v=0;v<32;v++)A[v]-=O*C[v];for(u=0;u<32;u++)A[u+1]+=A[u]>>8,T[u]=A[u]&255}function z(T){const A=new Float64Array(64);for(let O=0;O<64;O++)A[O]=T[O];for(let O=0;O<64;O++)T[O]=0;j(T,A)}function Q(T,A){const O=new Float64Array(64),u=[i(),i(),i(),i()],v=(0,r.hash)(T.subarray(0,32));v[0]&=248,v[31]&=127,v[31]|=64;const q=new Uint8Array(64);q.set(v.subarray(32),32);const W=new r.SHA512;W.update(q.subarray(32)),W.update(A);const he=W.digest();W.clean(),z(he),_(u,he),X(q,u),W.reset(),W.update(q.subarray(0,32)),W.update(T.subarray(32)),W.update(A);const _e=W.digest();z(_e);for(let de=0;de<32;de++)O[de]=he[de];for(let de=0;de<32;de++)for(let me=0;me<32;me++)O[de+me]+=_e[de]*v[me];return j(q.subarray(32),O),q}t.sign=Q;function H(T,A){const O=i(),u=i(),v=i(),q=i(),W=i(),he=i(),_e=i();return m(T[2],a),y(T[1],A),d(v,T[1]),c(q,v,h),w(v,v,T[2]),x(q,T[2],q),d(W,q),d(he,W),c(_e,he,W),c(O,_e,v),c(O,O,q),K(O,O),c(O,O,v),c(O,O,q),c(O,O,q),c(T[0],O,q),d(u,T[0]),c(u,u,q),S(u,v)&&c(T[0],T[0],E),d(u,T[0]),c(u,u,q),S(u,v)?-1:(L(T[0])===A[31]>>7&&w(T[0],o,T[0]),c(T[3],T[0],T[1]),0)}function ee(T,A,O){const u=new Uint8Array(32),v=[i(),i(),i(),i()],q=[i(),i(),i(),i()];if(O.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(H(q,T))return!1;const W=new r.SHA512;W.update(O.subarray(0,32)),W.update(T),W.update(A);const he=W.digest();return z(he),g(v,q,he),_(q,O.subarray(32)),G(v,q),X(u,v),!B(O,u)}t.verify=ee;function Y(T){let A=[i(),i(),i(),i()];if(H(A,T))throw new Error("Ed25519: invalid public key");let O=i(),u=i(),v=A[1];x(O,a,v),w(u,a,v),U(u,u),c(O,O,u);let q=new Uint8Array(32);return R(q,O),q}t.convertPublicKeyToX25519=Y;function ae(T){const A=(0,r.hash)(T.subarray(0,32));A[0]&=248,A[31]&=127,A[31]|=64;const O=new Uint8Array(A.subarray(0,32));return(0,n.wipe)(A),O}t.convertSecretKeyToX25519=ae}(Wi);const By="EdDSA",zy="JWT",Za=".",Qa="base64url",Ky="utf8",Hy="utf8",qy=":",Vy="did",Gy="key",ec="base58btc",Wy="z",ky="K36",Yy=32;function Sn(t){return lt(ht(Ir(t),Ky),Qa)}function tc(t){const e=ht(ky,ec),r=Wy+lt(oi([e,t]),ec);return[Vy,Gy,r].join(qy)}function Jy(t){return lt(t,Qa)}function Xy(t){return ht([Sn(t.header),Sn(t.payload)].join(Za),Hy)}function Zy(t){return[Sn(t.header),Sn(t.payload),Jy(t.signature)].join(Za)}function rc(t=fr.randomBytes(Yy)){return Wi.generateKeyPairFromSeed(t)}async function Qy(t,e,r,n,i=Z.fromMiliseconds(Date.now())){const s={alg:By,typ:zy},o=tc(n.publicKey),a=i+r,h={iss:o,sub:t,aud:e,iat:i,exp:a},f=Xy({header:s,payload:h}),l=Wi.sign(n.secretKey,f);return Zy({header:s,payload:h,signature:l})}const nc=10,e0=(()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:require("ws"))();class t0{constructor(e){if(this.url=e,this.events=new rn.EventEmitter,this.registering=!1,!As(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(){if(typeof this.socket>"u")throw new Error("Connection already closed");this.socket.close(),this.onClose()}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Ir(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!As(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=Es.isReactNative()?void 0:{rejectUnauthorized:!df(e)},s=new e0(e,[],i);s.onopen=()=>{this.onOpen(s),r(s)},s.onerror=o=>{const a=o,h=this.parseError(a.error||new Error(`WebSocket connection failed for URL: ${e}`));this.events.emit("register_error",h),this.onClose(),n(h)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=()=>this.onClose(),e.onerror=r=>{const n=r,i=this.parseError(n.error||new Error(`WebSocket connection failed for URL: ${this.url}`));this.events.emit("error",i)},this.socket=e,this.registering=!1,this.events.emit("open")}onClose(){this.socket=void 0,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?Xn(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Or(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return ws(e,r,"WS")}resetMaxListeners(){this.events.getMaxListeners()>nc&&this.events.setMaxListeners(nc)}}var ki={exports:{}};(function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",h="[object Array]",f="[object AsyncFunction]",l="[object Boolean]",D="[object Date]",E="[object Error]",m="[object Function]",b="[object GeneratorFunction]",P="[object Map]",R="[object Number]",B="[object Null]",S="[object Object]",L="[object Promise]",y="[object Proxy]",x="[object RegExp]",w="[object Set]",c="[object String]",d="[object Symbol]",U="[object Undefined]",K="[object WeakMap]",G="[object ArrayBuffer]",J="[object DataView]",X="[object Float32Array]",g="[object Float64Array]",_="[object Int8Array]",$="[object Int16Array]",M="[object Int32Array]",N="[object Uint8Array]",C="[object Uint8ClampedArray]",j="[object Uint16Array]",z="[object Uint32Array]",Q=/[\\^$.*+?()[\]{}|]/g,H=/^\[object .+?Constructor\]$/,ee=/^(?:0|[1-9]\d*)$/,Y={};Y[X]=Y[g]=Y[_]=Y[$]=Y[M]=Y[N]=Y[C]=Y[j]=Y[z]=!0,Y[a]=Y[h]=Y[G]=Y[l]=Y[J]=Y[D]=Y[E]=Y[m]=Y[P]=Y[R]=Y[S]=Y[x]=Y[w]=Y[c]=Y[K]=!1;var ae=typeof We=="object"&&We&&We.Object===Object&&We,T=typeof self=="object"&&self&&self.Object===Object&&self,A=ae||T||Function("return this")(),O=e&&!e.nodeType&&e,u=O&&!0&&t&&!t.nodeType&&t,v=u&&u.exports===O,q=v&&ae.process,W=function(){try{return q&&q.binding&&q.binding("util")}catch{}}(),he=W&&W.isTypedArray;function _e(p,I){for(var F=-1,k=p==null?0:p.length,Ce=0,ie=[];++F<k;){var Me=p[F];I(Me,F,p)&&(ie[Ce++]=Me)}return ie}function de(p,I){for(var F=-1,k=I.length,Ce=p.length;++F<k;)p[Ce+F]=I[F];return p}function me(p,I){for(var F=-1,k=p==null?0:p.length;++F<k;)if(I(p[F],F,p))return!0;return!1}function je(p,I){for(var F=-1,k=Array(p);++F<p;)k[F]=I(F);return k}function Pe(p){return function(I){return p(I)}}function ye(p,I){return p.has(I)}function pe(p,I){return p?.[I]}function le(p){var I=-1,F=Array(p.size);return p.forEach(function(k,Ce){F[++I]=[Ce,k]}),F}function ue(p,I){return function(F){return p(I(F))}}function ce(p){var I=-1,F=Array(p.size);return p.forEach(function(k){F[++I]=k}),F}var oe=Array.prototype,se=Function.prototype,te=Object.prototype,fe=A["__core-js_shared__"],ge=se.toString,ne=te.hasOwnProperty,ve=function(){var p=/[^.]+$/.exec(fe&&fe.keys&&fe.keys.IE_PROTO||"");return p?"Symbol(src)_1."+p:""}(),be=te.toString,Ee=RegExp("^"+ge.call(ne).replace(Q,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),De=v?A.Buffer:void 0,we=A.Symbol,St=A.Uint8Array,Rt=te.propertyIsEnumerable,Gt=oe.splice,_t=we?we.toStringTag:void 0,sr=Object.getOwnPropertySymbols,Xr=De?De.isBuffer:void 0,Fn=ue(Object.keys,Object),Be=Er(A,"DataView"),Fe=Er(A,"Map"),ze=Er(A,"Promise"),Ke=Er(A,"Set"),He=Er(A,"WeakMap"),$e=Er(Object,"create"),Ye=ar(Be),Je=ar(Fe),Xe=ar(ze),Ze=ar(Ke),Qe=ar(He),Ge=we?we.prototype:void 0,qe=Ge?Ge.valueOf:void 0;function Re(p){var I=-1,F=p==null?0:p.length;for(this.clear();++I<F;){var k=p[I];this.set(k[0],k[1])}}function et(){this.__data__=$e?$e(null):{},this.size=0}function tt(p){var I=this.has(p)&&delete this.__data__[p];return this.size-=I?1:0,I}function t1(p){var I=this.__data__;if($e){var F=I[p];return F===n?void 0:F}return ne.call(I,p)?I[p]:void 0}function r1(p){var I=this.__data__;return $e?I[p]!==void 0:ne.call(I,p)}function n1(p,I){var F=this.__data__;return this.size+=this.has(p)?0:1,F[p]=$e&&I===void 0?n:I,this}Re.prototype.clear=et,Re.prototype.delete=tt,Re.prototype.get=t1,Re.prototype.has=r1,Re.prototype.set=n1;function Bt(p){var I=-1,F=p==null?0:p.length;for(this.clear();++I<F;){var k=p[I];this.set(k[0],k[1])}}function i1(){this.__data__=[],this.size=0}function s1(p){var I=this.__data__,F=Mn(I,p);if(F<0)return!1;var k=I.length-1;return F==k?I.pop():Gt.call(I,F,1),--this.size,!0}function o1(p){var I=this.__data__,F=Mn(I,p);return F<0?void 0:I[F][1]}function a1(p){return Mn(this.__data__,p)>-1}function c1(p,I){var F=this.__data__,k=Mn(F,p);return k<0?(++this.size,F.push([p,I])):F[k][1]=I,this}Bt.prototype.clear=i1,Bt.prototype.delete=s1,Bt.prototype.get=o1,Bt.prototype.has=a1,Bt.prototype.set=c1;function or(p){var I=-1,F=p==null?0:p.length;for(this.clear();++I<F;){var k=p[I];this.set(k[0],k[1])}}function u1(){this.size=0,this.__data__={hash:new Re,map:new(Fe||Bt),string:new Re}}function f1(p){var I=Un(this,p).delete(p);return this.size-=I?1:0,I}function h1(p){return Un(this,p).get(p)}function l1(p){return Un(this,p).has(p)}function d1(p,I){var F=Un(this,p),k=F.size;return F.set(p,I),this.size+=F.size==k?0:1,this}or.prototype.clear=u1,or.prototype.delete=f1,or.prototype.get=h1,or.prototype.has=l1,or.prototype.set=d1;function $n(p){var I=-1,F=p==null?0:p.length;for(this.__data__=new or;++I<F;)this.add(p[I])}function p1(p){return this.__data__.set(p,n),this}function g1(p){return this.__data__.has(p)}$n.prototype.add=$n.prototype.push=p1,$n.prototype.has=g1;function Wt(p){var I=this.__data__=new Bt(p);this.size=I.size}function y1(){this.__data__=new Bt,this.size=0}function _1(p){var I=this.__data__,F=I.delete(p);return this.size=I.size,F}function v1(p){return this.__data__.get(p)}function b1(p){return this.__data__.has(p)}function m1(p,I){var F=this.__data__;if(F instanceof Bt){var k=F.__data__;if(!Fe||k.length<r-1)return k.push([p,I]),this.size=++F.size,this;F=this.__data__=new or(k)}return F.set(p,I),this.size=F.size,this}Wt.prototype.clear=y1,Wt.prototype.delete=_1,Wt.prototype.get=v1,Wt.prototype.has=b1,Wt.prototype.set=m1;function w1(p,I){var F=jn(p),k=!F&&$1(p),Ce=!F&&!k&&os(p),ie=!F&&!k&&!Ce&&vu(p),Me=F||k||Ce||ie,rt=Me?je(p.length,String):[],ot=rt.length;for(var Ne in p)(I||ne.call(p,Ne))&&!(Me&&(Ne=="length"||Ce&&(Ne=="offset"||Ne=="parent")||ie&&(Ne=="buffer"||Ne=="byteLength"||Ne=="byteOffset")||C1(Ne,ot)))&&rt.push(Ne);return rt}function Mn(p,I){for(var F=p.length;F--;)if(pu(p[F][0],I))return F;return-1}function E1(p,I,F){var k=I(p);return jn(p)?k:de(k,F(p))}function Zr(p){return p==null?p===void 0?U:B:_t&&_t in Object(p)?A1(p):F1(p)}function fu(p){return Qr(p)&&Zr(p)==a}function hu(p,I,F,k,Ce){return p===I?!0:p==null||I==null||!Qr(p)&&!Qr(I)?p!==p&&I!==I:D1(p,I,F,k,hu,Ce)}function D1(p,I,F,k,Ce,ie){var Me=jn(p),rt=jn(I),ot=Me?h:kt(p),Ne=rt?h:kt(I);ot=ot==a?S:ot,Ne=Ne==a?S:Ne;var vt=ot==S,Ot=Ne==S,ct=ot==Ne;if(ct&&os(p)){if(!os(I))return!1;Me=!0,vt=!1}if(ct&&!vt)return ie||(ie=new Wt),Me||vu(p)?lu(p,I,F,k,Ce,ie):I1(p,I,ot,F,k,Ce,ie);if(!(F&i)){var wt=vt&&ne.call(p,"__wrapped__"),Et=Ot&&ne.call(I,"__wrapped__");if(wt||Et){var Yt=wt?p.value():p,zt=Et?I.value():I;return ie||(ie=new Wt),Ce(Yt,zt,F,k,ie)}}return ct?(ie||(ie=new Wt),L1(p,I,F,k,Ce,ie)):!1}function x1(p){if(!_u(p)||N1(p))return!1;var I=gu(p)?Ee:H;return I.test(ar(p))}function S1(p){return Qr(p)&&yu(p.length)&&!!Y[Zr(p)]}function O1(p){if(!P1(p))return Fn(p);var I=[];for(var F in Object(p))ne.call(p,F)&&F!="constructor"&&I.push(F);return I}function lu(p,I,F,k,Ce,ie){var Me=F&i,rt=p.length,ot=I.length;if(rt!=ot&&!(Me&&ot>rt))return!1;var Ne=ie.get(p);if(Ne&&ie.get(I))return Ne==I;var vt=-1,Ot=!0,ct=F&s?new $n:void 0;for(ie.set(p,I),ie.set(I,p);++vt<rt;){var wt=p[vt],Et=I[vt];if(k)var Yt=Me?k(Et,wt,vt,I,p,ie):k(wt,Et,vt,p,I,ie);if(Yt!==void 0){if(Yt)continue;Ot=!1;break}if(ct){if(!me(I,function(zt,cr){if(!ye(ct,cr)&&(wt===zt||Ce(wt,zt,F,k,ie)))return ct.push(cr)})){Ot=!1;break}}else if(!(wt===Et||Ce(wt,Et,F,k,ie))){Ot=!1;break}}return ie.delete(p),ie.delete(I),Ot}function I1(p,I,F,k,Ce,ie,Me){switch(F){case J:if(p.byteLength!=I.byteLength||p.byteOffset!=I.byteOffset)return!1;p=p.buffer,I=I.buffer;case G:return!(p.byteLength!=I.byteLength||!ie(new St(p),new St(I)));case l:case D:case R:return pu(+p,+I);case E:return p.name==I.name&&p.message==I.message;case x:case c:return p==I+"";case P:var rt=le;case w:var ot=k&i;if(rt||(rt=ce),p.size!=I.size&&!ot)return!1;var Ne=Me.get(p);if(Ne)return Ne==I;k|=s,Me.set(p,I);var vt=lu(rt(p),rt(I),k,Ce,ie,Me);return Me.delete(p),vt;case d:if(qe)return qe.call(p)==qe.call(I)}return!1}function L1(p,I,F,k,Ce,ie){var Me=F&i,rt=du(p),ot=rt.length,Ne=du(I),vt=Ne.length;if(ot!=vt&&!Me)return!1;for(var Ot=ot;Ot--;){var ct=rt[Ot];if(!(Me?ct in I:ne.call(I,ct)))return!1}var wt=ie.get(p);if(wt&&ie.get(I))return wt==I;var Et=!0;ie.set(p,I),ie.set(I,p);for(var Yt=Me;++Ot<ot;){ct=rt[Ot];var zt=p[ct],cr=I[ct];if(k)var bu=Me?k(cr,zt,ct,I,p,ie):k(zt,cr,ct,p,I,ie);if(!(bu===void 0?zt===cr||Ce(zt,cr,F,k,ie):bu)){Et=!1;break}Yt||(Yt=ct=="constructor")}if(Et&&!Yt){var Bn=p.constructor,zn=I.constructor;Bn!=zn&&"constructor"in p&&"constructor"in I&&!(typeof Bn=="function"&&Bn instanceof Bn&&typeof zn=="function"&&zn instanceof zn)&&(Et=!1)}return ie.delete(p),ie.delete(I),Et}function du(p){return E1(p,j1,T1)}function Un(p,I){var F=p.__data__;return R1(I)?F[typeof I=="string"?"string":"hash"]:F.map}function Er(p,I){var F=pe(p,I);return x1(F)?F:void 0}function A1(p){var I=ne.call(p,_t),F=p[_t];try{p[_t]=void 0;var k=!0}catch{}var Ce=be.call(p);return k&&(I?p[_t]=F:delete p[_t]),Ce}var T1=sr?function(p){return p==null?[]:(p=Object(p),_e(sr(p),function(I){return Rt.call(p,I)}))}:B1,kt=Zr;(Be&&kt(new Be(new ArrayBuffer(1)))!=J||Fe&&kt(new Fe)!=P||ze&&kt(ze.resolve())!=L||Ke&&kt(new Ke)!=w||He&&kt(new He)!=K)&&(kt=function(p){var I=Zr(p),F=I==S?p.constructor:void 0,k=F?ar(F):"";if(k)switch(k){case Ye:return J;case Je:return P;case Xe:return L;case Ze:return w;case Qe:return K}return I});function C1(p,I){return I=I??o,!!I&&(typeof p=="number"||ee.test(p))&&p>-1&&p%1==0&&p<I}function R1(p){var I=typeof p;return I=="string"||I=="number"||I=="symbol"||I=="boolean"?p!=="__proto__":p===null}function N1(p){return!!ve&&ve in p}function P1(p){var I=p&&p.constructor,F=typeof I=="function"&&I.prototype||te;return p===F}function F1(p){return be.call(p)}function ar(p){if(p!=null){try{return ge.call(p)}catch{}try{return p+""}catch{}}return""}function pu(p,I){return p===I||p!==p&&I!==I}var $1=fu(function(){return arguments}())?fu:function(p){return Qr(p)&&ne.call(p,"callee")&&!Rt.call(p,"callee")},jn=Array.isArray;function M1(p){return p!=null&&yu(p.length)&&!gu(p)}var os=Xr||z1;function U1(p,I){return hu(p,I)}function gu(p){if(!_u(p))return!1;var I=Zr(p);return I==m||I==b||I==f||I==y}function yu(p){return typeof p=="number"&&p>-1&&p%1==0&&p<=o}function _u(p){var I=typeof p;return p!=null&&(I=="object"||I=="function")}function Qr(p){return p!=null&&typeof p=="object"}var vu=he?Pe(he):S1;function j1(p){return M1(p)?w1(p):O1(p)}function B1(){return[]}function z1(){return!1}t.exports=U1})(ki,ki.exports);var r0=ki.exports,n0=Object.defineProperty,ic=Object.getOwnPropertySymbols,i0=Object.prototype.hasOwnProperty,s0=Object.prototype.propertyIsEnumerable,sc=(t,e,r)=>e in t?n0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ft=(t,e)=>{for(var r in e||(e={}))i0.call(e,r)&&sc(t,r,e[r]);if(ic)for(var r of ic(e))s0.call(e,r)&&sc(t,r,e[r]);return t};function o0(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),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=i}var a=t.length,h=t.charAt(0),f=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function D(b){if(b instanceof Uint8Array||(ArrayBuffer.isView(b)?b=new Uint8Array(b.buffer,b.byteOffset,b.byteLength):Array.isArray(b)&&(b=Uint8Array.from(b))),!(b instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(b.length===0)return"";for(var P=0,R=0,B=0,S=b.length;B!==S&&b[B]===0;)B++,P++;for(var L=(S-B)*l+1>>>0,y=new Uint8Array(L);B!==S;){for(var x=b[B],w=0,c=L-1;(x!==0||w<R)&&c!==-1;c--,w++)x+=256*y[c]>>>0,y[c]=x%a>>>0,x=x/a>>>0;if(x!==0)throw new Error("Non-zero carry");R=w,B++}for(var d=L-R;d!==L&&y[d]===0;)d++;for(var U=h.repeat(P);d<L;++d)U+=t.charAt(y[d]);return U}function E(b){if(typeof b!="string")throw new TypeError("Expected String");if(b.length===0)return new Uint8Array;var P=0;if(b[P]!==" "){for(var R=0,B=0;b[P]===h;)R++,P++;for(var S=(b.length-P)*f+1>>>0,L=new Uint8Array(S);b[P];){var y=r[b.charCodeAt(P)];if(y===255)return;for(var x=0,w=S-1;(y!==0||x<B)&&w!==-1;w--,x++)y+=a*L[w]>>>0,L[w]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");B=x,P++}if(b[P]!==" "){for(var c=S-B;c!==S&&L[c]===0;)c++;for(var d=new Uint8Array(R+(S-c)),U=R;c!==S;)d[U++]=L[c++];return d}}}function m(b){var P=E(b);if(P)return P;throw new Error(`Non-${e} character`)}return{encode:D,decodeUnsafe:E,decode:m}}var a0=o0,c0=a0;const oc=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")},u0=t=>new TextEncoder().encode(t),f0=t=>new TextDecoder().decode(t);class h0{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 l0{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 ac(this,e)}}class d0{constructor(e){this.decoders=e}or(e){return ac(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 ac=(t,e)=>new d0(ft(ft({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class p0{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new h0(e,r,n),this.decoder=new l0(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const On=({name:t,prefix:e,encode:r,decode:n})=>new p0(t,e,r,n),Yr=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=c0(r,e);return On({prefix:t,name:e,encode:n,decode:s=>oc(i(s))})},g0=(t,e,r,n)=>{const i={};for(let l=0;l<e.length;++l)i[e[l]]=l;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let a=0,h=0,f=0;for(let l=0;l<s;++l){const D=i[t[l]];if(D===void 0)throw new SyntaxError(`Non-${n} character`);h=h<<r|D,a+=r,a>=8&&(a-=8,o[f++]=255&h>>a)}if(a>=r||255&h<<8-a)throw new SyntaxError("Unexpected end of data");return o},y0=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let s="",o=0,a=0;for(let h=0;h<t.length;++h)for(a=a<<8|t[h],o+=8;o>r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s},st=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>On({prefix:e,name:t,encode(i){return y0(i,n,r)},decode(i){return g0(i,n,r,t)}}),_0=On({prefix:"\0",name:"identity",encode:t=>f0(t),decode:t=>u0(t)});var v0=Object.freeze({__proto__:null,identity:_0});const b0=st({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var m0=Object.freeze({__proto__:null,base2:b0});const w0=st({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var E0=Object.freeze({__proto__:null,base8:w0});const D0=Yr({prefix:"9",name:"base10",alphabet:"0123456789"});var x0=Object.freeze({__proto__:null,base10:D0});const S0=st({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),O0=st({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var I0=Object.freeze({__proto__:null,base16:S0,base16upper:O0});const L0=st({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),A0=st({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),T0=st({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),C0=st({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),R0=st({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),N0=st({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),P0=st({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),F0=st({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),$0=st({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var M0=Object.freeze({__proto__:null,base32:L0,base32upper:A0,base32pad:T0,base32padupper:C0,base32hex:R0,base32hexupper:N0,base32hexpad:P0,base32hexpadupper:F0,base32z:$0});const U0=Yr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),j0=Yr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var B0=Object.freeze({__proto__:null,base36:U0,base36upper:j0});const z0=Yr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),K0=Yr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var H0=Object.freeze({__proto__:null,base58btc:z0,base58flickr:K0});const q0=st({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),V0=st({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),G0=st({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),W0=st({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var k0=Object.freeze({__proto__:null,base64:q0,base64pad:V0,base64url:G0,base64urlpad:W0});const cc=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}"),Y0=cc.reduce((t,e,r)=>(t[r]=e,t),[]),J0=cc.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function X0(t){return t.reduce((e,r)=>(e+=Y0[r],e),"")}function Z0(t){const e=[];for(const r of t){const n=J0[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const Q0=On({prefix:"\u{1F680}",name:"base256emoji",encode:X0,decode:Z0});var e_=Object.freeze({__proto__:null,base256emoji:Q0}),t_=fc,uc=128,r_=127,n_=~r_,i_=Math.pow(2,31);function fc(t,e,r){e=e||[],r=r||0;for(var n=r;t>=i_;)e[r++]=t&255|uc,t/=128;for(;t&n_;)e[r++]=t&255|uc,t>>>=7;return e[r]=t|0,fc.bytes=r-n+1,e}var s_=Yi,o_=128,hc=127;function Yi(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw Yi.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&hc)<<i:(o&hc)*Math.pow(2,i),i+=7}while(o>=o_);return Yi.bytes=s-n,r}var a_=Math.pow(2,7),c_=Math.pow(2,14),u_=Math.pow(2,21),f_=Math.pow(2,28),h_=Math.pow(2,35),l_=Math.pow(2,42),d_=Math.pow(2,49),p_=Math.pow(2,56),g_=Math.pow(2,63),y_=function(t){return t<a_?1:t<c_?2:t<u_?3:t<f_?4:t<h_?5:t<l_?6:t<d_?7:t<p_?8:t<g_?9:10},__={encode:t_,decode:s_,encodingLength:y_},lc=__;const dc=(t,e,r=0)=>(lc.encode(t,e,r),e),pc=t=>lc.encodingLength(t),Ji=(t,e)=>{const r=e.byteLength,n=pc(t),i=n+pc(r),s=new Uint8Array(i+r);return dc(t,s,0),dc(r,s,n),s.set(e,i),new v_(t,r,e,s)};class v_{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const gc=({name:t,code:e,encode:r})=>new b_(t,e,r);class b_{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?Ji(this.code,r):r.then(n=>Ji(this.code,n))}else throw Error("Unknown type, must be binary type")}}const yc=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),m_=gc({name:"sha2-256",code:18,encode:yc("SHA-256")}),w_=gc({name:"sha2-512",code:19,encode:yc("SHA-512")});var E_=Object.freeze({__proto__:null,sha256:m_,sha512:w_});const _c=0,D_="identity",vc=oc;var x_=Object.freeze({__proto__:null,identity:{code:_c,name:D_,encode:vc,digest:t=>Ji(_c,vc(t))}});new TextEncoder,new TextDecoder;const bc=ft(ft(ft(ft(ft(ft(ft(ft(ft(ft({},v0),m0),E0),x0),I0),M0),B0),H0),k0),e_);ft(ft({},E_),x_);function S_(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function mc(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const wc=mc("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Xi=mc("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=S_(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),O_=ft({utf8:wc,"utf-8":wc,hex:bc.base16,latin1:Xi,ascii:Xi,binary:Xi},bc);function I_(t,e="utf8"){const r=O_[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,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}const Ec="wc",L_=2,Zi="core",qt=`${Ec}@${2}:${Zi}:`,A_={name:Zi,logger:"error"},T_={database:":memory:"},C_="crypto",Dc="client_ed25519_seed",R_=Z.ONE_DAY,N_="keychain",P_="0.3",F_="messages",$_="0.3",M_=Z.SIX_HOURS,U_="publisher",xc="irn",j_="error",B_="wss://relay.walletconnect.com",z_="relayer",vr={message:"relayer_message",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error"},K_="_subscription",br={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},H_=Z.ONE_SECOND,q_="2.1.3",V_="0.3",jt={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},G_="subscription",W_="0.3",k_=Z.FIVE_SECONDS*1e3,Y_="pairing",J_="0.3",Jr={wc_pairingDelete:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:0},res:{ttl:Z.ONE_DAY,prompt:!1,tag:0}}},Tt={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},X_="history",Z_="0.3",Q_="expirer",mt={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},ev="0.3";class tv{constructor(e,r){this.core=e,this.logger=r,this.keychain=new Map,this.name=N_,this.version=P_,this.initialized=!1,this.storagePrefix=qt,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}=V("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=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Vo(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Go(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class rv{constructor(e,r,n){this.core=e,this.logger=r,this.name=C_,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=rc(i);return tc(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=$d();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=rc(s),a=Oi();return await Qy(a,i,R_,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),h=Md(a,s);return this.setSymKey(h,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||Ud(i);return await this.keychain.set(o,i),o},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,o)=>{this.isInitialized();const a=jo(o),h=Ir(s);if(Bo(a)){const E=a.senderPublicKey,m=a.receiverPublicKey;i=await this.generateSharedKey(E,m)}const f=this.getSymKey(i),{type:l,senderPublicKey:D}=a;return Bd({type:l,symKey:f,message:h,senderPublicKey:D})},this.decode=async(i,s,o)=>{this.isInitialized();const a=Hd(s,o);if(Bo(a)){const l=a.receiverPublicKey,D=a.senderPublicKey;i=await this.generateSharedKey(l,D)}const h=this.getSymKey(i),f=zd({symKey:h,encoded:s});return Xn(f)},this.core=e,this.logger=Oe.generateChildLogger(r,this.name),this.keychain=n||new tv(this.core,this.logger)}get context(){return Oe.getLoggerContext(this.logger)}getPayloadType(e){const r=Ii(e);return Pr(r.type)}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(Dc)}catch{e=Oi(),await this.keychain.set(Dc,e)}return I_(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class nv extends Ry{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=F_,this.version=$_,this.initialized=!1,this.storagePrefix=qt,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=gn(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),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),o=gn(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Oe.generateChildLogger(e,this.name),this.core=r}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Vo(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Go(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class iv extends Ny{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new Ut.exports.EventEmitter,this.name=U_,this.queue=new Map,this.publish=async(n,i,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{const o=s?.ttl||M_,a=Li(s),h=s?.prompt||!1,f=s?.tag||0,l={topic:n,message:i,opts:{ttl:o,relay:a,prompt:h,tag:f}},D=gn(i);this.queue.set(D,l),await this.rpcPublish(n,i,o,a,h,f),this.onPublish(D,l),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},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=Oe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Oe.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o){var a,h,f,l;const D={method:Ai(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o}};return bt((a=D.params)==null?void 0:a.prompt)&&((h=D.params)==null||delete h.prompt),bt((f=D.params)==null?void 0:f.tag)&&((l=D.params)==null||delete l.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:D}),this.relayer.provider.request(D)}onPublish(e,r){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:n,opts:{ttl:i,relay:s,prompt:o,tag:a}}=e,h=gn(n);await this.rpcPublish(r,n,i,s,o,a),this.onPublish(h,e)})}registerEventListeners(){this.relayer.core.heartbeat.on(qr.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}}class sv{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 ov=Object.defineProperty,av=Object.defineProperties,cv=Object.getOwnPropertyDescriptors,Sc=Object.getOwnPropertySymbols,uv=Object.prototype.hasOwnProperty,fv=Object.prototype.propertyIsEnumerable,Oc=(t,e,r)=>e in t?ov(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,In=(t,e)=>{for(var r in e||(e={}))uv.call(e,r)&&Oc(t,r,e[r]);if(Sc)for(var r of Sc(e))fv.call(e,r)&&Oc(t,r,e[r]);return t},Qi=(t,e)=>av(t,cv(e));class hv extends $y{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new sv,this.events=new Ut.exports.EventEmitter,this.name=G_,this.version=W_,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pendingSubInterval=20,this.storagePrefix=qt,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable())},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=Li(i),o={topic:n,relay:s};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{const o=new Z.Watch;o.start(this.pendingSubscriptionWatchLabel);const a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),i(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=k_&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pendingSubInterval)}),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.restart=async()=>{await this.restore(),await this.reset()},this.relayer=e,this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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(),this.initialized=!1}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=Li(n);await this.rpcUnsubscribe(e,r,i);const s=Ve("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:Ai(r.protocol).subscribe,params:{topic:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),await this.relayer.provider.request(n)}rpcUnsubscribe(e,r,n){const i={method:Ai(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.provider.request(i)}onSubscribe(e,r){this.setSubscription(e,Qi(In({},r),{id:e})),this.pending.delete(r.topic)}onResubscribe(e,r){this.addSubscription(e,Qi(In({},r),{id:e})),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.subscriptions.has(e)||(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,In({},r)),this.topicMap.set(r.topic,e),this.events.emit(jt.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}=V("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(jt.deleted,Qi(In({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(jt.sync)}async reset(){this.cached.length&&await Promise.all(this.cached.map(async e=>await this.resubscribe(e))),this.events.emit(jt.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=V("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),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 resubscribe(e){if(!this.ids.includes(e.id)){const{topic:r,relay:n}=e,i={topic:r,relay:n};this.pending.set(i.topic,i);const s=await this.rpcSubscribe(i.topic,i.relay);this.onResubscribe(s,i)}}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}checkPending(){this.relayer.transportExplicitlyClosed||this.pending.forEach(async e=>{const r=await this.rpcSubscribe(e.topic,e.relay);this.onSubscribe(r,e)})}registerEventListeners(){this.relayer.core.heartbeat.on(qr.HEARTBEAT_EVENTS.pulse,()=>{this.checkPending()}),this.relayer.provider.on(br.connect,async()=>{await this.onConnect()}),this.relayer.provider.on(br.disconnect,()=>{this.onDisconnect()}),this.events.on(jt.created,async e=>{const r=jt.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(jt.deleted,async e=>{const r=jt.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}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}var lv=Object.defineProperty,Ic=Object.getOwnPropertySymbols,dv=Object.prototype.hasOwnProperty,pv=Object.prototype.propertyIsEnumerable,Lc=(t,e,r)=>e in t?lv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gv=(t,e)=>{for(var r in e||(e={}))dv.call(e,r)&&Lc(t,r,e[r]);if(Ic)for(var r of Ic(e))pv.call(e,r)&&Lc(t,r,e[r]);return t};class yv extends Py{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new Ut.exports.EventEmitter,this.name=z_,this.transportExplicitlyClosed=!1,this.initialized=!1,this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Oe.generateChildLogger(e.logger,this.name):yn(Oe.getDefaultLoggerOptions({level:e.logger||j_})),this.messages=new nv(this.logger,e.core),this.subscriber=new hv(this,this.logger),this.publisher=new iv(this,this.logger),this.relayUrl=e?.relayUrl||B_,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.provider=await this.createProvider(),await Promise.all([this.messages.init(),this.provider.connect(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return Oe.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r})}async subscribe(e,r){return this.isInitialized(),await this.subscriber.subscribe(e,r)}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 transportClose(){this.transportExplicitlyClosed=!0,await this.provider.disconnect()}async transportOpen(e){this.relayUrl=e||this.relayUrl,this.transportExplicitlyClosed=!1,await this.provider.connect(),await new Promise(r=>{this.subscriber.once(jt.resubscribed,()=>{r()})})}async createProvider(){const e=await this.core.crypto.signJWT(this.relayUrl);return new Yn(new t0(np({sdkVersion:q_,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e})))}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;return await this.subscriber.isSubscribed(r)?this.messages.has(r,n):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Wn(e)){if(!e.method.endsWith(K_))return;const r=e.params,{topic:n,message:i}=r.data,s={topic:n,message:i};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(gv({type:"event",event:r.id},s)),this.events.emit(r.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(vr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=sn(e.id,!0);await this.provider.connection.send(r)}registerEventListeners(){this.provider.on(br.payload,e=>this.onProviderPayload(e)),this.provider.on(br.connect,()=>{this.events.emit(vr.connect)}),this.provider.on(br.disconnect,()=>{this.events.emit(vr.disconnect),this.attemptToReconnect()}),this.provider.on(br.error,e=>this.events.emit(vr.error,e))}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(()=>{this.provider.connect()},Z.toMiliseconds(H_))}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}var _v=Object.defineProperty,Ac=Object.getOwnPropertySymbols,vv=Object.prototype.hasOwnProperty,bv=Object.prototype.propertyIsEnumerable,Tc=(t,e,r)=>e in t?_v(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cc=(t,e)=>{for(var r in e||(e={}))vv.call(e,r)&&Tc(t,r,e[r]);if(Ac)for(var r of Ac(e))bv.call(e,r)&&Tc(t,r,e[r]);return t};class es extends Fy{constructor(e,r,n,i=qt,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=V_,this.cached=[],this.initialized=!1,this.storagePrefix=qt,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{Dp(o)?this.map.set(o.id,o):xp(o)?this.map.set(o.topic,o):this.getKey&&o!==null&&!bt(o)&&this.map.set(this.getKey(o),o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(h=>r0(a[h],o[h]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const h=Cc(Cc({},this.getData(o)),a);this.map.set(o,h),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=Oe.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){const{message:n}=V("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}=V("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}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class mv{constructor(e,r){this.core=e,this.logger=r,this.name=Y_,this.version=J_,this.events=new Ut.exports,this.initialized=!1,this.storagePrefix=qt,this.ignoredPayloadTypes=[er],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=Oi(),i=await this.core.crypto.setSymKey(n),s=Mt(Z.FIVE_MINUTES),o={protocol:xc},a={topic:i,expiry:s,relay:o,active:!1},h=pp({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:h}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:i,symKey:s,relay:o}=lp(n.uri),a=Mt(Z.FIVE_MINUTES),h={topic:i,relay:o,expiry:a,active:!1};return await this.pairings.set(i,h),await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}),this.core.expirer.set(i,a),n.activatePairing&&await this.activate({topic:i}),h},this.activate=async({topic:n})=>{this.isInitialized();const i=Mt(Z.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:o,resolve:a,reject:h}=tr();this.events.once(Ue("pairing_ping",s),({error:f})=>{f?h(f):a()}),await o()}},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",Ve("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{const o=nn(i,s),a=await this.core.crypto.encode(n,o),h=Jr[i].req;return this.core.history.set(n,o),await this.core.relayer.publish(n,a,h),o.id},this.sendResult=async(n,i,s)=>{const o=sn(n,s),a=await this.core.crypto.encode(i,o),h=await this.core.history.get(i,n),f=Jr[h.request.method].res;await this.core.relayer.publish(i,a,f),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Or(n,s),a=await this.core.crypto.encode(i,o),h=await this.core.history.get(i,n),f=Jr[h.request.method]?Jr[h.request.method].res:Jr.unregistered_method.res;await this.core.relayer.publish(i,a,f),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Ve("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=>Ht(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,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit("pairing_ping",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{$t(i)?this.events.emit(Ue("pairing_ping",s),{}):xt(i)&&this.events.emit(Ue("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.sendResult(s,n,!0),await this.deletePairing(n),this.events.emit("pairing_delete",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Ve("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Ve("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!gt(n)){const{message:i}=V("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!Ep(n.uri)){const{message:i}=V("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!gt(n)){const{message:s}=V("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!gt(n)){const{message:s}=V("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!it(n,!1)){const{message:i}=V("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=V("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(Ht(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=V("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Oe.generateChildLogger(r,this.name),this.pairings=new es(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Oe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(vr.message,async e=>{const{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const i=await this.core.crypto.decode(r,n);Wn(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):kn(i)&&(await this.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.core.expirer.on(mt.expired,async e=>{const{topic:r}=ko(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit("pairing_expire",{topic:r}))})}}class wv extends Cy{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new Ut.exports.EventEmitter,this.name=X_,this.version=Z_,this.cached=[],this.initialized=!1,this.storagePrefix=qt,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 o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(Tt.created,o)},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=xt(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(Tt.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(Tt.deleted,s)}})},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=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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:nn(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}=V("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Tt.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=V("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(Tt.created,e=>{const r=Tt.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Tt.updated,e=>{const r=Tt.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Tt.deleted,e=>{const r=Tt.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Ev extends My{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new Ut.exports.EventEmitter,this.name=Q_,this.version=ev,this.cached=[],this.initialized=!1,this.storagePrefix=qt,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),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(mt.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{this.isInitialized();const i=this.formatTarget(n);if(this.has(i)){const s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(mt.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=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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 ip(e);if(typeof e=="number")return sp(e);const{message:r}=V("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(mt.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=V("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}=V("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;Z.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(mt.expired,{target:e,expiration:r})}checkExpirations(){this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(qr.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(mt.created,e=>{const r=mt.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(mt.expired,e=>{const r=mt.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(mt.deleted,e=>{const r=mt.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}var Dv=Object.defineProperty,Rc=Object.getOwnPropertySymbols,xv=Object.prototype.hasOwnProperty,Sv=Object.prototype.propertyIsEnumerable,Nc=(t,e,r)=>e in t?Dv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Pc=(t,e)=>{for(var r in e||(e={}))xv.call(e,r)&&Nc(t,r,e[r]);if(Rc)for(var r of Rc(e))Sv.call(e,r)&&Nc(t,r,e[r]);return t};class ts extends Ty{constructor(e){super(e),this.protocol=Ec,this.version=L_,this.name=Zi,this.events=new Ut.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;const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:yn(Oe.getDefaultLoggerOptions({level:e?.logger||A_.logger}));this.logger=Oe.generateChildLogger(r,this.name),this.heartbeat=new qr.HeartBeat,this.crypto=new rv(this,this.logger,e?.keychain),this.history=new wv(this,this.logger),this.expirer=new Ev(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new Tg(Pc(Pc({},T_),e?.storageOptions)),this.relayer=new yv({core:this,logger:this.logger,relayUrl:e?.relayUrl,projectId:this.projectId}),this.pairing=new mv(this,this.logger)}static async init(e){const r=new ts(e);return await r.initialize(),r}get context(){return Oe.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 Initilization Success")}catch(e){throw this.logger.warn(`Core Initilization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const Ov=ts;var Ln={exports:{}},mr=typeof Reflect=="object"?Reflect:null,Fc=mr&&typeof mr.apply=="function"?mr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},An;mr&&typeof mr.ownKeys=="function"?An=mr.ownKeys:Object.getOwnPropertySymbols?An=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:An=function(e){return Object.getOwnPropertyNames(e)};function Iv(t){console&&console.warn&&console.warn(t)}var $c=Number.isNaN||function(e){return e!==e};function Le(){Le.init.call(this)}Ln.exports=Le,Ln.exports.once=Cv,Le.EventEmitter=Le,Le.prototype._events=void 0,Le.prototype._eventsCount=0,Le.prototype._maxListeners=void 0;var Mc=10;function Tn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Le,"defaultMaxListeners",{enumerable:!0,get:function(){return Mc},set:function(t){if(typeof t!="number"||t<0||$c(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Mc=t}}),Le.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},Le.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||$c(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 Uc(t){return t._maxListeners===void 0?Le.defaultMaxListeners:t._maxListeners}Le.prototype.getMaxListeners=function(){return Uc(this)},Le.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 o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")Fc(h,this,r);else for(var f=h.length,l=Hc(h,f),n=0;n<f;++n)Fc(l[n],this,r);return!0};function jc(t,e,r,n){var i,s,o;if(Tn(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),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=Uc(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,Iv(a)}return t}Le.prototype.addListener=function(e,r){return jc(this,e,r,!1)},Le.prototype.on=Le.prototype.addListener,Le.prototype.prependListener=function(e,r){return jc(this,e,r,!0)};function Lv(){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 Bc(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Lv.bind(n);return i.listener=r,n.wrapFn=i,i}Le.prototype.once=function(e,r){return Tn(r),this.on(e,Bc(this,e,r)),this},Le.prototype.prependOnceListener=function(e,r){return Tn(r),this.prependListener(e,Bc(this,e,r)),this},Le.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Tn(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,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():Av(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Le.prototype.off=Le.prototype.removeListener,Le.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),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);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 zc(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?Tv(i):Hc(i,i.length)}Le.prototype.listeners=function(e){return zc(this,e,!0)},Le.prototype.rawListeners=function(e){return zc(this,e,!1)},Le.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Kc.call(t,e)},Le.prototype.listenerCount=Kc;function Kc(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}Le.prototype.eventNames=function(){return this._eventsCount>0?An(this._events):[]};function Hc(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Av(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Tv(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Cv(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}qc(t,e,s,{once:!0}),e!=="error"&&Rv(t,i,{once:!0})})}function Rv(t,e,r){typeof t.on=="function"&&qc(t,"error",e,r)}function qc(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)}const Vc="wc",Gc=2,Wc="client",kc=`${Vc}@${Gc}:${Wc}:`,rs={name:Wc,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},Nv="proposal",Pv="session",Cn=Z.SEVEN_DAYS,Fv="engine",Rn={wc_sessionPropose:{req:{ttl:Z.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Z.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Z.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1115}}};var $v=Object.defineProperty,Mv=Object.defineProperties,Uv=Object.getOwnPropertyDescriptors,Yc=Object.getOwnPropertySymbols,jv=Object.prototype.hasOwnProperty,Bv=Object.prototype.propertyIsEnumerable,Jc=(t,e,r)=>e in t?$v(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Vt=(t,e)=>{for(var r in e||(e={}))jv.call(e,r)&&Jc(t,r,e[r]);if(Yc)for(var r of Yc(e))Bv.call(e,r)&&Jc(t,r,e[r]);return t},Xc=(t,e)=>Mv(t,Uv(e));class zv extends jy{constructor(e){super(e),this.name=Fv,this.events=new Ln.exports,this.initialized=!1,this.ignoredPayloadTypes=[er],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(Rn)}),this.initialized=!0)},this.connect=async r=>{this.isInitialized(),await this.isValidConnect(r);const{pairingTopic:n,requiredNamespaces:i,relays:s}=r;let o=n,a,h=!1;if(o&&(h=this.client.core.pairing.pairings.get(o).active),!o||!h){const{topic:R,uri:B}=await this.client.core.pairing.create();o=R,a=B}const f=await this.client.core.crypto.generateKeyPair(),l={requiredNamespaces:i,relays:s??[{protocol:xc}],proposer:{publicKey:f,metadata:this.client.metadata}},{reject:D,resolve:E,done:m}=tr();if(this.events.once(Ue("session_connect"),async({error:R,session:B})=>{if(R)D(R);else if(B){B.self.publicKey=f;const S=Xc(Vt({},B),{requiredNamespaces:i});await this.client.session.set(B.topic,S),await this.setExpiry(B.topic,B.expiry),o&&await this.client.core.pairing.updateMetadata({topic:o,metadata:B.peer.metadata}),E(S)}}),!o){const{message:R}=V("NO_MATCHING_KEY",`connect() pairing topic: ${o}`);throw new Error(R)}const b=await this.sendRequest(o,"wc_sessionPropose",l),P=Mt(Z.FIVE_MINUTES);return await this.setProposal(b,Vt({id:b,expiry:P},l)),{uri:a,approval:m}},this.pair=async r=>(this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{this.isInitialized(),await this.isValidApprove(r);const{id:n,relayProtocol:i,namespaces:s}=r,{pairingTopic:o,proposer:a,requiredNamespaces:h}=this.client.proposal.get(n),f=await this.client.core.crypto.generateKeyPair(),l=a.publicKey,D=await this.client.core.crypto.generateSharedKey(f,l),E={relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:h,controller:{publicKey:f,metadata:this.client.metadata},expiry:Mt(Cn)};await this.client.core.relayer.subscribe(D);const m=await this.sendRequest(D,"wc_sessionSettle",E),{done:b,resolve:P,reject:R}=tr();this.events.once(Ue("session_approve",m),({error:S})=>{S?R(S):P(this.client.session.get(D))});const B=Xc(Vt({},E),{topic:D,acknowledged:!1,self:E.controller,peer:{publicKey:a.publicKey,metadata:a.metadata},controller:f});return await this.client.session.set(D,B),await this.setExpiry(D,Mt(Cn)),o&&await this.client.core.pairing.updateMetadata({topic:o,metadata:B.peer.metadata}),o&&n&&(await this.sendResult(n,o,{relay:{protocol:i??"irn"},responderPublicKey:f}),await this.client.proposal.delete(n,Ve("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:o})),{topic:D,acknowledged:b}},this.reject=async r=>{this.isInitialized(),await this.isValidReject(r);const{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,Ve("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.isValidUpdate(r);const{topic:n,namespaces:i}=r,s=await this.sendRequest(n,"wc_sessionUpdate",{namespaces:i}),{done:o,resolve:a,reject:h}=tr();return this.events.once(Ue("session_update",s),({error:f})=>{f?h(f):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{this.isInitialized(),await this.isValidExtend(r);const{topic:n}=r,i=await this.sendRequest(n,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=tr();return this.events.once(Ue("session_extend",i),({error:h})=>{h?a(h):o()}),await this.setExpiry(n,Mt(Cn)),{acknowledged:s}},this.request=async r=>{this.isInitialized(),await this.isValidRequest(r);const{chainId:n,request:i,topic:s}=r,o=await this.sendRequest(s,"wc_sessionRequest",{request:i,chainId:n}),{done:a,resolve:h,reject:f}=tr();return this.events.once(Ue("session_request",o),({error:l,result:D})=>{l?f(l):h(D)}),await a()},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i;$t(i)?await this.sendResult(s,n,i.result):xt(i)&&await this.sendError(s,n,i.error)},this.ping=async r=>{this.isInitialized(),await this.isValidPing(r);const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=await this.sendRequest(n,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=tr();this.events.once(Ue("session_ping",i),({error:h})=>{h?a(h):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r;await this.sendRequest(n,"wc_sessionEvent",{event:i,chainId:s})},this.disconnect=async r=>{this.isInitialized(),await this.isValidDisconnect(r);const{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest(n,"wc_sessionDelete",Ve("USER_DISCONNECTED")),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>mp(n,r))),this.deleteSession=async(r,n)=>{const{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await Promise.all([this.client.session.delete(r,Ve("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.deleteSymKey(r),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,Ve("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(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,n.expiry)},this.sendRequest=async(r,n,i)=>{const s=nn(n,i),o=await this.client.core.crypto.encode(r,s),a=Rn[n].req;return this.client.core.history.set(r,s),this.client.core.relayer.publish(r,o,a),s.id},this.sendResult=async(r,n,i)=>{const s=sn(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),h=Rn[a.request.method].res;this.client.core.relayer.publish(n,o,h),await this.client.core.history.resolve(s)},this.sendError=async(r,n,i)=>{const s=Or(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),h=Rn[a.request.method].res;this.client.core.relayer.publish(n,o,h),await this.client.core.history.resolve(s)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{Ht(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{Ht(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=r=>{const{topic:n,payload:i}=r,s=i.method;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);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);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(r,n)=>{const{params:i,id:s}=n;try{this.isValidConnect(Vt({},n.params));const o=Mt(Z.FIVE_MINUTES),a=Vt({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{const{id:i}=n;if($t(n)){const{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});const o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});const a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});const h=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:h});const f=await this.client.core.crypto.generateSharedKey(a,h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:f});const l=await this.client.core.relayer.subscribe(f);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:l}),await this.client.core.pairing.activate({topic:r})}else xt(n)&&(await this.client.proposal.delete(i,Ve("USER_DISCONNECTED")),this.events.emit(Ue("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:h,namespaces:f}=n.params,l={topic:r,relay:o,expiry:h,namespaces:f,acknowledged:!0,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}};await this.sendResult(n.id,r,!0),this.events.emit(Ue("session_connect"),{session:l})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;$t(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(Ue("session_approve",i),{})):xt(n)&&(await this.client.session.delete(r,Ve("USER_DISCONNECTED")),this.events.emit(Ue("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{this.isValidUpdate(Vt({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult(s,r,!0),this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n;$t(n)?this.events.emit(Ue("session_update",i),{}):xt(n)&&this.events.emit(Ue("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Mt(Cn)),await this.sendResult(i,r,!0),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n;$t(n)?this.events.emit(Ue("session_extend",i),{}):xt(n)&&this.events.emit(Ue("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n;setTimeout(()=>{$t(n)?this.events.emit(Ue("session_ping",i),{}):xt(n)&&this.events.emit(Ue("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 this.sendResult(i,r,!0),await this.deleteSession(r),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidRequest(Vt({topic:r},s)),this.client.events.emit("session_request",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n;$t(n)?this.events.emit(Ue("session_request",i),{result:n.result}):xt(n)&&this.events.emit(Ue("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidEmit(Vt({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.isValidConnect=async r=>{if(!gt(r)){const{message:a}=V("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(a)}const{pairingTopic:n,requiredNamespaces:i,relays:s}=r;bt(n)||await this.isValidPairingTopic(n);const o=Lp(i,"connect()");if(o)throw new Error(o.message);if(!Ap(s,!0)){const{message:a}=V("MISSING_OR_INVALID",`connect() relays: ${s}`);throw new Error(a)}},this.isValidApprove=async r=>{if(!gt(r))throw new Error(V("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s}=r;await this.isValidProposalId(n);const o=this.client.proposal.get(n),a=Ri(i,"approve()");if(a)throw new Error(a.message);const h=oa(o.requiredNamespaces,i,"update()");if(h)throw new Error(h.message);if(!it(s,!0)){const{message:f}=V("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}},this.isValidReject=async r=>{if(!gt(r)){const{message:s}=V("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(await this.isValidProposalId(n),!Cp(i)){const{message:s}=V("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!gt(r)){const{message:f}=V("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(f)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!ia(n)){const{message:f}=V("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(f)}const a=Sp(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const h=Ri(s,"onSessionSettleRequest()");if(h)throw new Error(h.message);if(Ht(o)){const{message:f}=V("EXPIRED","onSessionSettleRequest()");throw new Error(f)}},this.isValidUpdate=async r=>{if(!gt(r)){const{message:h}=V("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(h)}const{topic:n,namespaces:i}=r;await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=Ri(i,"update()");if(o)throw new Error(o.message);const a=oa(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!gt(r)){const{message:i}=V("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!gt(r)){const{message:a}=V("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(a)}const{topic:n,request:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!sa(o,s)){const{message:a}=V("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(a)}if(!Rp(i)){const{message:a}=V("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(a)}if(!Fp(o,s,i.method)){const{message:a}=V("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(a)}},this.isValidRespond=async r=>{if(!gt(r)){const{message:s}=V("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}const{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!Np(i)){const{message:s}=V("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!gt(r)){const{message:i}=V("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!gt(r)){const{message:a}=V("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!sa(o,s)){const{message:a}=V("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!Pp(i)){const{message:a}=V("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!$p(o,s,i.name)){const{message:a}=V("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!gt(r)){const{message:i}=V("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)}}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(vr.message,async e=>{const{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;const i=await this.client.core.crypto.decode(r,n);Wn(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):kn(i)&&(await this.client.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.client.core.expirer.on(mt.expired,async e=>{const{topic:r,id:n}=ko(e.target);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&await this.deleteProposal(n,!0)})}isValidPairingTopic(e){if(!it(e,!1)){const{message:r}=V("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}=V("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(Ht(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=V("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!it(e,!1)){const{message:r}=V("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(!this.client.session.keys.includes(e)){const{message:r}=V("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(Ht(this.client.session.get(e).expiry)){await this.deleteSession(e);const{message:r}=V("EXPIRED",`session topic: ${e}`);throw new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(it(e,!1)){const{message:r}=V("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=V("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!Tp(e)){const{message:r}=V("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=V("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(Ht(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);const{message:r}=V("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class Kv extends es{constructor(e,r){super(e,r,Nv,kc),this.core=e,this.logger=r}}class Hv extends es{constructor(e,r){super(e,r,Pv,kc),this.core=e,this.logger=r}}class ns extends Uy{constructor(e){super(e),this.protocol=Vc,this.version=Gc,this.name=rs.name,this.events=new Ln.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.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.name=e?.name||rs.name,this.metadata=e?.metadata||Qd();const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:yn(Oe.getDefaultLoggerOptions({level:e?.logger||rs.logger}));this.core=e?.core||new Ov(e),this.logger=Oe.generateChildLogger(r,this.name),this.session=new Hv(this.core,this.logger),this.proposal=new Kv(this.core,this.logger),this.engine=new zv(this)}static async init(e){const r=new ns(e);return await r.initialize(),r}get context(){return Oe.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.engine.init(),this.logger.info("SignClient Initilization Success")}catch(e){throw this.logger.info("SignClient Initilization Failure"),this.logger.error(e.message),e}}}var is={exports:{}},wr=typeof Reflect=="object"?Reflect:null,Zc=wr&&typeof wr.apply=="function"?wr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Nn;wr&&typeof wr.ownKeys=="function"?Nn=wr.ownKeys:Object.getOwnPropertySymbols?Nn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Nn=function(e){return Object.getOwnPropertyNames(e)};function qv(t){console&&console.warn&&console.warn(t)}var Qc=Number.isNaN||function(e){return e!==e};function Ae(){Ae.init.call(this)}is.exports=Ae,is.exports.once=kv,Ae.EventEmitter=Ae,Ae.prototype._events=void 0,Ae.prototype._eventsCount=0,Ae.prototype._maxListeners=void 0;var eu=10;function Pn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ae,"defaultMaxListeners",{enumerable:!0,get:function(){return eu},set:function(t){if(typeof t!="number"||t<0||Qc(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");eu=t}}),Ae.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},Ae.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Qc(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 tu(t){return t._maxListeners===void 0?Ae.defaultMaxListeners:t._maxListeners}Ae.prototype.getMaxListeners=function(){return tu(this)},Ae.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 o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")Zc(h,this,r);else for(var f=h.length,l=ou(h,f),n=0;n<f;++n)Zc(l[n],this,r);return!0};function ru(t,e,r,n){var i,s,o;if(Pn(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),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=tu(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,qv(a)}return t}Ae.prototype.addListener=function(e,r){return ru(this,e,r,!1)},Ae.prototype.on=Ae.prototype.addListener,Ae.prototype.prependListener=function(e,r){return ru(this,e,r,!0)};function Vv(){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 nu(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Vv.bind(n);return i.listener=r,n.wrapFn=i,i}Ae.prototype.once=function(e,r){return Pn(r),this.on(e,nu(this,e,r)),this},Ae.prototype.prependOnceListener=function(e,r){return Pn(r),this.prependListener(e,nu(this,e,r)),this},Ae.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Pn(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,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():Gv(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Ae.prototype.off=Ae.prototype.removeListener,Ae.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),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);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 iu(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?Wv(i):ou(i,i.length)}Ae.prototype.listeners=function(e){return iu(this,e,!0)},Ae.prototype.rawListeners=function(e){return iu(this,e,!1)},Ae.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):su.call(t,e)},Ae.prototype.listenerCount=su;function su(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}Ae.prototype.eventNames=function(){return this._eventsCount>0?Nn(this._events):[]};function ou(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Gv(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Wv(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function kv(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}au(t,e,s,{once:!0}),e!=="error"&&Yv(t,i,{once:!0})})}function Yv(t,e,r){typeof t.on=="function"&&au(t,"error",e,r)}function au(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)}function Jv(t){return typeof t<"u"&&typeof t.context<"u"}const Ct={init:"signer_init",uri:"signer_uri",created:"signer_created",updated:"signer_updated",deleted:"signer_deleted",event:"signer_event"};class Xv extends af{constructor(e){super(),this.events=new is.exports.EventEmitter,this.pending=!1,this.initializing=!1,this.requiredNamespaces=e?.requiredNamespaces||{},this.opts=e?.client}get connected(){return typeof this.session<"u"}get connecting(){return this.pending}get chains(){return this.session?wi(this.session.namespaces):Pd(this.requiredNamespaces)}get accounts(){return this.session?mi(this.session.namespaces):[]}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(){if(this.pending)return new Promise((e,r)=>{this.events.once("open",()=>{if(this.events.once("open_error",n=>{r(n)}),typeof this.client>"u")return r(new Error("Sign Client not initialized"));e()})});try{this.pending=!0;const e=await this.register(),r=e.find({requiredNamespaces:this.requiredNamespaces});if(r.length)return this.onOpen(r[0]);const{uri:n,approval:i}=await e.connect({requiredNamespaces:this.requiredNamespaces});this.events.emit(Ct.uri,{uri:n}),this.session=await i(),this.events.emit(Ct.created,this.session),this.onOpen()}catch(e){throw this.events.emit("open_error",e),e}}async close(){typeof this.session>"u"||(await(await this.register()).disconnect({topic:this.session.topic,reason:Ve("USER_DISCONNECTED")}),this.onClose())}async send(e,r){if(typeof this.client>"u"&&(this.client=await this.register(),this.connected||await this.open()),typeof this.session>"u")throw new Error("Signer connection is missing session");this.client.request({topic:this.session.topic,request:e,chainId:r?.chainId}).then(n=>this.events.emit("payload",sn(e.id,n))).catch(n=>this.events.emit("payload",Or(e.id,n.message)))}async register(e=this.opts){if(typeof this.client<"u")return this.client;if(this.initializing)return new Promise((r,n)=>{this.events.once("register_error",i=>{n(i)}),this.events.once(Ct.init,()=>{if(typeof this.client>"u")return n(new Error("Sign Client not initialized"));r(this.client)})});if(Jv(e))return this.client=e,this.registerEventListeners(),this.client;try{return this.initializing=!0,this.client=await ns.init(e),this.initializing=!1,this.registerEventListeners(),this.events.emit(Ct.init),this.client}catch(r){throw this.events.emit("register_error",r),r}}onOpen(e){this.pending=!1,e&&(this.session=e),this.events.emit("open")}onClose(){this.pending=!1,this.client&&(this.client=void 0),this.events.emit("close")}registerEventListeners(){typeof this.client<"u"&&(this.client.on("session_event",e=>{var r;this.session&&((r=this.session)==null?void 0:r.topic)!==e.topic||this.events.emit(Ct.event,e.params)}),this.client.on("session_update",e=>{var r;typeof this.client<"u"&&(this.session&&((r=this.session)==null?void 0:r.topic)!==e.topic||(this.session=this.client.session.get(e.topic),this.events.emit(Ct.updated,this.session)))}),this.client.on("session_delete",e=>{var r;!this.session||this.session&&((r=this.session)==null?void 0:r.topic)!==e.topic||(this.onClose(),this.events.emit(Ct.deleted,this.session),this.session=void 0)}))}}const Zv=["eth_requestAccounts","eth_accounts","eth_chainId","eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","personal_sign"],Qv=["chainChanged","accountsChanged"];function cu(t){return{chains:t!=null&&t.chainId?[`eip155:${t.chainId}`]:[],methods:t?.methods||[],events:t?.events||[],rpcMap:t?.rpcMap||void 0}}function uu(t,e){let r;return e.rpcMap&&(r=e.rpcMap[ss([t])]),r}function ss(t){return Number(t[0].split(":")[1])}class e1{constructor(e){this.events=new Kn.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.rpc=cu(e),this.signer=this.setSignerProvider(e?.client),this.chainId=ss(this.rpc.chains),this.http=this.setHttpProvider(this.chainId),this.registerEventListeners()}async request(e){switch(e.method){case"eth_requestAccounts":return await this.connect(),this.accounts;case"eth_accounts":return this.accounts;case"eth_chainId":return this.chainId}if(e.method.startsWith("eth_signTypedData")||this.rpc.methods.includes(e.method))return this.signer.request(e,{chainId:this.formatChainId(this.chainId)});if(typeof this.http>"u")throw new Error(`Cannot request JSON-RPC method (${e.method}) without provided rpc url`);return this.http.request(e)}sendAsync(e,r){this.request(e).then(n=>r(null,n)).catch(n=>r(n,void 0))}get connected(){return this.signer.connection.connected}get connecting(){return this.signer.connection.connecting}async enable(){return await this.request({method:"eth_requestAccounts"})}async connect(){await this.signer.connect()}async disconnect(){await this.signer.disconnect()}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}registerEventListeners(){this.signer.on("connect",()=>{const e=this.signer.connection.chains;e&&e.length&&this.setChainIds(e);const r=this.signer.connection.accounts;r&&r.length&&this.setAccounts(r)}),this.signer.connection.on(Ct.created,e=>{const r=wi(e.namespaces,[this.namespace]);this.setChainIds(r);const n=mi(e.namespaces,[this.namespace]);this.setAccounts(n)}),this.signer.connection.on(Ct.updated,e=>{const r=wi(e.namespaces,[this.namespace]);this.setChainIds(r);const n=mi(e.namespaces,[this.namespace]);n!==this.accounts&&this.setAccounts(n)}),this.signer.connection.on(Ct.event,e=>{if(!this.rpc.chains.includes(e.chainId))return;const{event:r}=e;r.name==="accountsChanged"?(this.accounts=r.data,this.events.emit("accountsChanged",this.accounts)):r.name==="chainChanged"?this.setChainId(r.data):this.events.emit(r.name,r.data)}),this.signer.on("disconnect",()=>{this.events.emit("disconnect")}),this.events.on("chainChanged",e=>this.setHttpProvider(e))}setSignerProvider(e){const r=new Xv({requiredNamespaces:{[this.namespace]:{chains:this.rpc.chains,methods:this.rpc.methods,events:this.rpc.events}},client:e});return new Yn(r)}setHttpProvider(e){const r=uu(`${this.namespace}:${e}`,this.rpc);return typeof r>"u"?void 0:new Yn(new pf(r))}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)).filter(n=>n!==this.chainId);r.length&&(this.chainId=r[0],this.events.emit("chainChanged",this.chainId))}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.events.emit("chainChanged",this.chainId)}}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)}}Dt.default=e1,Dt.getEthereumChainId=ss,Dt.getRpcConfig=cu,Dt.getRpcUrl=uu,Dt.signerEvents=Qv,Dt.signerMethods=Zv,Object.defineProperty(Dt,"__esModule",{value:!0})});
|
|
66
|
+
***************************************************************************** */var Ji=function(t,e){return Ji=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])},Ji(t,e)};function my(t,e){Ji(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Xi=function(){return Xi=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},Xi.apply(this,arguments)};function wy(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 Ey(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function Dy(t,e){return function(r,n){e(r,n,t)}}function xy(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Sy(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{f(n.next(l))}catch(D){o(D)}}function h(l){try{f(n.throw(l))}catch(D){o(D)}}function f(l){l.done?s(l.value):i(l.value).then(a,h)}f((n=n.apply(t,e||[])).next())})}function Oy(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(f){return function(l){return h([f,l])}}function h(f){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=f[0]&2?i.return:f[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,f[1])).done)return s;switch(i=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){r.label=f[1];break}if(f[0]===6&&r.label<s[1]){r.label=s[1],s=f;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(f);break}s[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(l){f=[6,l],i=0}finally{n=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Ly(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function Iy(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Zi(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 Ha(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function Ay(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Ha(arguments[e]));return t}function Ty(){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],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function Yr(t){return this instanceof Yr?(this.v=t,this):new Yr(t)}function Cy(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(b){n[b]&&(i[b]=function(m){return new Promise(function(w,N){s.push([b,m,w,N])>1||a(b,m)})})}function a(b,m){try{h(n[b](m))}catch(w){D(s[0][3],w)}}function h(b){b.value instanceof Yr?Promise.resolve(b.value.v).then(f,l):D(s[0][2],b)}function f(b){a("next",b)}function l(b){a("throw",b)}function D(b,m){b(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Ry(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(o){return(r=!r)?{value:Yr(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function Py(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 Zi=="function"?Zi(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(o){return new Promise(function(a,h){o=t[s](o),i(a,h,o.done,o.value)})}}function i(s,o,a,h){Promise.resolve(h).then(function(f){s({value:f,done:a})},o)}}function Ny(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function $y(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 Fy(t){return t&&t.__esModule?t:{default:t}}function My(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Uy(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 jy=Object.freeze({__proto__:null,__extends:my,get __assign(){return Xi},__rest:wy,__decorate:Ey,__param:Dy,__metadata:xy,__awaiter:Sy,__generator:Oy,__createBinding:Ly,__exportStar:Iy,__values:Zi,__read:Ha,__spread:Ay,__spreadArrays:Ty,__await:Yr,__asyncGenerator:Cy,__asyncDelegator:Ry,__asyncValues:Py,__makeTemplateObject:Ny,__importStar:$y,__importDefault:Fy,__classPrivateFieldGet:My,__classPrivateFieldSet:Uy}),By=Zt(jy),or={},Va;function Ga(){return Va||(Va=1,Object.defineProperty(or,"__esModule",{value:!0}),or.PINO_CUSTOM_CONTEXT_KEY=or.PINO_LOGGER_DEFAULTS=void 0,or.PINO_LOGGER_DEFAULTS={level:"info"},or.PINO_CUSTOM_CONTEXT_KEY="custom_context"),or}var ft={},Wa;function zy(){if(Wa)return ft;Wa=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.generateChildLogger=ft.formatChildLoggerContext=ft.getLoggerContext=ft.setBrowserLoggerContext=ft.getBrowserLoggerContext=ft.getDefaultLoggerOptions=void 0;const t=Ga();function e(a){return Object.assign(Object.assign({},a),{level:a?.level||t.PINO_LOGGER_DEFAULTS.level})}ft.getDefaultLoggerOptions=e;function r(a,h=t.PINO_CUSTOM_CONTEXT_KEY){return a[h]||""}ft.getBrowserLoggerContext=r;function n(a,h,f=t.PINO_CUSTOM_CONTEXT_KEY){return a[f]=h,a}ft.setBrowserLoggerContext=n;function i(a,h=t.PINO_CUSTOM_CONTEXT_KEY){let f="";return typeof a.bindings>"u"?f=r(a,h):f=a.bindings().context||"",f}ft.getLoggerContext=i;function s(a,h,f=t.PINO_CUSTOM_CONTEXT_KEY){const l=i(a,f);return l.trim()?`${l}/${h}`:h}ft.formatChildLoggerContext=s;function o(a,h,f=t.PINO_CUSTOM_CONTEXT_KEY){const l=s(a,h,f),D=a.child({context:l});return n(D,l,f)}return ft.generateChildLogger=o,ft}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.pino=void 0;const e=By,r=e.__importDefault(_n);Object.defineProperty(t,"pino",{enumerable:!0,get:function(){return r.default}}),e.__exportStar(Ga(),t),e.__exportStar(zy(),t)})(Oe);var ka={exports:{}},br=typeof Reflect=="object"?Reflect:null,Ya=br&&typeof br.apply=="function"?br.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Sn;br&&typeof br.ownKeys=="function"?Sn=br.ownKeys:Object.getOwnPropertySymbols?Sn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Sn=function(e){return Object.getOwnPropertyNames(e)};function Ky(t){console&&console.warn&&console.warn(t)}var Ja=Number.isNaN||function(e){return e!==e};function Le(){Le.init.call(this)}ka.exports=Le,ka.exports.once=Gy,Le.EventEmitter=Le,Le.prototype._events=void 0,Le.prototype._eventsCount=0,Le.prototype._maxListeners=void 0;var Xa=10;function On(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Le,"defaultMaxListeners",{enumerable:!0,get:function(){return Xa},set:function(t){if(typeof t!="number"||t<0||Ja(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Xa=t}}),Le.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},Le.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ja(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 Za(t){return t._maxListeners===void 0?Le.defaultMaxListeners:t._maxListeners}Le.prototype.getMaxListeners=function(){return Za(this)},Le.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 o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")Ya(h,this,r);else for(var f=h.length,l=nc(h,f),n=0;n<f;++n)Ya(l[n],this,r);return!0};function Qa(t,e,r,n){var i,s,o;if(On(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),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=Za(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,Ky(a)}return t}Le.prototype.addListener=function(e,r){return Qa(this,e,r,!1)},Le.prototype.on=Le.prototype.addListener,Le.prototype.prependListener=function(e,r){return Qa(this,e,r,!0)};function qy(){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 ec(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=qy.bind(n);return i.listener=r,n.wrapFn=i,i}Le.prototype.once=function(e,r){return On(r),this.on(e,ec(this,e,r)),this},Le.prototype.prependOnceListener=function(e,r){return On(r),this.prependListener(e,ec(this,e,r)),this},Le.prototype.removeListener=function(e,r){var n,i,s,o,a;if(On(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,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():Hy(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Le.prototype.off=Le.prototype.removeListener,Le.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),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);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 tc(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?Vy(i):nc(i,i.length)}Le.prototype.listeners=function(e){return tc(this,e,!0)},Le.prototype.rawListeners=function(e){return tc(this,e,!1)},Le.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):rc.call(t,e)},Le.prototype.listenerCount=rc;function rc(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}Le.prototype.eventNames=function(){return this._eventsCount>0?Sn(this._events):[]};function nc(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Hy(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Vy(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Gy(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}ic(t,e,s,{once:!0}),e!=="error"&&Wy(t,i,{once:!0})})}function Wy(t,e,r){typeof t.on=="function"&&ic(t,"error",e,r)}function ic(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)}class ky extends ir{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class Yy extends ir{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}}class Jy{constructor(e,r){this.logger=e,this.core=r}}class Xy extends ir{constructor(e,r){super(),this.relayer=e,this.logger=r}}class Zy extends ir{constructor(e){super()}}class Qy{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}}class ev extends ir{constructor(e,r){super(),this.relayer=e,this.logger=r}}class tv extends ir{constructor(e,r){super(),this.core=e,this.logger=r}}class rv{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class nv{constructor(e){this.client=e}}var Qi={},sc={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=re,r=_t;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var n=function(){function a(){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 a.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},a.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},a.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},a.prototype.update=function(h,f){if(f===void 0&&(f=h.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var l=0;if(this._bytesHashed+=f,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&f>0;)this._buffer[this._bufferLength++]=h[l++],f--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(f>=this.blockSize&&(l=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,h,l,f),f%=this.blockSize);f>0;)this._buffer[this._bufferLength++]=h[l++],f--;return this},a.prototype.finish=function(h){if(!this._finished){var f=this._bytesHashed,l=this._bufferLength,D=f/536870912|0,b=f<<3,m=f%128<112?128:256;this._buffer[l]=128;for(var w=l+1;w<m-8;w++)this._buffer[w]=0;e.writeUint32BE(D,this._buffer,m-8),e.writeUint32BE(b,this._buffer,m-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,m),this._finished=!0}for(var w=0;w<this.digestLength/8;w++)e.writeUint32BE(this._stateHi[w],h,w*8),e.writeUint32BE(this._stateLo[w],h,w*8+4);return this},a.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},a.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}},a.prototype.restoreState=function(h){return this._stateHi.set(h.stateHi),this._stateLo.set(h.stateLo),this._bufferLength=h.bufferLength,h.buffer&&this._buffer.set(h.buffer),this._bytesHashed=h.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(h){r.wipe(h.stateHi),r.wipe(h.stateLo),h.buffer&&r.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},a}();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(a,h,f,l,D,b,m){for(var w=f[0],N=f[1],R=f[2],B=f[3],S=f[4],I=f[5],y=f[6],x=f[7],E=l[0],c=l[1],d=l[2],U=l[3],K=l[4],G=l[5],J=l[6],X=l[7],g,v,F,M,P,C,j,z;m>=128;){for(var Q=0;Q<16;Q++){var q=8*Q+b;a[Q]=e.readUint32BE(D,q),h[Q]=e.readUint32BE(D,q+4)}for(var Q=0;Q<80;Q++){var ee=w,Y=N,ae=R,T=B,A=S,O=I,u=y,_=x,H=E,W=c,he=d,ve=U,de=K,me=G,Be=J,$e=X;if(g=x,v=X,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=(S>>>14|K<<32-14)^(S>>>18|K<<32-18)^(K>>>41-32|S<<32-(41-32)),v=(K>>>14|S<<32-14)^(K>>>18|S<<32-18)^(S>>>41-32|K<<32-(41-32)),P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,g=S&I^~S&y,v=K&G^~K&J,P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,g=i[Q*2],v=i[Q*2+1],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,g=a[Q%16],v=h[Q%16],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,F=j&65535|z<<16,M=P&65535|C<<16,g=F,v=M,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=(w>>>28|E<<32-28)^(E>>>34-32|w<<32-(34-32))^(E>>>39-32|w<<32-(39-32)),v=(E>>>28|w<<32-28)^(w>>>34-32|E<<32-(34-32))^(w>>>39-32|E<<32-(39-32)),P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,g=w&N^w&R^N&R,v=E&c^E&d^c&d,P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,_=j&65535|z<<16,$e=P&65535|C<<16,g=T,v=ve,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=F,v=M,P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,T=j&65535|z<<16,ve=P&65535|C<<16,N=ee,R=Y,B=ae,S=T,I=A,y=O,x=u,w=_,c=H,d=W,U=he,K=ve,G=de,J=me,X=Be,E=$e,Q%16===15)for(var q=0;q<16;q++)g=a[q],v=h[q],P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=a[(q+9)%16],v=h[(q+9)%16],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,F=a[(q+1)%16],M=h[(q+1)%16],g=(F>>>1|M<<32-1)^(F>>>8|M<<32-8)^F>>>7,v=(M>>>1|F<<32-1)^(M>>>8|F<<32-8)^(M>>>7|F<<32-7),P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,F=a[(q+14)%16],M=h[(q+14)%16],g=(F>>>19|M<<32-19)^(M>>>61-32|F<<32-(61-32))^F>>>6,v=(M>>>19|F<<32-19)^(F>>>61-32|M<<32-(61-32))^(M>>>6|F<<32-6),P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,a[q]=j&65535|z<<16,h[q]=P&65535|C<<16}g=w,v=E,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[0],v=l[0],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[0]=w=j&65535|z<<16,l[0]=E=P&65535|C<<16,g=N,v=c,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[1],v=l[1],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[1]=N=j&65535|z<<16,l[1]=c=P&65535|C<<16,g=R,v=d,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[2],v=l[2],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[2]=R=j&65535|z<<16,l[2]=d=P&65535|C<<16,g=B,v=U,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[3],v=l[3],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[3]=B=j&65535|z<<16,l[3]=U=P&65535|C<<16,g=S,v=K,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[4],v=l[4],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[4]=S=j&65535|z<<16,l[4]=K=P&65535|C<<16,g=I,v=G,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[5],v=l[5],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[5]=I=j&65535|z<<16,l[5]=G=P&65535|C<<16,g=y,v=J,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[6],v=l[6],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[6]=y=j&65535|z<<16,l[6]=J=P&65535|C<<16,g=x,v=X,P=v&65535,C=v>>>16,j=g&65535,z=g>>>16,g=f[7],v=l[7],P+=v&65535,C+=v>>>16,j+=g&65535,z+=g>>>16,C+=P>>>16,j+=C>>>16,z+=j>>>16,f[7]=x=j&65535|z<<16,l[7]=X=P&65535|C<<16,b+=128,m-=128}return b}function o(a){var h=new n;h.update(a);var f=h.digest();return h.clean(),f}t.hash=o})(sc),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=lr,r=sc,n=_t;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function i(T){const A=new Float64Array(16);if(T)for(let O=0;O<T.length;O++)A[O]=T[O];return A}const s=new Uint8Array(32);s[0]=9;const o=i(),a=i([1]),h=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),f=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),l=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),D=i([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),b=i([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function m(T,A){for(let O=0;O<16;O++)T[O]=A[O]|0}function w(T){let A=1;for(let O=0;O<16;O++){let u=T[O]+A+65535;A=Math.floor(u/65536),T[O]=u-A*65536}T[0]+=A-1+37*(A-1)}function N(T,A,O){const u=~(O-1);for(let _=0;_<16;_++){const H=u&(T[_]^A[_]);T[_]^=H,A[_]^=H}}function R(T,A){const O=i(),u=i();for(let _=0;_<16;_++)u[_]=A[_];w(u),w(u),w(u);for(let _=0;_<2;_++){O[0]=u[0]-65517;for(let W=1;W<15;W++)O[W]=u[W]-65535-(O[W-1]>>16&1),O[W-1]&=65535;O[15]=u[15]-32767-(O[14]>>16&1);const H=O[15]>>16&1;O[14]&=65535,N(u,O,1-H)}for(let _=0;_<16;_++)T[2*_]=u[_]&255,T[2*_+1]=u[_]>>8}function B(T,A){let O=0;for(let u=0;u<32;u++)O|=T[u]^A[u];return(1&O-1>>>8)-1}function S(T,A){const O=new Uint8Array(32),u=new Uint8Array(32);return R(O,T),R(u,A),B(O,u)}function I(T){const A=new Uint8Array(32);return R(A,T),A[0]&1}function y(T,A){for(let O=0;O<16;O++)T[O]=A[2*O]+(A[2*O+1]<<8);T[15]&=32767}function x(T,A,O){for(let u=0;u<16;u++)T[u]=A[u]+O[u]}function E(T,A,O){for(let u=0;u<16;u++)T[u]=A[u]-O[u]}function c(T,A,O){let u,_,H=0,W=0,he=0,ve=0,de=0,me=0,Be=0,$e=0,ye=0,pe=0,le=0,ue=0,ce=0,oe=0,se=0,te=0,fe=0,ge=0,ne=0,_e=0,be=0,Ee=0,De=0,we=0,Lt=0,$t=0,kt=0,mt=0,ar=0,Qr=0,Bn=0,ze=O[0],Fe=O[1],Ke=O[2],qe=O[3],He=O[4],Me=O[5],Je=O[6],Xe=O[7],Ze=O[8],Qe=O[9],et=O[10],We=O[11],Ve=O[12],Pe=O[13],tt=O[14],rt=O[15];u=A[0],H+=u*ze,W+=u*Fe,he+=u*Ke,ve+=u*qe,de+=u*He,me+=u*Me,Be+=u*Je,$e+=u*Xe,ye+=u*Ze,pe+=u*Qe,le+=u*et,ue+=u*We,ce+=u*Ve,oe+=u*Pe,se+=u*tt,te+=u*rt,u=A[1],W+=u*ze,he+=u*Fe,ve+=u*Ke,de+=u*qe,me+=u*He,Be+=u*Me,$e+=u*Je,ye+=u*Xe,pe+=u*Ze,le+=u*Qe,ue+=u*et,ce+=u*We,oe+=u*Ve,se+=u*Pe,te+=u*tt,fe+=u*rt,u=A[2],he+=u*ze,ve+=u*Fe,de+=u*Ke,me+=u*qe,Be+=u*He,$e+=u*Me,ye+=u*Je,pe+=u*Xe,le+=u*Ze,ue+=u*Qe,ce+=u*et,oe+=u*We,se+=u*Ve,te+=u*Pe,fe+=u*tt,ge+=u*rt,u=A[3],ve+=u*ze,de+=u*Fe,me+=u*Ke,Be+=u*qe,$e+=u*He,ye+=u*Me,pe+=u*Je,le+=u*Xe,ue+=u*Ze,ce+=u*Qe,oe+=u*et,se+=u*We,te+=u*Ve,fe+=u*Pe,ge+=u*tt,ne+=u*rt,u=A[4],de+=u*ze,me+=u*Fe,Be+=u*Ke,$e+=u*qe,ye+=u*He,pe+=u*Me,le+=u*Je,ue+=u*Xe,ce+=u*Ze,oe+=u*Qe,se+=u*et,te+=u*We,fe+=u*Ve,ge+=u*Pe,ne+=u*tt,_e+=u*rt,u=A[5],me+=u*ze,Be+=u*Fe,$e+=u*Ke,ye+=u*qe,pe+=u*He,le+=u*Me,ue+=u*Je,ce+=u*Xe,oe+=u*Ze,se+=u*Qe,te+=u*et,fe+=u*We,ge+=u*Ve,ne+=u*Pe,_e+=u*tt,be+=u*rt,u=A[6],Be+=u*ze,$e+=u*Fe,ye+=u*Ke,pe+=u*qe,le+=u*He,ue+=u*Me,ce+=u*Je,oe+=u*Xe,se+=u*Ze,te+=u*Qe,fe+=u*et,ge+=u*We,ne+=u*Ve,_e+=u*Pe,be+=u*tt,Ee+=u*rt,u=A[7],$e+=u*ze,ye+=u*Fe,pe+=u*Ke,le+=u*qe,ue+=u*He,ce+=u*Me,oe+=u*Je,se+=u*Xe,te+=u*Ze,fe+=u*Qe,ge+=u*et,ne+=u*We,_e+=u*Ve,be+=u*Pe,Ee+=u*tt,De+=u*rt,u=A[8],ye+=u*ze,pe+=u*Fe,le+=u*Ke,ue+=u*qe,ce+=u*He,oe+=u*Me,se+=u*Je,te+=u*Xe,fe+=u*Ze,ge+=u*Qe,ne+=u*et,_e+=u*We,be+=u*Ve,Ee+=u*Pe,De+=u*tt,we+=u*rt,u=A[9],pe+=u*ze,le+=u*Fe,ue+=u*Ke,ce+=u*qe,oe+=u*He,se+=u*Me,te+=u*Je,fe+=u*Xe,ge+=u*Ze,ne+=u*Qe,_e+=u*et,be+=u*We,Ee+=u*Ve,De+=u*Pe,we+=u*tt,Lt+=u*rt,u=A[10],le+=u*ze,ue+=u*Fe,ce+=u*Ke,oe+=u*qe,se+=u*He,te+=u*Me,fe+=u*Je,ge+=u*Xe,ne+=u*Ze,_e+=u*Qe,be+=u*et,Ee+=u*We,De+=u*Ve,we+=u*Pe,Lt+=u*tt,$t+=u*rt,u=A[11],ue+=u*ze,ce+=u*Fe,oe+=u*Ke,se+=u*qe,te+=u*He,fe+=u*Me,ge+=u*Je,ne+=u*Xe,_e+=u*Ze,be+=u*Qe,Ee+=u*et,De+=u*We,we+=u*Ve,Lt+=u*Pe,$t+=u*tt,kt+=u*rt,u=A[12],ce+=u*ze,oe+=u*Fe,se+=u*Ke,te+=u*qe,fe+=u*He,ge+=u*Me,ne+=u*Je,_e+=u*Xe,be+=u*Ze,Ee+=u*Qe,De+=u*et,we+=u*We,Lt+=u*Ve,$t+=u*Pe,kt+=u*tt,mt+=u*rt,u=A[13],oe+=u*ze,se+=u*Fe,te+=u*Ke,fe+=u*qe,ge+=u*He,ne+=u*Me,_e+=u*Je,be+=u*Xe,Ee+=u*Ze,De+=u*Qe,we+=u*et,Lt+=u*We,$t+=u*Ve,kt+=u*Pe,mt+=u*tt,ar+=u*rt,u=A[14],se+=u*ze,te+=u*Fe,fe+=u*Ke,ge+=u*qe,ne+=u*He,_e+=u*Me,be+=u*Je,Ee+=u*Xe,De+=u*Ze,we+=u*Qe,Lt+=u*et,$t+=u*We,kt+=u*Ve,mt+=u*Pe,ar+=u*tt,Qr+=u*rt,u=A[15],te+=u*ze,fe+=u*Fe,ge+=u*Ke,ne+=u*qe,_e+=u*He,be+=u*Me,Ee+=u*Je,De+=u*Xe,we+=u*Ze,Lt+=u*Qe,$t+=u*et,kt+=u*We,mt+=u*Ve,ar+=u*Pe,Qr+=u*tt,Bn+=u*rt,H+=38*fe,W+=38*ge,he+=38*ne,ve+=38*_e,de+=38*be,me+=38*Ee,Be+=38*De,$e+=38*we,ye+=38*Lt,pe+=38*$t,le+=38*kt,ue+=38*mt,ce+=38*ar,oe+=38*Qr,se+=38*Bn,_=1,u=H+_+65535,_=Math.floor(u/65536),H=u-_*65536,u=W+_+65535,_=Math.floor(u/65536),W=u-_*65536,u=he+_+65535,_=Math.floor(u/65536),he=u-_*65536,u=ve+_+65535,_=Math.floor(u/65536),ve=u-_*65536,u=de+_+65535,_=Math.floor(u/65536),de=u-_*65536,u=me+_+65535,_=Math.floor(u/65536),me=u-_*65536,u=Be+_+65535,_=Math.floor(u/65536),Be=u-_*65536,u=$e+_+65535,_=Math.floor(u/65536),$e=u-_*65536,u=ye+_+65535,_=Math.floor(u/65536),ye=u-_*65536,u=pe+_+65535,_=Math.floor(u/65536),pe=u-_*65536,u=le+_+65535,_=Math.floor(u/65536),le=u-_*65536,u=ue+_+65535,_=Math.floor(u/65536),ue=u-_*65536,u=ce+_+65535,_=Math.floor(u/65536),ce=u-_*65536,u=oe+_+65535,_=Math.floor(u/65536),oe=u-_*65536,u=se+_+65535,_=Math.floor(u/65536),se=u-_*65536,u=te+_+65535,_=Math.floor(u/65536),te=u-_*65536,H+=_-1+37*(_-1),_=1,u=H+_+65535,_=Math.floor(u/65536),H=u-_*65536,u=W+_+65535,_=Math.floor(u/65536),W=u-_*65536,u=he+_+65535,_=Math.floor(u/65536),he=u-_*65536,u=ve+_+65535,_=Math.floor(u/65536),ve=u-_*65536,u=de+_+65535,_=Math.floor(u/65536),de=u-_*65536,u=me+_+65535,_=Math.floor(u/65536),me=u-_*65536,u=Be+_+65535,_=Math.floor(u/65536),Be=u-_*65536,u=$e+_+65535,_=Math.floor(u/65536),$e=u-_*65536,u=ye+_+65535,_=Math.floor(u/65536),ye=u-_*65536,u=pe+_+65535,_=Math.floor(u/65536),pe=u-_*65536,u=le+_+65535,_=Math.floor(u/65536),le=u-_*65536,u=ue+_+65535,_=Math.floor(u/65536),ue=u-_*65536,u=ce+_+65535,_=Math.floor(u/65536),ce=u-_*65536,u=oe+_+65535,_=Math.floor(u/65536),oe=u-_*65536,u=se+_+65535,_=Math.floor(u/65536),se=u-_*65536,u=te+_+65535,_=Math.floor(u/65536),te=u-_*65536,H+=_-1+37*(_-1),T[0]=H,T[1]=W,T[2]=he,T[3]=ve,T[4]=de,T[5]=me,T[6]=Be,T[7]=$e,T[8]=ye,T[9]=pe,T[10]=le,T[11]=ue,T[12]=ce,T[13]=oe,T[14]=se,T[15]=te}function d(T,A){c(T,A,A)}function U(T,A){const O=i();let u;for(u=0;u<16;u++)O[u]=A[u];for(u=253;u>=0;u--)d(O,O),u!==2&&u!==4&&c(O,O,A);for(u=0;u<16;u++)T[u]=O[u]}function K(T,A){const O=i();let u;for(u=0;u<16;u++)O[u]=A[u];for(u=250;u>=0;u--)d(O,O),u!==1&&c(O,O,A);for(u=0;u<16;u++)T[u]=O[u]}function G(T,A){const O=i(),u=i(),_=i(),H=i(),W=i(),he=i(),ve=i(),de=i(),me=i();E(O,T[1],T[0]),E(me,A[1],A[0]),c(O,O,me),x(u,T[0],T[1]),x(me,A[0],A[1]),c(u,u,me),c(_,T[3],A[3]),c(_,_,f),c(H,T[2],A[2]),x(H,H,H),E(W,u,O),E(he,H,_),x(ve,H,_),x(de,u,O),c(T[0],W,he),c(T[1],de,ve),c(T[2],ve,he),c(T[3],W,de)}function J(T,A,O){for(let u=0;u<4;u++)N(T[u],A[u],O)}function X(T,A){const O=i(),u=i(),_=i();U(_,A[2]),c(O,A[0],_),c(u,A[1],_),R(T,u),T[31]^=I(O)<<7}function g(T,A,O){m(T[0],o),m(T[1],a),m(T[2],a),m(T[3],o);for(let u=255;u>=0;--u){const _=O[u/8|0]>>(u&7)&1;J(T,A,_),G(A,T),G(T,T),J(T,A,_)}}function v(T,A){const O=[i(),i(),i(),i()];m(O[0],l),m(O[1],D),m(O[2],a),c(O[3],l,D),g(T,O,A)}function F(T){if(T.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const A=(0,r.hash)(T);A[0]&=248,A[31]&=127,A[31]|=64;const O=new Uint8Array(32),u=[i(),i(),i(),i()];v(u,A),X(O,u);const _=new Uint8Array(64);return _.set(T),_.set(O,32),{publicKey:O,secretKey:_}}t.generateKeyPairFromSeed=F;function M(T){const A=(0,e.randomBytes)(32,T),O=F(A);return(0,n.wipe)(A),O}t.generateKeyPair=M;function P(T){if(T.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(T.subarray(32))}t.extractPublicKeyFromSecretKey=P;const C=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function j(T,A){let O,u,_,H;for(u=63;u>=32;--u){for(O=0,_=u-32,H=u-12;_<H;++_)A[_]+=O-16*A[u]*C[_-(u-32)],O=Math.floor((A[_]+128)/256),A[_]-=O*256;A[_]+=O,A[u]=0}for(O=0,_=0;_<32;_++)A[_]+=O-(A[31]>>4)*C[_],O=A[_]>>8,A[_]&=255;for(_=0;_<32;_++)A[_]-=O*C[_];for(u=0;u<32;u++)A[u+1]+=A[u]>>8,T[u]=A[u]&255}function z(T){const A=new Float64Array(64);for(let O=0;O<64;O++)A[O]=T[O];for(let O=0;O<64;O++)T[O]=0;j(T,A)}function Q(T,A){const O=new Float64Array(64),u=[i(),i(),i(),i()],_=(0,r.hash)(T.subarray(0,32));_[0]&=248,_[31]&=127,_[31]|=64;const H=new Uint8Array(64);H.set(_.subarray(32),32);const W=new r.SHA512;W.update(H.subarray(32)),W.update(A);const he=W.digest();W.clean(),z(he),v(u,he),X(H,u),W.reset(),W.update(H.subarray(0,32)),W.update(T.subarray(32)),W.update(A);const ve=W.digest();z(ve);for(let de=0;de<32;de++)O[de]=he[de];for(let de=0;de<32;de++)for(let me=0;me<32;me++)O[de+me]+=ve[de]*_[me];return j(H.subarray(32),O),H}t.sign=Q;function q(T,A){const O=i(),u=i(),_=i(),H=i(),W=i(),he=i(),ve=i();return m(T[2],a),y(T[1],A),d(_,T[1]),c(H,_,h),E(_,_,T[2]),x(H,T[2],H),d(W,H),d(he,W),c(ve,he,W),c(O,ve,_),c(O,O,H),K(O,O),c(O,O,_),c(O,O,H),c(O,O,H),c(T[0],O,H),d(u,T[0]),c(u,u,H),S(u,_)&&c(T[0],T[0],b),d(u,T[0]),c(u,u,H),S(u,_)?-1:(I(T[0])===A[31]>>7&&E(T[0],o,T[0]),c(T[3],T[0],T[1]),0)}function ee(T,A,O){const u=new Uint8Array(32),_=[i(),i(),i(),i()],H=[i(),i(),i(),i()];if(O.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(q(H,T))return!1;const W=new r.SHA512;W.update(O.subarray(0,32)),W.update(T),W.update(A);const he=W.digest();return z(he),g(_,H,he),v(H,O.subarray(32)),G(_,H),X(u,_),!B(O,u)}t.verify=ee;function Y(T){let A=[i(),i(),i(),i()];if(q(A,T))throw new Error("Ed25519: invalid public key");let O=i(),u=i(),_=A[1];x(O,a,_),E(u,a,_),U(u,u),c(O,O,u);let H=new Uint8Array(32);return R(H,O),H}t.convertPublicKeyToX25519=Y;function ae(T){const A=(0,r.hash)(T.subarray(0,32));A[0]&=248,A[31]&=127,A[31]|=64;const O=new Uint8Array(A.subarray(0,32));return(0,n.wipe)(A),O}t.convertSecretKeyToX25519=ae}(Qi);const iv="EdDSA",sv="JWT",oc=".",ac="base64url",ov="utf8",av="utf8",cv=":",uv="did",fv="key",cc="base58btc",hv="z",lv="K36",dv=32;function Ln(t){return dt(lt(Ir(t),ov),ac)}function uc(t){const e=lt(lv,cc),r=hv+dt(li([e,t]),cc);return[uv,fv,r].join(cv)}function pv(t){return dt(t,ac)}function gv(t){return lt([Ln(t.header),Ln(t.payload)].join(oc),av)}function yv(t){return[Ln(t.header),Ln(t.payload),pv(t.signature)].join(oc)}function fc(t=lr.randomBytes(dv)){return Qi.generateKeyPairFromSeed(t)}async function vv(t,e,r,n,i=Z.fromMiliseconds(Date.now())){const s={alg:iv,typ:sv},o=uc(n.publicKey),a=i+r,h={iss:o,sub:t,aud:e,iat:i,exp:a},f=gv({header:s,payload:h}),l=Qi.sign(n.secretKey,f);return yv({header:s,payload:h,signature:l})}var es={exports:{}},mr=typeof Reflect=="object"?Reflect:null,hc=mr&&typeof mr.apply=="function"?mr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},In;mr&&typeof mr.ownKeys=="function"?In=mr.ownKeys:Object.getOwnPropertySymbols?In=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:In=function(e){return Object.getOwnPropertyNames(e)};function _v(t){console&&console.warn&&console.warn(t)}var lc=Number.isNaN||function(e){return e!==e};function Ie(){Ie.init.call(this)}es.exports=Ie,es.exports.once=Ev,Ie.EventEmitter=Ie,Ie.prototype._events=void 0,Ie.prototype._eventsCount=0,Ie.prototype._maxListeners=void 0;var dc=10;function An(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ie,"defaultMaxListeners",{enumerable:!0,get:function(){return dc},set:function(t){if(typeof t!="number"||t<0||lc(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");dc=t}}),Ie.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},Ie.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||lc(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 pc(t){return t._maxListeners===void 0?Ie.defaultMaxListeners:t._maxListeners}Ie.prototype.getMaxListeners=function(){return pc(this)},Ie.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 o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")hc(h,this,r);else for(var f=h.length,l=bc(h,f),n=0;n<f;++n)hc(l[n],this,r);return!0};function gc(t,e,r,n){var i,s,o;if(An(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),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=pc(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,_v(a)}return t}Ie.prototype.addListener=function(e,r){return gc(this,e,r,!1)},Ie.prototype.on=Ie.prototype.addListener,Ie.prototype.prependListener=function(e,r){return gc(this,e,r,!0)};function bv(){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 yc(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=bv.bind(n);return i.listener=r,n.wrapFn=i,i}Ie.prototype.once=function(e,r){return An(r),this.on(e,yc(this,e,r)),this},Ie.prototype.prependOnceListener=function(e,r){return An(r),this.prependListener(e,yc(this,e,r)),this},Ie.prototype.removeListener=function(e,r){var n,i,s,o,a;if(An(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,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():mv(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Ie.prototype.off=Ie.prototype.removeListener,Ie.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),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);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 vc(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?wv(i):bc(i,i.length)}Ie.prototype.listeners=function(e){return vc(this,e,!0)},Ie.prototype.rawListeners=function(e){return vc(this,e,!1)},Ie.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):_c.call(t,e)},Ie.prototype.listenerCount=_c;function _c(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}Ie.prototype.eventNames=function(){return this._eventsCount>0?In(this._events):[]};function bc(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function mv(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function wv(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Ev(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}mc(t,e,s,{once:!0}),e!=="error"&&Dv(t,i,{once:!0})})}function Dv(t,e,r){typeof t.on=="function"&&mc(t,"error",e,r)}function mc(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)}const wc=10,xv=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:require("ws"),Sv=()=>typeof window<"u",Ov=xv();class Lv{constructor(e){if(this.url=e,this.events=new es.exports.EventEmitter,this.registering=!1,!Ms(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(){if(typeof this.socket>"u")throw new Error("Connection already closed");this.socket.close(),this.onClose()}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Ir(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!Ms(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=Ts.isReactNative()?void 0:{rejectUnauthorized:!Tf(e)},s=new Ov(e,[],i);Sv()?s.onerror=o=>{const a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=()=>this.onClose(),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(){this.socket=void 0,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?ni(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=Lr(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return As(e,r,"WS")}resetMaxListeners(){this.events.getMaxListeners()>wc&&this.events.setMaxListeners(wc)}emitError(e){const r=this.parseError(new Error(e?.message||`WebSocket connection failed for URL: ${this.url}`));return this.events.emit("register_error",r),r}}var ts={exports:{}};(function(t,e){var r=200,n="__lodash_hash_undefined__",i=1,s=2,o=9007199254740991,a="[object Arguments]",h="[object Array]",f="[object AsyncFunction]",l="[object Boolean]",D="[object Date]",b="[object Error]",m="[object Function]",w="[object GeneratorFunction]",N="[object Map]",R="[object Number]",B="[object Null]",S="[object Object]",I="[object Promise]",y="[object Proxy]",x="[object RegExp]",E="[object Set]",c="[object String]",d="[object Symbol]",U="[object Undefined]",K="[object WeakMap]",G="[object ArrayBuffer]",J="[object DataView]",X="[object Float32Array]",g="[object Float64Array]",v="[object Int8Array]",F="[object Int16Array]",M="[object Int32Array]",P="[object Uint8Array]",C="[object Uint8ClampedArray]",j="[object Uint16Array]",z="[object Uint32Array]",Q=/[\\^$.*+?()[\]{}|]/g,q=/^\[object .+?Constructor\]$/,ee=/^(?:0|[1-9]\d*)$/,Y={};Y[X]=Y[g]=Y[v]=Y[F]=Y[M]=Y[P]=Y[C]=Y[j]=Y[z]=!0,Y[a]=Y[h]=Y[G]=Y[l]=Y[J]=Y[D]=Y[b]=Y[m]=Y[N]=Y[R]=Y[S]=Y[x]=Y[E]=Y[c]=Y[K]=!1;var ae=typeof ke=="object"&&ke&&ke.Object===Object&&ke,T=typeof self=="object"&&self&&self.Object===Object&&self,A=ae||T||Function("return this")(),O=e&&!e.nodeType&&e,u=O&&!0&&t&&!t.nodeType&&t,_=u&&u.exports===O,H=_&&ae.process,W=function(){try{return H&&H.binding&&H.binding("util")}catch{}}(),he=W&&W.isTypedArray;function ve(p,L){for(var $=-1,k=p==null?0:p.length,Re=0,ie=[];++$<k;){var Ue=p[$];L(Ue,$,p)&&(ie[Re++]=Ue)}return ie}function de(p,L){for(var $=-1,k=L.length,Re=p.length;++$<k;)p[Re+$]=L[$];return p}function me(p,L){for(var $=-1,k=p==null?0:p.length;++$<k;)if(L(p[$],$,p))return!0;return!1}function Be(p,L){for(var $=-1,k=Array(p);++$<p;)k[$]=L($);return k}function $e(p){return function(L){return p(L)}}function ye(p,L){return p.has(L)}function pe(p,L){return p?.[L]}function le(p){var L=-1,$=Array(p.size);return p.forEach(function(k,Re){$[++L]=[Re,k]}),$}function ue(p,L){return function($){return p(L($))}}function ce(p){var L=-1,$=Array(p.size);return p.forEach(function(k){$[++L]=k}),$}var oe=Array.prototype,se=Function.prototype,te=Object.prototype,fe=A["__core-js_shared__"],ge=se.toString,ne=te.hasOwnProperty,_e=function(){var p=/[^.]+$/.exec(fe&&fe.keys&&fe.keys.IE_PROTO||"");return p?"Symbol(src)_1."+p:""}(),be=te.toString,Ee=RegExp("^"+ge.call(ne).replace(Q,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),De=_?A.Buffer:void 0,we=A.Symbol,Lt=A.Uint8Array,$t=te.propertyIsEnumerable,kt=oe.splice,mt=we?we.toStringTag:void 0,ar=Object.getOwnPropertySymbols,Qr=De?De.isBuffer:void 0,Bn=ue(Object.keys,Object),ze=Dr(A,"DataView"),Fe=Dr(A,"Map"),Ke=Dr(A,"Promise"),qe=Dr(A,"Set"),He=Dr(A,"WeakMap"),Me=Dr(Object,"create"),Je=ur(ze),Xe=ur(Fe),Ze=ur(Ke),Qe=ur(qe),et=ur(He),We=we?we.prototype:void 0,Ve=We?We.valueOf:void 0;function Pe(p){var L=-1,$=p==null?0:p.length;for(this.clear();++L<$;){var k=p[L];this.set(k[0],k[1])}}function tt(){this.__data__=Me?Me(null):{},this.size=0}function rt(p){var L=this.has(p)&&delete this.__data__[p];return this.size-=L?1:0,L}function Ib(p){var L=this.__data__;if(Me){var $=L[p];return $===n?void 0:$}return ne.call(L,p)?L[p]:void 0}function Ab(p){var L=this.__data__;return Me?L[p]!==void 0:ne.call(L,p)}function Tb(p,L){var $=this.__data__;return this.size+=this.has(p)?0:1,$[p]=Me&&L===void 0?n:L,this}Pe.prototype.clear=tt,Pe.prototype.delete=rt,Pe.prototype.get=Ib,Pe.prototype.has=Ab,Pe.prototype.set=Tb;function qt(p){var L=-1,$=p==null?0:p.length;for(this.clear();++L<$;){var k=p[L];this.set(k[0],k[1])}}function Cb(){this.__data__=[],this.size=0}function Rb(p){var L=this.__data__,$=Kn(L,p);if($<0)return!1;var k=L.length-1;return $==k?L.pop():kt.call(L,$,1),--this.size,!0}function Pb(p){var L=this.__data__,$=Kn(L,p);return $<0?void 0:L[$][1]}function Nb(p){return Kn(this.__data__,p)>-1}function $b(p,L){var $=this.__data__,k=Kn($,p);return k<0?(++this.size,$.push([p,L])):$[k][1]=L,this}qt.prototype.clear=Cb,qt.prototype.delete=Rb,qt.prototype.get=Pb,qt.prototype.has=Nb,qt.prototype.set=$b;function cr(p){var L=-1,$=p==null?0:p.length;for(this.clear();++L<$;){var k=p[L];this.set(k[0],k[1])}}function Fb(){this.size=0,this.__data__={hash:new Pe,map:new(Fe||qt),string:new Pe}}function Mb(p){var L=qn(this,p).delete(p);return this.size-=L?1:0,L}function Ub(p){return qn(this,p).get(p)}function jb(p){return qn(this,p).has(p)}function Bb(p,L){var $=qn(this,p),k=$.size;return $.set(p,L),this.size+=$.size==k?0:1,this}cr.prototype.clear=Fb,cr.prototype.delete=Mb,cr.prototype.get=Ub,cr.prototype.has=jb,cr.prototype.set=Bb;function zn(p){var L=-1,$=p==null?0:p.length;for(this.__data__=new cr;++L<$;)this.add(p[L])}function zb(p){return this.__data__.set(p,n),this}function Kb(p){return this.__data__.has(p)}zn.prototype.add=zn.prototype.push=zb,zn.prototype.has=Kb;function Yt(p){var L=this.__data__=new qt(p);this.size=L.size}function qb(){this.__data__=new qt,this.size=0}function Hb(p){var L=this.__data__,$=L.delete(p);return this.size=L.size,$}function Vb(p){return this.__data__.get(p)}function Gb(p){return this.__data__.has(p)}function Wb(p,L){var $=this.__data__;if($ instanceof qt){var k=$.__data__;if(!Fe||k.length<r-1)return k.push([p,L]),this.size=++$.size,this;$=this.__data__=new cr(k)}return $.set(p,L),this.size=$.size,this}Yt.prototype.clear=qb,Yt.prototype.delete=Hb,Yt.prototype.get=Vb,Yt.prototype.has=Gb,Yt.prototype.set=Wb;function kb(p,L){var $=Hn(p),k=!$&&u1(p),Re=!$&&!k&&ps(p),ie=!$&&!k&&!Re&&$u(p),Ue=$||k||Re||ie,nt=Ue?Be(p.length,String):[],at=nt.length;for(var Ne in p)(L||ne.call(p,Ne))&&!(Ue&&(Ne=="length"||Re&&(Ne=="offset"||Ne=="parent")||ie&&(Ne=="buffer"||Ne=="byteLength"||Ne=="byteOffset")||i1(Ne,at)))&&nt.push(Ne);return nt}function Kn(p,L){for(var $=p.length;$--;)if(Cu(p[$][0],L))return $;return-1}function Yb(p,L,$){var k=L(p);return Hn(p)?k:de(k,$(p))}function en(p){return p==null?p===void 0?U:B:mt&&mt in Object(p)?r1(p):c1(p)}function Lu(p){return tn(p)&&en(p)==a}function Iu(p,L,$,k,Re){return p===L?!0:p==null||L==null||!tn(p)&&!tn(L)?p!==p&&L!==L:Jb(p,L,$,k,Iu,Re)}function Jb(p,L,$,k,Re,ie){var Ue=Hn(p),nt=Hn(L),at=Ue?h:Jt(p),Ne=nt?h:Jt(L);at=at==a?S:at,Ne=Ne==a?S:Ne;var wt=at==S,It=Ne==S,ut=at==Ne;if(ut&&ps(p)){if(!ps(L))return!1;Ue=!0,wt=!1}if(ut&&!wt)return ie||(ie=new Yt),Ue||$u(p)?Au(p,L,$,k,Re,ie):e1(p,L,at,$,k,Re,ie);if(!($&i)){var Dt=wt&&ne.call(p,"__wrapped__"),xt=It&&ne.call(L,"__wrapped__");if(Dt||xt){var Xt=Dt?p.value():p,Ht=xt?L.value():L;return ie||(ie=new Yt),Re(Xt,Ht,$,k,ie)}}return ut?(ie||(ie=new Yt),t1(p,L,$,k,Re,ie)):!1}function Xb(p){if(!Nu(p)||o1(p))return!1;var L=Ru(p)?Ee:q;return L.test(ur(p))}function Zb(p){return tn(p)&&Pu(p.length)&&!!Y[en(p)]}function Qb(p){if(!a1(p))return Bn(p);var L=[];for(var $ in Object(p))ne.call(p,$)&&$!="constructor"&&L.push($);return L}function Au(p,L,$,k,Re,ie){var Ue=$&i,nt=p.length,at=L.length;if(nt!=at&&!(Ue&&at>nt))return!1;var Ne=ie.get(p);if(Ne&&ie.get(L))return Ne==L;var wt=-1,It=!0,ut=$&s?new zn:void 0;for(ie.set(p,L),ie.set(L,p);++wt<nt;){var Dt=p[wt],xt=L[wt];if(k)var Xt=Ue?k(xt,Dt,wt,L,p,ie):k(Dt,xt,wt,p,L,ie);if(Xt!==void 0){if(Xt)continue;It=!1;break}if(ut){if(!me(L,function(Ht,fr){if(!ye(ut,fr)&&(Dt===Ht||Re(Dt,Ht,$,k,ie)))return ut.push(fr)})){It=!1;break}}else if(!(Dt===xt||Re(Dt,xt,$,k,ie))){It=!1;break}}return ie.delete(p),ie.delete(L),It}function e1(p,L,$,k,Re,ie,Ue){switch($){case J:if(p.byteLength!=L.byteLength||p.byteOffset!=L.byteOffset)return!1;p=p.buffer,L=L.buffer;case G:return!(p.byteLength!=L.byteLength||!ie(new Lt(p),new Lt(L)));case l:case D:case R:return Cu(+p,+L);case b:return p.name==L.name&&p.message==L.message;case x:case c:return p==L+"";case N:var nt=le;case E:var at=k&i;if(nt||(nt=ce),p.size!=L.size&&!at)return!1;var Ne=Ue.get(p);if(Ne)return Ne==L;k|=s,Ue.set(p,L);var wt=Au(nt(p),nt(L),k,Re,ie,Ue);return Ue.delete(p),wt;case d:if(Ve)return Ve.call(p)==Ve.call(L)}return!1}function t1(p,L,$,k,Re,ie){var Ue=$&i,nt=Tu(p),at=nt.length,Ne=Tu(L),wt=Ne.length;if(at!=wt&&!Ue)return!1;for(var It=at;It--;){var ut=nt[It];if(!(Ue?ut in L:ne.call(L,ut)))return!1}var Dt=ie.get(p);if(Dt&&ie.get(L))return Dt==L;var xt=!0;ie.set(p,L),ie.set(L,p);for(var Xt=Ue;++It<at;){ut=nt[It];var Ht=p[ut],fr=L[ut];if(k)var Fu=Ue?k(fr,Ht,ut,L,p,ie):k(Ht,fr,ut,p,L,ie);if(!(Fu===void 0?Ht===fr||Re(Ht,fr,$,k,ie):Fu)){xt=!1;break}Xt||(Xt=ut=="constructor")}if(xt&&!Xt){var Vn=p.constructor,Gn=L.constructor;Vn!=Gn&&"constructor"in p&&"constructor"in L&&!(typeof Vn=="function"&&Vn instanceof Vn&&typeof Gn=="function"&&Gn instanceof Gn)&&(xt=!1)}return ie.delete(p),ie.delete(L),xt}function Tu(p){return Yb(p,l1,n1)}function qn(p,L){var $=p.__data__;return s1(L)?$[typeof L=="string"?"string":"hash"]:$.map}function Dr(p,L){var $=pe(p,L);return Xb($)?$:void 0}function r1(p){var L=ne.call(p,mt),$=p[mt];try{p[mt]=void 0;var k=!0}catch{}var Re=be.call(p);return k&&(L?p[mt]=$:delete p[mt]),Re}var n1=ar?function(p){return p==null?[]:(p=Object(p),ve(ar(p),function(L){return $t.call(p,L)}))}:d1,Jt=en;(ze&&Jt(new ze(new ArrayBuffer(1)))!=J||Fe&&Jt(new Fe)!=N||Ke&&Jt(Ke.resolve())!=I||qe&&Jt(new qe)!=E||He&&Jt(new He)!=K)&&(Jt=function(p){var L=en(p),$=L==S?p.constructor:void 0,k=$?ur($):"";if(k)switch(k){case Je:return J;case Xe:return N;case Ze:return I;case Qe:return E;case et:return K}return L});function i1(p,L){return L=L??o,!!L&&(typeof p=="number"||ee.test(p))&&p>-1&&p%1==0&&p<L}function s1(p){var L=typeof p;return L=="string"||L=="number"||L=="symbol"||L=="boolean"?p!=="__proto__":p===null}function o1(p){return!!_e&&_e in p}function a1(p){var L=p&&p.constructor,$=typeof L=="function"&&L.prototype||te;return p===$}function c1(p){return be.call(p)}function ur(p){if(p!=null){try{return ge.call(p)}catch{}try{return p+""}catch{}}return""}function Cu(p,L){return p===L||p!==p&&L!==L}var u1=Lu(function(){return arguments}())?Lu:function(p){return tn(p)&&ne.call(p,"callee")&&!$t.call(p,"callee")},Hn=Array.isArray;function f1(p){return p!=null&&Pu(p.length)&&!Ru(p)}var ps=Qr||p1;function h1(p,L){return Iu(p,L)}function Ru(p){if(!Nu(p))return!1;var L=en(p);return L==m||L==w||L==f||L==y}function Pu(p){return typeof p=="number"&&p>-1&&p%1==0&&p<=o}function Nu(p){var L=typeof p;return p!=null&&(L=="object"||L=="function")}function tn(p){return p!=null&&typeof p=="object"}var $u=he?$e(he):Zb;function l1(p){return f1(p)?kb(p):Qb(p)}function d1(){return[]}function p1(){return!1}t.exports=h1})(ts,ts.exports);var Iv=ts.exports,Av=Object.defineProperty,Ec=Object.getOwnPropertySymbols,Tv=Object.prototype.hasOwnProperty,Cv=Object.prototype.propertyIsEnumerable,Dc=(t,e,r)=>e in t?Av(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ht=(t,e)=>{for(var r in e||(e={}))Tv.call(e,r)&&Dc(t,r,e[r]);if(Ec)for(var r of Ec(e))Cv.call(e,r)&&Dc(t,r,e[r]);return t};function Rv(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),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=i}var a=t.length,h=t.charAt(0),f=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function D(w){if(w instanceof Uint8Array||(ArrayBuffer.isView(w)?w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):Array.isArray(w)&&(w=Uint8Array.from(w))),!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(w.length===0)return"";for(var N=0,R=0,B=0,S=w.length;B!==S&&w[B]===0;)B++,N++;for(var I=(S-B)*l+1>>>0,y=new Uint8Array(I);B!==S;){for(var x=w[B],E=0,c=I-1;(x!==0||E<R)&&c!==-1;c--,E++)x+=256*y[c]>>>0,y[c]=x%a>>>0,x=x/a>>>0;if(x!==0)throw new Error("Non-zero carry");R=E,B++}for(var d=I-R;d!==I&&y[d]===0;)d++;for(var U=h.repeat(N);d<I;++d)U+=t.charAt(y[d]);return U}function b(w){if(typeof w!="string")throw new TypeError("Expected String");if(w.length===0)return new Uint8Array;var N=0;if(w[N]!==" "){for(var R=0,B=0;w[N]===h;)R++,N++;for(var S=(w.length-N)*f+1>>>0,I=new Uint8Array(S);w[N];){var y=r[w.charCodeAt(N)];if(y===255)return;for(var x=0,E=S-1;(y!==0||x<B)&&E!==-1;E--,x++)y+=a*I[E]>>>0,I[E]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");B=x,N++}if(w[N]!==" "){for(var c=S-B;c!==S&&I[c]===0;)c++;for(var d=new Uint8Array(R+(S-c)),U=R;c!==S;)d[U++]=I[c++];return d}}}function m(w){var N=b(w);if(N)return N;throw new Error(`Non-${e} character`)}return{encode:D,decodeUnsafe:b,decode:m}}var Pv=Rv,Nv=Pv;const xc=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")},$v=t=>new TextEncoder().encode(t),Fv=t=>new TextDecoder().decode(t);class Mv{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 Uv{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 Sc(this,e)}}class jv{constructor(e){this.decoders=e}or(e){return Sc(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 Sc=(t,e)=>new jv(ht(ht({},t.decoders||{[t.prefix]:t}),e.decoders||{[e.prefix]:e}));class Bv{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Mv(e,r,n),this.decoder=new Uv(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Tn=({name:t,prefix:e,encode:r,decode:n})=>new Bv(t,e,r,n),Jr=({prefix:t,name:e,alphabet:r})=>{const{encode:n,decode:i}=Nv(r,e);return Tn({prefix:t,name:e,encode:n,decode:s=>xc(i(s))})},zv=(t,e,r,n)=>{const i={};for(let l=0;l<e.length;++l)i[e[l]]=l;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let a=0,h=0,f=0;for(let l=0;l<s;++l){const D=i[t[l]];if(D===void 0)throw new SyntaxError(`Non-${n} character`);h=h<<r|D,a+=r,a>=8&&(a-=8,o[f++]=255&h>>a)}if(a>=r||255&h<<8-a)throw new SyntaxError("Unexpected end of data");return o},Kv=(t,e,r)=>{const n=e[e.length-1]==="=",i=(1<<r)-1;let s="",o=0,a=0;for(let h=0;h<t.length;++h)for(a=a<<8|t[h],o+=8;o>r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s},ot=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Tn({prefix:e,name:t,encode(i){return Kv(i,n,r)},decode(i){return zv(i,n,r,t)}}),qv=Tn({prefix:"\0",name:"identity",encode:t=>Fv(t),decode:t=>$v(t)});var Hv=Object.freeze({__proto__:null,identity:qv});const Vv=ot({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Gv=Object.freeze({__proto__:null,base2:Vv});const Wv=ot({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var kv=Object.freeze({__proto__:null,base8:Wv});const Yv=Jr({prefix:"9",name:"base10",alphabet:"0123456789"});var Jv=Object.freeze({__proto__:null,base10:Yv});const Xv=ot({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Zv=ot({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Qv=Object.freeze({__proto__:null,base16:Xv,base16upper:Zv});const e0=ot({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),t0=ot({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),r0=ot({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),n0=ot({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),i0=ot({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),s0=ot({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),o0=ot({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),a0=ot({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),c0=ot({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var u0=Object.freeze({__proto__:null,base32:e0,base32upper:t0,base32pad:r0,base32padupper:n0,base32hex:i0,base32hexupper:s0,base32hexpad:o0,base32hexpadupper:a0,base32z:c0});const f0=Jr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),h0=Jr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var l0=Object.freeze({__proto__:null,base36:f0,base36upper:h0});const d0=Jr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),p0=Jr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var g0=Object.freeze({__proto__:null,base58btc:d0,base58flickr:p0});const y0=ot({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),v0=ot({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),_0=ot({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),b0=ot({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var m0=Object.freeze({__proto__:null,base64:y0,base64pad:v0,base64url:_0,base64urlpad:b0});const Oc=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}"),w0=Oc.reduce((t,e,r)=>(t[r]=e,t),[]),E0=Oc.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function D0(t){return t.reduce((e,r)=>(e+=w0[r],e),"")}function x0(t){const e=[];for(const r of t){const n=E0[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}const S0=Tn({prefix:"\u{1F680}",name:"base256emoji",encode:D0,decode:x0});var O0=Object.freeze({__proto__:null,base256emoji:S0}),L0=Ic,Lc=128,I0=127,A0=~I0,T0=Math.pow(2,31);function Ic(t,e,r){e=e||[],r=r||0;for(var n=r;t>=T0;)e[r++]=t&255|Lc,t/=128;for(;t&A0;)e[r++]=t&255|Lc,t>>>=7;return e[r]=t|0,Ic.bytes=r-n+1,e}var C0=rs,R0=128,Ac=127;function rs(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw rs.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&Ac)<<i:(o&Ac)*Math.pow(2,i),i+=7}while(o>=R0);return rs.bytes=s-n,r}var P0=Math.pow(2,7),N0=Math.pow(2,14),$0=Math.pow(2,21),F0=Math.pow(2,28),M0=Math.pow(2,35),U0=Math.pow(2,42),j0=Math.pow(2,49),B0=Math.pow(2,56),z0=Math.pow(2,63),K0=function(t){return t<P0?1:t<N0?2:t<$0?3:t<F0?4:t<M0?5:t<U0?6:t<j0?7:t<B0?8:t<z0?9:10},q0={encode:L0,decode:C0,encodingLength:K0},Tc=q0;const Cc=(t,e,r=0)=>(Tc.encode(t,e,r),e),Rc=t=>Tc.encodingLength(t),ns=(t,e)=>{const r=e.byteLength,n=Rc(t),i=n+Rc(r),s=new Uint8Array(i+r);return Cc(t,s,0),Cc(r,s,n),s.set(e,i),new H0(t,r,e,s)};class H0{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}const Pc=({name:t,code:e,encode:r})=>new V0(t,e,r);class V0{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?ns(this.code,r):r.then(n=>ns(this.code,n))}else throw Error("Unknown type, must be binary type")}}const Nc=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),G0=Pc({name:"sha2-256",code:18,encode:Nc("SHA-256")}),W0=Pc({name:"sha2-512",code:19,encode:Nc("SHA-512")});var k0=Object.freeze({__proto__:null,sha256:G0,sha512:W0});const $c=0,Y0="identity",Fc=xc;var J0=Object.freeze({__proto__:null,identity:{code:$c,name:Y0,encode:Fc,digest:t=>ns($c,Fc(t))}});new TextEncoder,new TextDecoder;const Mc=ht(ht(ht(ht(ht(ht(ht(ht(ht(ht({},Hv),Gv),kv),Jv),Qv),u0),l0),g0),m0),O0);ht(ht({},k0),J0);function X0(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Uc(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}const jc=Uc("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),is=Uc("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=X0(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Z0=ht({utf8:jc,"utf-8":jc,hex:Mc.base16,latin1:is,ascii:is,binary:is},Mc);function Q0(t,e="utf8"){const r=Z0[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,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}const Bc="wc",e_=2,ss="core",Wt=`${Bc}@${2}:${ss}:`,t_={name:ss,logger:"error"},r_={database:":memory:"},n_="crypto",zc="client_ed25519_seed",i_=Z.ONE_DAY,s_="keychain",o_="0.3",a_="messages",c_="0.3",u_=Z.SIX_HOURS,f_="publisher",Kc="irn",h_="error",l_="wss://relay.walletconnect.com",d_="relayer",vt={message:"relayer_message",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed"},p_="_subscription",Cn={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},qc=Z.ONE_SECOND,g_="2.2.0",y_="0.3",Rt={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},v_="subscription",__="0.3",b_=Z.FIVE_SECONDS*1e3,m_="pairing",w_="0.3",Xr={wc_pairingDelete:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:0},res:{ttl:Z.ONE_DAY,prompt:!1,tag:0}}},Pt={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},E_="history",D_="0.3",x_="expirer",Et={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},S_="0.3";class O_{constructor(e,r){this.core=e,this.logger=r,this.keychain=new Map,this.name=s_,this.version=o_,this.initialized=!1,this.storagePrefix=Wt,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}=V("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=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Qo(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ea(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class L_{constructor(e,r,n){this.core=e,this.logger=r,this.name=n_,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=fc(i);return uc(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=Qd();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const s=await this.getClientSeed(),o=fc(s),a=Ri();return await vv(a,i,i_,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),h=ep(a,s);return this.setSymKey(h,o)},this.setSymKey=async(i,s)=>{this.isInitialized();const o=s||tp(i);return await this.keychain.set(o,i),o},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,o)=>{this.isInitialized();const a=Wo(o),h=Ir(s);if(ko(a)){const b=a.senderPublicKey,m=a.receiverPublicKey;i=await this.generateSharedKey(b,m)}const f=this.getSymKey(i),{type:l,senderPublicKey:D}=a;return np({type:l,symKey:f,message:h,senderPublicKey:D})},this.decode=async(i,s,o)=>{this.isInitialized();const a=op(s,o);if(ko(a)){const l=a.receiverPublicKey,D=a.senderPublicKey;i=await this.generateSharedKey(l,D)}const h=this.getSymKey(i),f=ip({symKey:h,encoded:s});return ni(f)},this.core=e,this.logger=Oe.generateChildLogger(r,this.name),this.keychain=n||new O_(this.core,this.logger)}get context(){return Oe.getLoggerContext(this.logger)}getPayloadType(e){const r=Ni(e);return $r(r.type)}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(zc)}catch{e=Ri(),await this.keychain.set(zc,e)}return Q0(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class I_ extends Jy{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=a_,this.version=c_,this.initialized=!1,this.storagePrefix=Wt,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=Pi(i);let o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),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),o=Pi(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Oe.generateChildLogger(e,this.name),this.core=r}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Qo(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ea(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class A_ extends Xy{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new zt.exports.EventEmitter,this.name=f_,this.queue=new Map,this.publishTimeout=1e4,this.publish=async(n,i,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{const o=s?.ttl||u_,a=$i(s),h=s?.prompt||!1,f=s?.tag||0,l={topic:n,message:i,opts:{ttl:o,relay:a,prompt:h,tag:f}},D=Pi(i);this.queue.set(D,l);try{await await ta(this.rpcPublish(n,i,o,a,h,f),this.publishTimeout)}catch{this.logger.debug("Publishing Payload stalled"),this.relayer.events.emit(vt.connection_stalled);return}this.onPublish(D,l),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},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=Oe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Oe.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o){var a,h,f,l;const D={method:Fi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o}};return bt((a=D.params)==null?void 0:a.prompt)&&((h=D.params)==null||delete h.prompt),bt((f=D.params)==null?void 0:f.tag)&&((l=D.params)==null||delete l.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:D}),this.relayer.provider.request(D)}onPublish(e,r){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(Vr.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}}class T_{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 C_=Object.defineProperty,R_=Object.defineProperties,P_=Object.getOwnPropertyDescriptors,Hc=Object.getOwnPropertySymbols,N_=Object.prototype.hasOwnProperty,$_=Object.prototype.propertyIsEnumerable,Vc=(t,e,r)=>e in t?C_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Rn=(t,e)=>{for(var r in e||(e={}))N_.call(e,r)&&Vc(t,r,e[r]);if(Hc)for(var r of Hc(e))$_.call(e,r)&&Vc(t,r,e[r]);return t},os=(t,e)=>R_(t,P_(e));class F_ extends ev{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new T_,this.events=new zt.exports.EventEmitter,this.name=v_,this.version=__,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pendingSubInterval=20,this.storagePrefix=Wt,this.subscribeTimeout=1e4,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable())},this.subscribe=async(n,i)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const s=$i(i),o={topic:n,relay:s};this.pending.set(n,o);const a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{const o=new Z.Watch;o.start(this.pendingSubscriptionWatchLabel);const a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),i(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=b_&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pendingSubInterval)}),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.restart=async()=>{await this.restore(),await this.reset()},this.relayer=e,this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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(),this.initialized=!1}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=$i(n);await this.rpcUnsubscribe(e,r,i);const s=Ge("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:Fi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let i;try{i=await await ta(this.relayer.provider.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(vt.connection_stalled)}return i}rpcUnsubscribe(e,r,n){const i={method:Fi(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.provider.request(i)}onSubscribe(e,r){this.setSubscription(e,os(Rn({},r),{id:e})),this.pending.delete(r.topic)}onResubscribe(e,r){this.addSubscription(e,os(Rn({},r),{id:e})),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.subscriptions.has(e)||(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,Rn({},r)),this.topicMap.set(r.topic,e),this.events.emit(Rt.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}=V("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(Rt.deleted,os(Rn({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Rt.sync)}async reset(){this.cached.length&&await Promise.all(this.cached.map(async e=>await this.resubscribe(e))),this.events.emit(Rt.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=V("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),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 resubscribe(e){if(!this.ids.includes(e.id)){const{topic:r,relay:n}=e,i={topic:r,relay:n};this.pending.set(i.topic,i);const s=await this.rpcSubscribe(i.topic,i.relay);this.onResubscribe(s,i)}}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}checkPending(){this.relayer.transportExplicitlyClosed||this.pending.forEach(async e=>{const r=await this.rpcSubscribe(e.topic,e.relay);this.onSubscribe(r,e)})}registerEventListeners(){this.relayer.core.heartbeat.on(Vr.HEARTBEAT_EVENTS.pulse,()=>{this.checkPending()}),this.relayer.on(vt.connect,async()=>{await this.onConnect()}),this.relayer.on(vt.disconnect,()=>{this.onDisconnect()}),this.events.on(Rt.created,async e=>{const r=Rt.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Rt.deleted,async e=>{const r=Rt.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}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}var M_=Object.defineProperty,Gc=Object.getOwnPropertySymbols,U_=Object.prototype.hasOwnProperty,j_=Object.prototype.propertyIsEnumerable,Wc=(t,e,r)=>e in t?M_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,B_=(t,e)=>{for(var r in e||(e={}))U_.call(e,r)&&Wc(t,r,e[r]);if(Gc)for(var r of Gc(e))j_.call(e,r)&&Wc(t,r,e[r]);return t};class z_ extends Zy{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new zt.exports.EventEmitter,this.name=d_,this.transportExplicitlyClosed=!1,this.initialized=!1,this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Oe.generateChildLogger(e.logger,this.name):_n(Oe.getDefaultLoggerOptions({level:e.logger||h_})),this.messages=new I_(this.logger,e.core),this.subscriber=new F_(this,this.logger),this.publisher=new A_(this,this.logger),this.relayUrl=e?.relayUrl||l_,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.provider=await this.createProvider(),await Promise.all([this.messages.init(),this.transportOpen(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return Oe.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r})}async subscribe(e,r){this.isInitialized();let n="";return await Promise.all([new Promise(i=>{this.subscriber.once(Rt.created,s=>{s.topic===e&&i()})}),new Promise(async i=>{n=await this.subscriber.subscribe(e,r),i()})]),n}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 transportClose(){this.transportExplicitlyClosed=!0,this.connected&&await this.provider.disconnect(),this.events.emit(vt.transport_closed)}async transportOpen(e){this.relayUrl=e||this.relayUrl,this.transportExplicitlyClosed=!1;try{await Promise.all([new Promise(r=>{this.initialized||r(),this.subscriber.once(Rt.resubscribed,()=>{r()})}),await Promise.race([this.provider.connect(),new Promise((r,n)=>this.once(vt.transport_closed,()=>{n()}))])])}catch(r){const n=r;if(!/socket hang up/i.test(n.message))throw new Error(n.message);this.logger.error(n),this.events.emit(vt.transport_closed)}}async restartTransport(e){await this.transportClose(),await new Promise(r=>setTimeout(r,qc)),await this.transportOpen(e)}async createProvider(){const e=await this.core.crypto.signJWT(this.relayUrl);return new ti(new Lv(mp({sdkVersion:g_,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e})))}async recordMessageEvent(e){const{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){const{topic:r,message:n}=e;return await this.subscriber.isSubscribed(r)?this.messages.has(r,n):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Qn(e)){if(!e.method.endsWith(p_))return;const r=e.params,{topic:n,message:i}=r.data,s={topic:n,message:i};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(B_({type:"event",event:r.id},s)),this.events.emit(r.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(vt.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=on(e.id,!0);await this.provider.connection.send(r)}registerEventListeners(){this.provider.on(Cn.payload,e=>this.onProviderPayload(e)),this.provider.on(Cn.connect,()=>{this.events.emit(vt.connect)}),this.provider.on(Cn.disconnect,()=>{this.events.emit(vt.disconnect),this.attemptToReconnect()}),this.provider.on(Cn.error,e=>this.events.emit(vt.error,e)),this.events.on(vt.connection_stalled,async()=>{await this.restartTransport()})}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.transportOpen()},Z.toMiliseconds(qc))}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}var K_=Object.defineProperty,kc=Object.getOwnPropertySymbols,q_=Object.prototype.hasOwnProperty,H_=Object.prototype.propertyIsEnumerable,Yc=(t,e,r)=>e in t?K_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Jc=(t,e)=>{for(var r in e||(e={}))q_.call(e,r)&&Yc(t,r,e[r]);if(kc)for(var r of kc(e))H_.call(e,r)&&Yc(t,r,e[r]);return t};class Pn extends Qy{constructor(e,r,n,i=Wt,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=y_,this.cached=[],this.initialized=!1,this.storagePrefix=Wt,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{zp(o)?this.map.set(o.id,o):Kp(o)?this.map.set(o.topic,o):this.getKey&&o!==null&&!bt(o)&&this.map.set(this.getKey(o),o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(h=>Iv(a[h],o[h]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const h=Jc(Jc({},this.getData(o)),a);this.map.set(o,h),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=Oe.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){const{message:n}=V("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}=V("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}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class V_{constructor(e,r){this.core=e,this.logger=r,this.name=m_,this.version=w_,this.events=new zt.exports,this.initialized=!1,this.storagePrefix=Wt,this.ignoredPayloadTypes=[rr],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=Ri(),i=await this.core.crypto.setSymKey(n),s=Bt(Z.FIVE_MINUTES),o={protocol:Kc},a={topic:i,expiry:s,relay:o,active:!1},h=Cp({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:h}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:i,symKey:s,relay:o}=Ap(n.uri),a=Bt(Z.FIVE_MINUTES),h={topic:i,relay:o,expiry:a,active:!1};return await this.pairings.set(i,h),await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}),this.core.expirer.set(i,a),n.activatePairing&&await this.activate({topic:i}),h},this.activate=async({topic:n})=>{this.isInitialized();const i=Bt(Z.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:o,resolve:a,reject:h}=nr();this.events.once(je("pairing_ping",s),({error:f})=>{f?h(f):a()}),await o()}},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",Ge("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{const o=sn(i,s),a=await this.core.crypto.encode(n,o),h=Xr[i].req;return this.core.history.set(n,o),await this.core.relayer.publish(n,a,h),o.id},this.sendResult=async(n,i,s)=>{const o=on(n,s),a=await this.core.crypto.encode(i,o),h=await this.core.history.get(i,n),f=Xr[h.request.method].res;await this.core.relayer.publish(i,a,f),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{const o=Lr(n,s),a=await this.core.crypto.encode(i,o),h=await this.core.history.get(i,n),f=Xr[h.request.method]?Xr[h.request.method].res:Xr.unregistered_method.res;await this.core.relayer.publish(i,a,f),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Ge("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=>Gt(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,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{const{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit("pairing_ping",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{const{id:s}=i;setTimeout(()=>{jt(i)?this.events.emit(je("pairing_ping",s),{}):Ot(i)&&this.events.emit(je("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.sendResult(s,n,!0),await this.deletePairing(n),this.events.emit("pairing_delete",{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=Ge("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Ge("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!yt(n)){const{message:i}=V("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!Bp(n.uri)){const{message:i}=V("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!yt(n)){const{message:s}=V("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!yt(n)){const{message:s}=V("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!st(n,!1)){const{message:i}=V("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=V("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(Gt(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=V("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Oe.generateChildLogger(r,this.name),this.pairings=new Pn(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Oe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(vt.message,async e=>{const{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const i=await this.core.crypto.decode(r,n);Qn(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):ei(i)&&(await this.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.core.expirer.on(Et.expired,async e=>{const{topic:r}=na(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit("pairing_expire",{topic:r}))})}}class G_ extends Yy{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new zt.exports.EventEmitter,this.name=E_,this.version=D_,this.cached=[],this.initialized=!1,this.storagePrefix=Wt,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 o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(Pt.created,o)},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=Ot(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(Pt.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(Pt.deleted,s)}})},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=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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:sn(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}=V("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Pt.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=V("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(Pt.created,e=>{const r=Pt.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Pt.updated,e=>{const r=Pt.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Pt.deleted,e=>{const r=Pt.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}class W_ extends tv{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new zt.exports.EventEmitter,this.name=x_,this.version=S_,this.cached=[],this.initialized=!1,this.storagePrefix=Wt,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),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Et.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{this.isInitialized();const i=this.formatTarget(n);if(this.has(i)){const s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Et.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=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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 wp(e);if(typeof e=="number")return Ep(e);const{message:r}=V("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(Et.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=V("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}=V("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){const{expiry:n}=r;Z.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Et.expired,{target:e,expiration:r})}checkExpirations(){this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Vr.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Et.created,e=>{const r=Et.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Et.expired,e=>{const r=Et.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Et.deleted,e=>{const r=Et.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}}var k_=Object.defineProperty,Xc=Object.getOwnPropertySymbols,Y_=Object.prototype.hasOwnProperty,J_=Object.prototype.propertyIsEnumerable,Zc=(t,e,r)=>e in t?k_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Qc=(t,e)=>{for(var r in e||(e={}))Y_.call(e,r)&&Zc(t,r,e[r]);if(Xc)for(var r of Xc(e))J_.call(e,r)&&Zc(t,r,e[r]);return t};class as extends ky{constructor(e){super(e),this.protocol=Bc,this.version=e_,this.name=ss,this.events=new zt.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;const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:_n(Oe.getDefaultLoggerOptions({level:e?.logger||t_.logger}));this.logger=Oe.generateChildLogger(r,this.name),this.heartbeat=new Vr.HeartBeat,this.crypto=new L_(this,this.logger,e?.keychain),this.history=new G_(this,this.logger),this.expirer=new W_(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new kg(Qc(Qc({},r_),e?.storageOptions)),this.relayer=new z_({core:this,logger:this.logger,relayUrl:e?.relayUrl,projectId:this.projectId}),this.pairing=new V_(this,this.logger)}static async init(e){const r=new as(e);return await r.initialize(),r}get context(){return Oe.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 Initilization Success")}catch(e){throw this.logger.warn(`Core Initilization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const X_=as;var Nn={exports:{}},wr=typeof Reflect=="object"?Reflect:null,eu=wr&&typeof wr.apply=="function"?wr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},$n;wr&&typeof wr.ownKeys=="function"?$n=wr.ownKeys:Object.getOwnPropertySymbols?$n=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:$n=function(e){return Object.getOwnPropertyNames(e)};function Z_(t){console&&console.warn&&console.warn(t)}var tu=Number.isNaN||function(e){return e!==e};function Ae(){Ae.init.call(this)}Nn.exports=Ae,Nn.exports.once=rb,Ae.EventEmitter=Ae,Ae.prototype._events=void 0,Ae.prototype._eventsCount=0,Ae.prototype._maxListeners=void 0;var ru=10;function Fn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Ae,"defaultMaxListeners",{enumerable:!0,get:function(){return ru},set:function(t){if(typeof t!="number"||t<0||tu(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");ru=t}}),Ae.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},Ae.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||tu(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 nu(t){return t._maxListeners===void 0?Ae.defaultMaxListeners:t._maxListeners}Ae.prototype.getMaxListeners=function(){return nu(this)},Ae.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 o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")eu(h,this,r);else for(var f=h.length,l=cu(h,f),n=0;n<f;++n)eu(l[n],this,r);return!0};function iu(t,e,r,n){var i,s,o;if(Fn(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),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=nu(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,Z_(a)}return t}Ae.prototype.addListener=function(e,r){return iu(this,e,r,!1)},Ae.prototype.on=Ae.prototype.addListener,Ae.prototype.prependListener=function(e,r){return iu(this,e,r,!0)};function Q_(){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 su(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Q_.bind(n);return i.listener=r,n.wrapFn=i,i}Ae.prototype.once=function(e,r){return Fn(r),this.on(e,su(this,e,r)),this},Ae.prototype.prependOnceListener=function(e,r){return Fn(r),this.prependListener(e,su(this,e,r)),this},Ae.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Fn(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,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():eb(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Ae.prototype.off=Ae.prototype.removeListener,Ae.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),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);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 ou(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?tb(i):cu(i,i.length)}Ae.prototype.listeners=function(e){return ou(this,e,!0)},Ae.prototype.rawListeners=function(e){return ou(this,e,!1)},Ae.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):au.call(t,e)},Ae.prototype.listenerCount=au;function au(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}Ae.prototype.eventNames=function(){return this._eventsCount>0?$n(this._events):[]};function cu(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function eb(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function tb(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function rb(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}uu(t,e,s,{once:!0}),e!=="error"&&nb(t,i,{once:!0})})}function nb(t,e,r){typeof t.on=="function"&&uu(t,"error",e,r)}function uu(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)}const fu="wc",hu=2,lu="client",cs=`${fu}@${hu}:${lu}:`,us={name:lu,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},ib="proposal",sb="session",Mn=Z.SEVEN_DAYS,ob="engine",Zr={wc_sessionPropose:{req:{ttl:Z.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Z.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Z.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Z.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Z.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Z.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Z.THIRTY_SECONDS,prompt:!1,tag:1115}}},ab="request";var cb=Object.defineProperty,ub=Object.defineProperties,fb=Object.getOwnPropertyDescriptors,du=Object.getOwnPropertySymbols,hb=Object.prototype.hasOwnProperty,lb=Object.prototype.propertyIsEnumerable,pu=(t,e,r)=>e in t?cb(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kt=(t,e)=>{for(var r in e||(e={}))hb.call(e,r)&&pu(t,r,e[r]);if(du)for(var r of du(e))lb.call(e,r)&&pu(t,r,e[r]);return t},fs=(t,e)=>ub(t,fb(e));class db extends nv{constructor(e){super(e),this.name=ob,this.events=new Nn.exports,this.initialized=!1,this.ignoredPayloadTypes=[rr],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(Zr)}),this.initialized=!0)},this.connect=async r=>{this.isInitialized(),await this.isValidConnect(r);const{pairingTopic:n,requiredNamespaces:i,relays:s}=r;let o=n,a,h=!1;if(o&&(h=this.client.core.pairing.pairings.get(o).active),!o||!h){const{topic:R,uri:B}=await this.client.core.pairing.create();o=R,a=B}const f=await this.client.core.crypto.generateKeyPair(),l={requiredNamespaces:i,relays:s??[{protocol:Kc}],proposer:{publicKey:f,metadata:this.client.metadata}},{reject:D,resolve:b,done:m}=nr();if(this.events.once(je("session_connect"),async({error:R,session:B})=>{if(R)D(R);else if(B){B.self.publicKey=f;const S=fs(Kt({},B),{requiredNamespaces:B.requiredNamespaces});await this.client.session.set(B.topic,S),await this.setExpiry(B.topic,B.expiry),o&&await this.client.core.pairing.updateMetadata({topic:o,metadata:B.peer.metadata}),b(S)}}),!o){const{message:R}=V("NO_MATCHING_KEY",`connect() pairing topic: ${o}`);throw new Error(R)}const w=await this.sendRequest(o,"wc_sessionPropose",l),N=Bt(Z.FIVE_MINUTES);return await this.setProposal(w,Kt({id:w,expiry:N},l)),{uri:a,approval:m}},this.pair=async r=>(this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{this.isInitialized(),await this.isValidApprove(r);const{id:n,relayProtocol:i,namespaces:s}=r,o=this.client.proposal.get(n);let{pairingTopic:a,proposer:h,requiredNamespaces:f}=o;yn(f)||(f=$p(s,"approve()"),this.client.proposal.set(n,fs(Kt({},o),{requiredNamespaces:f})));const l=await this.client.core.crypto.generateKeyPair(),D=h.publicKey,b=await this.client.core.crypto.generateSharedKey(l,D),m={relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,controller:{publicKey:l,metadata:this.client.metadata},expiry:Bt(Mn)};await this.client.core.relayer.subscribe(b);const w=await this.sendRequest(b,"wc_sessionSettle",m),{done:N,resolve:R,reject:B}=nr();this.events.once(je("session_approve",w),({error:I})=>{I?B(I):R(this.client.session.get(b))});const S=fs(Kt({},m),{topic:b,acknowledged:!1,self:m.controller,peer:{publicKey:h.publicKey,metadata:h.metadata},controller:l});return await this.client.session.set(b,S),await this.setExpiry(b,Bt(Mn)),a&&await this.client.core.pairing.updateMetadata({topic:a,metadata:S.peer.metadata}),a&&n&&(await this.sendResult(n,a,{relay:{protocol:i??"irn"},responderPublicKey:l}),await this.client.proposal.delete(n,Ge("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:a})),{topic:b,acknowledged:N}},this.reject=async r=>{this.isInitialized(),await this.isValidReject(r);const{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,Ge("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.isValidUpdate(r);const{topic:n,namespaces:i}=r,s=await this.sendRequest(n,"wc_sessionUpdate",{namespaces:i}),{done:o,resolve:a,reject:h}=nr();return this.events.once(je("session_update",s),({error:f})=>{f?h(f):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{this.isInitialized(),await this.isValidExtend(r);const{topic:n}=r,i=await this.sendRequest(n,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=nr();return this.events.once(je("session_extend",i),({error:h})=>{h?a(h):o()}),await this.setExpiry(n,Bt(Mn)),{acknowledged:s}},this.request=async r=>{this.isInitialized(),await this.isValidRequest(r);const{chainId:n,request:i,topic:s}=r,o=await this.sendRequest(s,"wc_sessionRequest",{request:i,chainId:n}),{done:a,resolve:h,reject:f}=nr();return this.events.once(je("session_request",o),({error:l,result:D})=>{l?f(l):h(D)}),await a()},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:i}=r,{id:s}=i;jt(i)?await this.sendResult(s,n,i.result):Ot(i)&&await this.sendError(s,n,i.error),this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0})},this.ping=async r=>{this.isInitialized(),await this.isValidPing(r);const{topic:n}=r;if(this.client.session.keys.includes(n)){const i=await this.sendRequest(n,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=nr();this.events.once(je("session_ping",i),({error:h})=>{h?a(h):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{this.isInitialized(),await this.isValidEmit(r);const{topic:n,event:i,chainId:s}=r;await this.sendRequest(n,"wc_sessionEvent",{event:i,chainId:s})},this.disconnect=async r=>{this.isInitialized(),await this.isValidDisconnect(r);const{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest(n,"wc_sessionDelete",Ge("USER_DISCONNECTED")),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>Up(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.deleteSession=async(r,n)=>{const{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await Promise.all([this.client.session.delete(r,Ge("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.deleteSymKey(r),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,Ge("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},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.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,n.expiry)},this.setPendingSessionRequest=async r=>{const n=Zr.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o}),n&&this.client.core.expirer.set(i,n)},this.sendRequest=async(r,n,i)=>{const s=sn(n,i),o=await this.client.core.crypto.encode(r,s),a=Zr[n].req;return this.client.core.history.set(r,s),this.client.core.relayer.publish(r,o,a),s.id},this.sendResult=async(r,n,i)=>{const s=on(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),h=Zr[a.request.method].res;this.client.core.relayer.publish(n,o,h),await this.client.core.history.resolve(s)},this.sendError=async(r,n,i)=>{const s=Lr(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),h=Zr[a.request.method].res;this.client.core.relayer.publish(n,o,h),await this.client.core.history.resolve(s)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(i=>{Gt(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{Gt(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=r=>{const{topic:n,payload:i}=r,s=i.method;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);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);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(r,n)=>{const{params:i,id:s}=n;try{this.isValidConnect(Kt({},n.params));const o=Bt(Z.FIVE_MINUTES),a=Kt({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{const{id:i}=n;if(jt(n)){const{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});const o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});const a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});const h=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:h});const f=await this.client.core.crypto.generateSharedKey(a,h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:f});const l=await this.client.core.relayer.subscribe(f);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:l}),await this.client.core.pairing.activate({topic:r})}else Ot(n)&&(await this.client.proposal.delete(i,Ge("USER_DISCONNECTED")),this.events.emit(je("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:h,namespaces:f,requiredNamespaces:l}=n.params,D={topic:r,relay:o,expiry:h,namespaces:f,acknowledged:!0,requiredNamespaces:l,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}};await this.sendResult(n.id,r,!0),this.events.emit(je("session_connect"),{session:D})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{const{id:i}=n;jt(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(je("session_approve",i),{})):Ot(n)&&(await this.client.session.delete(r,Ge("USER_DISCONNECTED")),this.events.emit(je("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:i,id:s}=n;try{this.isValidUpdate(Kt({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult(s,r,!0),this.client.events.emit("session_update",{id:s,topic:r,params:i})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(r,n)=>{const{id:i}=n;jt(n)?this.events.emit(je("session_update",i),{}):Ot(n)&&this.events.emit(je("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Bt(Mn)),await this.sendResult(i,r,!0),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{const{id:i}=n;jt(n)?this.events.emit(je("session_extend",i),{}):Ot(n)&&this.events.emit(je("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult(i,r,!0),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{const{id:i}=n;setTimeout(()=>{jt(n)?this.events.emit(je("session_ping",i),{}):Ot(n)&&this.events.emit(je("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 this.sendResult(i,r,!0),await this.deleteSession(r),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidRequest(Kt({topic:r},s)),await this.setPendingSessionRequest({id:i,topic:r,params:s}),this.client.events.emit("session_request",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{const{id:i}=n;jt(n)?this.events.emit(je("session_request",i),{result:n.result}):Ot(n)&&this.events.emit(je("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:i,params:s}=n;try{this.isValidEmit(Kt({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s})}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.isValidConnect=async r=>{if(!yt(r)){const{message:a}=V("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(a)}const{pairingTopic:n,requiredNamespaces:i,relays:s}=r;if(bt(n)||await this.isValidPairingTopic(n),!bt(i)&&yn(i)===0)return;const o=Gp(i,"connect()");if(o)throw new Error(o.message);if(!Wp(s,!0)){const{message:a}=V("MISSING_OR_INVALID",`connect() relays: ${s}`);throw new Error(a)}},this.isValidApprove=async r=>{if(!yt(r))throw new Error(V("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:i,relayProtocol:s}=r;await this.isValidProposalId(n);const o=this.client.proposal.get(n),a=vn(i,"approve()");if(a)throw new Error(a.message);const h=pa(o.requiredNamespaces,i,"update()");if(h)throw new Error(h.message);if(!st(s,!0)){const{message:f}=V("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}},this.isValidReject=async r=>{if(!yt(r)){const{message:s}=V("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:n,reason:i}=r;if(await this.isValidProposalId(n),!Yp(i)){const{message:s}=V("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!yt(r)){const{message:f}=V("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(f)}const{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!la(n)){const{message:f}=V("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(f)}const a=qp(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const h=vn(s,"onSessionSettleRequest()");if(h)throw new Error(h.message);if(Gt(o)){const{message:f}=V("EXPIRED","onSessionSettleRequest()");throw new Error(f)}},this.isValidUpdate=async r=>{if(!yt(r)){const{message:h}=V("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(h)}const{topic:n,namespaces:i}=r;await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=vn(i,"update()");if(o)throw new Error(o.message);const a=pa(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!yt(r)){const{message:i}=V("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!yt(r)){const{message:a}=V("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(a)}const{topic:n,request:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!da(o,s)){const{message:a}=V("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(a)}if(!Jp(i)){const{message:a}=V("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(a)}if(!Qp(o,s,i.method)){const{message:a}=V("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(a)}},this.isValidRespond=async r=>{if(!yt(r)){const{message:s}=V("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}const{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!Xp(i)){const{message:s}=V("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!yt(r)){const{message:i}=V("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!yt(r)){const{message:a}=V("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!da(o,s)){const{message:a}=V("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!Zp(i)){const{message:a}=V("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!eg(o,s,i.name)){const{message:a}=V("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!yt(r)){const{message:i}=V("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)}}isInitialized(){if(!this.initialized){const{message:e}=V("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(vt.message,async e=>{const{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;const i=await this.client.core.crypto.decode(r,n);Qn(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):ei(i)&&(await this.client.core.history.resolve(i),this.onRelayEventResponse({topic:r,payload:i}))})}registerExpirerEvents(){this.client.core.expirer.on(Et.expired,async e=>{const{topic:r,id:n}=na(e.target);if(n&&this.getPendingSessionRequests()[n])return await this.deletePendingSessionRequest(n,V("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&await this.deleteProposal(n,!0)})}isValidPairingTopic(e){if(!st(e,!1)){const{message:r}=V("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}=V("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(Gt(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=V("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!st(e,!1)){const{message:r}=V("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(!this.client.session.keys.includes(e)){const{message:r}=V("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(Gt(this.client.session.get(e).expiry)){await this.deleteSession(e);const{message:r}=V("EXPIRED",`session topic: ${e}`);throw new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(st(e,!1)){const{message:r}=V("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=V("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!kp(e)){const{message:r}=V("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=V("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(Gt(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);const{message:r}=V("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class pb extends Pn{constructor(e,r){super(e,r,ib,cs),this.core=e,this.logger=r}}class gb extends Pn{constructor(e,r){super(e,r,sb,cs),this.core=e,this.logger=r}}class yb extends Pn{constructor(e,r){super(e,r,ab,cs),this.core=e,this.logger=r}}class hs extends rv{constructor(e){super(e),this.protocol=fu,this.version=hu,this.name=us.name,this.events=new Nn.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||us.name,this.metadata=e?.metadata||yp();const r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:_n(Oe.getDefaultLoggerOptions({level:e?.logger||us.logger}));this.core=e?.core||new X_(e),this.logger=Oe.generateChildLogger(r,this.name),this.session=new gb(this.core,this.logger),this.proposal=new pb(this.core,this.logger),this.pendingRequest=new yb(this.core,this.logger),this.engine=new db(this)}static async init(e){const r=new hs(e);return await r.initialize(),r}get context(){return Oe.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.logger.info("SignClient Initilization Success")}catch(e){throw this.logger.info("SignClient Initilization Failure"),this.logger.error(e.message),e}}}var ls={exports:{}},Er=typeof Reflect=="object"?Reflect:null,gu=Er&&typeof Er.apply=="function"?Er.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Un;Er&&typeof Er.ownKeys=="function"?Un=Er.ownKeys:Object.getOwnPropertySymbols?Un=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Un=function(e){return Object.getOwnPropertyNames(e)};function vb(t){console&&console.warn&&console.warn(t)}var yu=Number.isNaN||function(e){return e!==e};function Te(){Te.init.call(this)}ls.exports=Te,ls.exports.once=wb,Te.EventEmitter=Te,Te.prototype._events=void 0,Te.prototype._eventsCount=0,Te.prototype._maxListeners=void 0;var vu=10;function jn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Te,"defaultMaxListeners",{enumerable:!0,get:function(){return vu},set:function(t){if(typeof t!="number"||t<0||yu(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");vu=t}}),Te.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},Te.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||yu(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 _u(t){return t._maxListeners===void 0?Te.defaultMaxListeners:t._maxListeners}Te.prototype.getMaxListeners=function(){return _u(this)},Te.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 o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var h=s[e];if(h===void 0)return!1;if(typeof h=="function")gu(h,this,r);else for(var f=h.length,l=Du(h,f),n=0;n<f;++n)gu(l[n],this,r);return!0};function bu(t,e,r,n){var i,s,o;if(jn(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),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=_u(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,vb(a)}return t}Te.prototype.addListener=function(e,r){return bu(this,e,r,!1)},Te.prototype.on=Te.prototype.addListener,Te.prototype.prependListener=function(e,r){return bu(this,e,r,!0)};function _b(){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 mu(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=_b.bind(n);return i.listener=r,n.wrapFn=i,i}Te.prototype.once=function(e,r){return jn(r),this.on(e,mu(this,e,r)),this},Te.prototype.prependOnceListener=function(e,r){return jn(r),this.prependListener(e,mu(this,e,r)),this},Te.prototype.removeListener=function(e,r){var n,i,s,o,a;if(jn(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,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():bb(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},Te.prototype.off=Te.prototype.removeListener,Te.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),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);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 wu(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?mb(i):Du(i,i.length)}Te.prototype.listeners=function(e){return wu(this,e,!0)},Te.prototype.rawListeners=function(e){return wu(this,e,!1)},Te.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Eu.call(t,e)},Te.prototype.listenerCount=Eu;function Eu(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}Te.prototype.eventNames=function(){return this._eventsCount>0?Un(this._events):[]};function Du(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function bb(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function mb(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function wb(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}xu(t,e,s,{once:!0}),e!=="error"&&Eb(t,i,{once:!0})})}function Eb(t,e,r){typeof t.on=="function"&&xu(t,"error",e,r)}function xu(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)}function Db(t){return typeof t<"u"&&typeof t.context<"u"}const Nt={init:"signer_init",uri:"signer_uri",created:"signer_created",updated:"signer_updated",deleted:"signer_deleted",event:"signer_event"};class xb extends xf{constructor(e){super(),this.events=new ls.exports.EventEmitter,this.pending=!1,this.initializing=!1,this.requiredNamespaces=e?.requiredNamespaces||{},this.opts=e?.client}get connected(){return typeof this.session<"u"}get connecting(){return this.pending}get chains(){return this.session?Li(this.session.namespaces):Xd(this.requiredNamespaces)}get accounts(){return this.session?Oi(this.session.namespaces):[]}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(){if(this.pending)return new Promise((e,r)=>{this.events.once("open",()=>{if(this.events.once("open_error",n=>{r(n)}),typeof this.client>"u")return r(new Error("Sign Client not initialized"));e()})});try{this.pending=!0;const e=await this.register(),r=e.find({requiredNamespaces:this.requiredNamespaces});if(r.length)return this.onOpen(r[0]);const{uri:n,approval:i}=await e.connect({requiredNamespaces:this.requiredNamespaces});this.events.emit(Nt.uri,{uri:n}),this.session=await i(),this.events.emit(Nt.created,this.session),this.onOpen()}catch(e){throw this.events.emit("open_error",e),e}}async close(){typeof this.session>"u"||(await(await this.register()).disconnect({topic:this.session.topic,reason:Ge("USER_DISCONNECTED")}),this.onClose())}async send(e,r){if(typeof this.client>"u"&&(this.client=await this.register(),this.connected||await this.open()),typeof this.session>"u")throw new Error("Signer connection is missing session");this.client.request({topic:this.session.topic,request:e,chainId:r?.chainId}).then(n=>this.events.emit("payload",on(e.id,n))).catch(n=>this.events.emit("payload",Lr(e.id,n.message)))}async register(e=this.opts){if(typeof this.client<"u")return this.client;if(this.initializing)return new Promise((r,n)=>{this.events.once("register_error",i=>{n(i)}),this.events.once(Nt.init,()=>{if(typeof this.client>"u")return n(new Error("Sign Client not initialized"));r(this.client)})});if(Db(e))return this.client=e,this.registerEventListeners(),this.client;try{return this.initializing=!0,this.client=await hs.init(e),this.initializing=!1,this.registerEventListeners(),this.events.emit(Nt.init),this.client}catch(r){throw this.events.emit("register_error",r),r}}onOpen(e){this.pending=!1,e&&(this.session=e),this.events.emit("open")}onClose(){this.pending=!1,this.client&&(this.client=void 0),this.events.emit("close")}registerEventListeners(){typeof this.client<"u"&&(this.client.on("session_event",e=>{var r;this.session&&((r=this.session)==null?void 0:r.topic)!==e.topic||this.events.emit(Nt.event,e.params)}),this.client.on("session_update",e=>{var r;typeof this.client<"u"&&(this.session&&((r=this.session)==null?void 0:r.topic)!==e.topic||(this.session=this.client.session.get(e.topic),this.events.emit(Nt.updated,this.session)))}),this.client.on("session_delete",e=>{var r;!this.session||this.session&&((r=this.session)==null?void 0:r.topic)!==e.topic||(this.onClose(),this.events.emit(Nt.deleted,this.session),this.session=void 0)}))}}const Sb=["eth_requestAccounts","eth_accounts","eth_chainId","eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","personal_sign"],Ob=["chainChanged","accountsChanged"];function Su(t){return{chains:t!=null&&t.chainId?[`eip155:${t.chainId}`]:[],methods:t?.methods||[],events:t?.events||[],rpcMap:t?.rpcMap||void 0}}function Ou(t,e){let r;return e.rpcMap&&(r=e.rpcMap[ds([t])]),r}function ds(t){return Number(t[0].split(":")[1])}class Lb{constructor(e){this.events=new Wn.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.rpc=Su(e),this.signer=this.setSignerProvider(e?.client),this.chainId=ds(this.rpc.chains),this.http=this.setHttpProvider(this.chainId),this.registerEventListeners()}async request(e){switch(e.method){case"eth_requestAccounts":return await this.connect(),this.accounts;case"eth_accounts":return this.accounts;case"eth_chainId":return this.chainId}if(e.method.startsWith("eth_signTypedData")||this.rpc.methods.includes(e.method))return this.signer.request(e,{chainId:this.formatChainId(this.chainId)});if(typeof this.http>"u")throw new Error(`Cannot request JSON-RPC method (${e.method}) without provided rpc url`);return this.http.request(e)}sendAsync(e,r){this.request(e).then(n=>r(null,n)).catch(n=>r(n,void 0))}get connected(){return this.signer.connection.connected}get connecting(){return this.signer.connection.connecting}async enable(){return await this.request({method:"eth_requestAccounts"})}async connect(){await this.signer.connect()}async disconnect(){await this.signer.disconnect()}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}registerEventListeners(){this.signer.on("connect",()=>{const e=this.signer.connection.chains;e&&e.length&&this.setChainIds(e);const r=this.signer.connection.accounts;r&&r.length&&this.setAccounts(r)}),this.signer.connection.on(Nt.created,e=>{const r=Li(e.namespaces,[this.namespace]);this.setChainIds(r);const n=Oi(e.namespaces,[this.namespace]);this.setAccounts(n)}),this.signer.connection.on(Nt.updated,e=>{const r=Li(e.namespaces,[this.namespace]);this.setChainIds(r);const n=Oi(e.namespaces,[this.namespace]);n!==this.accounts&&this.setAccounts(n)}),this.signer.connection.on(Nt.event,e=>{if(!this.rpc.chains.includes(e.chainId))return;const{event:r}=e;r.name==="accountsChanged"?(this.accounts=r.data,this.events.emit("accountsChanged",this.accounts)):r.name==="chainChanged"?this.setChainId(r.data):this.events.emit(r.name,r.data)}),this.signer.on("disconnect",()=>{this.events.emit("disconnect")}),this.events.on("chainChanged",e=>this.setHttpProvider(e))}setSignerProvider(e){const r=new xb({requiredNamespaces:{[this.namespace]:{chains:this.rpc.chains,methods:this.rpc.methods,events:this.rpc.events}},client:e});return new ti(r)}setHttpProvider(e){const r=Ou(`${this.namespace}:${e}`,this.rpc);return typeof r>"u"?void 0:new ti(new Cf(r))}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)).filter(n=>n!==this.chainId);r.length&&(this.chainId=r[0],this.events.emit("chainChanged",this.chainId))}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.events.emit("chainChanged",this.chainId)}}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)}}St.default=Lb,St.getEthereumChainId=ds,St.getRpcConfig=Su,St.getRpcUrl=Ou,St.signerEvents=Ob,St.signerMethods=Sb,Object.defineProperty(St,"__esModule",{value:!0})});
|
|
67
67
|
//# sourceMappingURL=index.umd.js.map
|